Skip to content

Commit 3611ea5

Browse files
authored
Allow resources to be updated by ODLM when control label is specified (#1010)
Signed-off-by: Daniel Fan <[email protected]>
1 parent 7f9f8d3 commit 3611ea5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controllers/operandrequest/reconcile_operand.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operato
269269
merr.Add(err)
270270
}
271271
} else {
272-
if r.CheckLabel(k8sRes, map[string]string{constant.OpreqLabel: "true"}) && res.Force {
272+
if res.Force {
273273
// Update k8s resource
274274
klog.V(3).Info("Found existing k8s resource: " + res.Name)
275275
if err := r.updateK8sResource(ctx, k8sRes, res.Data, res.Labels, res.Annotations); err != nil {
@@ -992,7 +992,7 @@ func (r *Reconciler) updateK8sResource(ctx context.Context, existingK8sRes unstr
992992
if err != nil {
993993
return errors.Wrapf(err, "failed to get k8s resource -- Kind: %s, NamespacedName: %s/%s", kind, namespace, name)
994994
}
995-
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) {
995+
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) && (newLabels == nil || newLabels[constant.OpreqLabel] != "true") {
996996
return nil
997997
}
998998

@@ -1050,7 +1050,7 @@ func (r *Reconciler) updateK8sResource(ctx context.Context, existingK8sRes unstr
10501050
return false, errors.Wrapf(err, "failed to get k8s resource -- Kind: %s, NamespacedName: %s/%s", kind, namespace, name)
10511051
}
10521052

1053-
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) {
1053+
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) && (newLabels == nil || newLabels[constant.OpreqLabel] != "true") {
10541054
return true, nil
10551055
}
10561056

0 commit comments

Comments
 (0)