Skip to content

Commit 2d8d9d3

Browse files
authored
Use PackageName name as the name of subscription (IBM#1084)
* use pkg name as the name of subscription Signed-off-by: YuChen <[email protected]> * fix for test error Signed-off-by: YuChen <[email protected]> --------- Signed-off-by: YuChen <[email protected]>
1 parent 6baae18 commit 2d8d9d3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

controllers/operandrequest/operandrequest_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
100100
if reflect.DeepEqual(existingInstance.Status, requestInstance.Status) {
101101
return
102102
}
103+
104+
// Update requestInstance's resource version to avoid conflicts
105+
requestInstance.ResourceVersion = existingInstance.ResourceVersion
103106
if err := r.Client.Status().Patch(ctx, requestInstance, client.MergeFrom(existingInstance)); err != nil && !apierrors.IsNotFound(err) {
104107
reconcileErr = utilerrors.NewAggregate([]error{reconcileErr, fmt.Errorf("error while patching OperandRequest.Status: %v", err)})
105108
}

controllers/operandrequest/reconcile_operator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ func (r *Reconciler) generateClusterObjects(o *operatorv1alpha1.Operator, regist
667667
// Subscription Object
668668
sub := &olmv1alpha1.Subscription{
669669
ObjectMeta: metav1.ObjectMeta{
670-
Name: o.Name,
670+
Name: o.PackageName,
671671
Namespace: namespace,
672672
Labels: labels,
673673
Annotations: annotations,
@@ -683,7 +683,7 @@ func (r *Reconciler) generateClusterObjects(o *operatorv1alpha1.Operator, regist
683683
},
684684
}
685685
sub.SetGroupVersionKind(schema.GroupVersionKind{Group: olmv1alpha1.SchemeGroupVersion.Group, Kind: "Subscription", Version: olmv1alpha1.SchemeGroupVersion.Version})
686-
klog.V(3).Info("Generating Subscription: ", o.Name, " in the Namespace: ", namespace)
686+
klog.V(3).Info("Generating Subscription: ", o.PackageName, " in the Namespace: ", namespace)
687687
co.subscription = sub
688688
return co
689689
}

0 commit comments

Comments
 (0)