Skip to content

Commit

Permalink
fix(application): sync chart version in rollback (#1908)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Ryu authored May 7, 2022
1 parent a65952d commit 854587c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/application/controller/app/app_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ func (c *Controller) syncAppFromRelease(ctx context.Context, cachedApp *cachedAp
newStatus.LastTransitionTime = metav1.Now()
return c.updateStatus(ctx, app, &app.Status, newStatus)
}
app.Spec.Chart.ChartVersion = rel.Chart.Metadata.Version
_, err = c.client.ApplicationV1().Apps(app.Namespace).Update(ctx, app, metav1.UpdateOptions{})
if err != nil {
return app, fmt.Errorf("update chart version failed %v", err)
}

newStatus.Phase = applicationv1.AppPhaseSucceeded
newStatus.Message = ""
Expand Down
2 changes: 1 addition & 1 deletion pkg/application/registry/application/storage/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (rs *REST) Update(ctx context.Context, name string, objInfo rest.UpdatedObj
}
}

if !reflect.DeepEqual(oldApp.Spec, app.Spec) {
if !reflect.DeepEqual(oldApp.Spec, app.Spec) && app.Status.Phase != applicationapi.AppPhaseRolledBack {
app.Status.Phase = applicationapi.AppPhaseUpgrading
}

Expand Down

0 comments on commit 854587c

Please sign in to comment.