Skip to content

Commit

Permalink
Merge pull request stolostron#257 from zhiweiyin318/fix-autodetect-la…
Browse files Browse the repository at this point in the history
…bels

fix that update clusterinfo labels constantly
  • Loading branch information
openshift-merge-robot authored Oct 21, 2020
2 parents 714a41f + 8c75e80 commit ade32b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controllers/autodetect/autodetect_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
}
}

if len(labels) == 0 && len(clusterInfo.ObjectMeta.Labels) == 0 {
return ctrl.Result{}, nil
}

if !reflect.DeepEqual(labels, clusterInfo.ObjectMeta.Labels) {
clusterInfo.SetLabels(labels)
if err := r.client.Update(ctx, clusterInfo); err != nil {
Expand Down

0 comments on commit ade32b2

Please sign in to comment.