fix: can not re-upgrade helm application in a failed state (#5543)
This commit is contained in:
@@ -179,9 +179,16 @@ func (r *ReconcileHelmRelease) reconcile(instance *v1alpha1.HelmRelease) (reconc
|
||||
|
||||
var err error
|
||||
switch instance.Status.State {
|
||||
case v1alpha1.HelmStatusDeleting, v1alpha1.HelmStatusFailed:
|
||||
case v1alpha1.HelmStatusDeleting:
|
||||
// no operation
|
||||
return reconcile.Result{}, nil
|
||||
case v1alpha1.HelmStatusFailed:
|
||||
// Release used to be failed, but instance.Status.Version not equal to instance.Spec.Version
|
||||
if instance.Status.Version != instance.Spec.Version {
|
||||
return r.createOrUpgradeHelmRelease(instance, true)
|
||||
} else {
|
||||
return reconcile.Result{}, nil
|
||||
}
|
||||
case v1alpha1.HelmStatusActive:
|
||||
// Release used to be active, but instance.Status.Version not equal to instance.Spec.Version
|
||||
if instance.Status.Version != instance.Spec.Version {
|
||||
|
||||
@@ -102,7 +102,7 @@ func (c *releaseOperator) UpgradeApplication(request UpgradeClusterRequest) erro
|
||||
}
|
||||
|
||||
switch oldRls.Status.State {
|
||||
case v1alpha1.StateActive, v1alpha1.HelmStatusUpgraded, v1alpha1.HelmStatusCreated:
|
||||
case v1alpha1.StateActive, v1alpha1.HelmStatusUpgraded, v1alpha1.HelmStatusCreated, v1alpha1.HelmStatusFailed:
|
||||
// no operation
|
||||
default:
|
||||
return errors.New("can not upgrade application now")
|
||||
|
||||
Reference in New Issue
Block a user