Skip to content

Commit

Permalink
feat: add componentplan-release label to subscription
Browse files Browse the repository at this point in the history
Signed-off-by: Abirdcfly <[email protected]>
  • Loading branch information
Abirdcfly committed Nov 2, 2023
1 parent fe6f6db commit ce40a6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
resources:
limits:
cpu: 5000m
memory: 1536Mi
memory: 15360Mi
requests:
cpu: 10m
memory: 64Mi
Expand Down
12 changes: 11 additions & 1 deletion controllers/subscription_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ func (r *SubscriptionReconciler) Reconcile(ctx context.Context, req ctrl.Request
return reconcile.Result{}, utils.IgnoreNotFound(err)
}
logger.V(1).Info("Get Subscription instance")

if sub.Labels[corev1alpha1.ComponentPlanReleaseNameLabel] != sub.Spec.Name {
if sub.GetLabels() == nil {
sub.Labels = make(map[string]string)
}
sub.Labels[corev1alpha1.ComponentPlanReleaseNameLabel] = sub.Spec.Name
err = r.Update(ctx, sub)
if err != nil {
logger.Error(err, "Failed to update Subscription release label")
}
return ctrl.Result{}, err
}
// Get watched component
component := &corev1alpha1.Component{}
err = r.Get(ctx, types.NamespacedName{Namespace: sub.Spec.ComponentRef.Namespace, Name: sub.Spec.ComponentRef.Name}, component)
Expand Down

0 comments on commit ce40a6b

Please sign in to comment.