Skip to content

Commit

Permalink
Allow resources to be updated by ODLM when control label is specified (
Browse files Browse the repository at this point in the history
…#1010)

Signed-off-by: Daniel Fan <[email protected]>
  • Loading branch information
Daniel-Fan authored Jan 11, 2024
1 parent 7f9f8d3 commit 3611ea5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/operandrequest/reconcile_operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operato
merr.Add(err)
}
} else {
if r.CheckLabel(k8sRes, map[string]string{constant.OpreqLabel: "true"}) && res.Force {
if res.Force {
// Update k8s resource
klog.V(3).Info("Found existing k8s resource: " + res.Name)
if err := r.updateK8sResource(ctx, k8sRes, res.Data, res.Labels, res.Annotations); err != nil {
Expand Down Expand Up @@ -992,7 +992,7 @@ func (r *Reconciler) updateK8sResource(ctx context.Context, existingK8sRes unstr
if err != nil {
return errors.Wrapf(err, "failed to get k8s resource -- Kind: %s, NamespacedName: %s/%s", kind, namespace, name)
}
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) {
if !r.CheckLabel(existingK8sRes, map[string]string{constant.OpreqLabel: "true"}) && (newLabels == nil || newLabels[constant.OpreqLabel] != "true") {
return nil
}

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

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

Expand Down

0 comments on commit 3611ea5

Please sign in to comment.