Fix typo && Add comments

Signed-off-by: LiHui <andrewli@yunify.com>
This commit is contained in:
LiHui
2021-08-10 11:17:51 +08:00
parent 3e5822a0b2
commit 06cdab56f6
5 changed files with 28 additions and 18 deletions

View File

@@ -425,10 +425,13 @@ func (r *Reconciler) deleteHelmApps(ctx context.Context, ws string) error {
return err
}
for _, app := range apps.Items {
if _, exists := app.Annotations[constants.DangingAppCleanupKey]; !exists {
if app.Annotations == nil {
app.Annotations = map[string]string{}
}
if _, exists := app.Annotations[constants.DanglingAppCleanupKey]; !exists {
// Mark the app, the cleanup is in the application controller.
appCopy := app.DeepCopy()
appCopy.Annotations[constants.DangingAppCleanupKey] = constants.CleanupDangingAppOngoing
appCopy.Annotations[constants.DanglingAppCleanupKey] = constants.CleanupDanglingAppOngoing
appPatch := client.MergeFrom(&app)
err = r.Patch(ctx, appCopy, appPatch)
if err != nil {