Skip to content

Commit

Permalink
fix: adjust the update logic of deprecated configmap day2 configuration
Browse files Browse the repository at this point in the history
Signed-off-by: chlins <chenyuzh@vmware.com>
  • Loading branch information
chlins committed Jan 11, 2022
1 parent 7069994 commit 6793210
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions controllers/goharbor/configuration/cm_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,16 @@ func (r *CmReconciler) createOrUpdateHarborConfiguration(ctx context.Context, hc
if err != nil {
if apierrors.IsNotFound(err) {
// create hc
r.Log.Info("Create HarborConfiguration", "hc", hc)
return r.Client.Create(ctx, hc)
}
}

// hc exist
return r.Client.Update(ctx, hc)
// if hc exist, update it
new := old.DeepCopy()
new.Spec = hc.Spec

r.Log.Info("Update HarborConfiguration", "hc", new)

return r.Client.Update(ctx, new)
}

0 comments on commit 6793210

Please sign in to comment.