Skip to content

Commit

Permalink
fix: application loses recommended labels
Browse files Browse the repository at this point in the history
  • Loading branch information
0xff-dev committed Apr 2, 2024
1 parent 4a007ae commit 46d27b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions controllers/base/application_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}

if MigrateAppCategory(app) {
return ctrl.Result{}, r.Client.Update(ctx, app)
return ctrl.Result{Requeue: true}, r.Client.Update(ctx, app)
}

// Check if the Application instance is marked to be deleted, which is
Expand Down Expand Up @@ -166,8 +166,10 @@ func MigrateAppCategory(app *arcadiav1alpha1.Application) bool {
if app.Labels == nil {
app.Labels = make(map[string]string)
}
app.Labels[arcadiav1alpha1.AppCategoryLabelKey] = v
return true
if _, ok := app.Labels[arcadiav1alpha1.AppCategoryLabelKey]; !ok {
app.Labels[arcadiav1alpha1.AppCategoryLabelKey] = v
return true
}
}
return false
}
Expand Down

0 comments on commit 46d27b3

Please sign in to comment.