From 42800ad7a5bed0bfca69654987cee01c0b5b8bc1 Mon Sep 17 00:00:00 2001 From: Shubham Bajpai Date: Fri, 10 Apr 2020 22:48:37 +0530 Subject: [PATCH] fix(upgarde): scale down jiva contoller deployment only if not upgraded (#1663) scale down jiva deployment only if not upgraded. avoid scaling down the controller or replica deployment because of an accidental run of upgrade on already upgraded jiva volume. Signed-off-by: shubham --- pkg/upgrade/upgrader/jiva_upgrade.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/upgrade/upgrader/jiva_upgrade.go b/pkg/upgrade/upgrader/jiva_upgrade.go index bf8c02c676..55f41cdc73 100644 --- a/pkg/upgrade/upgrader/jiva_upgrade.go +++ b/pkg/upgrade/upgrader/jiva_upgrade.go @@ -517,6 +517,21 @@ func (j *jivaVolumeOptions) replicaUpgrade(pvName, openebsNamespace string) erro } statusObj.Phase = utask.StepErrored + // Continue with replica upgrade only if the controller is not upgraded + // otherwise return from here itself, + // as controller is always upgarded after replicas are successfully upgraded. + if j.controllerObj.version == upgradeVersion { + klog.Infof("replicas already in %s version", upgradeVersion) + statusObj.Phase = utask.StepCompleted + statusObj.Message = "Replica upgrade was successful" + statusObj.Reason = "" + j.utaskObj, uerr = updateUpgradeDetailedStatus(j.utaskObj, statusObj, openebsNamespace) + if uerr != nil && isENVPresent { + return uerr + } + return nil + } + // Scaling down controller ensures no I/O occurs // which make volume to come in RW mode early err = scaleDeploy(j.controllerObj.name, j.ns, ctrlDeployLabel, 0)