Skip to content

Commit

Permalink
Handle ReplicaDiskSoftAntiAffinity during upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Weber <eric.weber@suse.com>
  • Loading branch information
ejweber committed Jul 26, 2023
1 parent 8a7eb4d commit 7933ad9
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 387 deletions.
16 changes: 8 additions & 8 deletions upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
upgradeutil "github.com/longhorn/longhorn-manager/upgrade/util"

"github.com/longhorn/longhorn-manager/meta"
"github.com/longhorn/longhorn-manager/upgrade/v14xto150"
"github.com/longhorn/longhorn-manager/upgrade/v15xto160"
"github.com/longhorn/longhorn-manager/upgrade/v1beta1"
)

Expand Down Expand Up @@ -219,23 +219,23 @@ func doResourceUpgrade(namespace string, lhClient *lhclientset.Clientset, kubeCl
return err
}

// When lhVersionBeforeUpgrade < v1.5.0, it is v1.4.x. The `CheckUpgradePathSupported` method would have failed us out earlier if it was not v1.4.x.
// When lhVersionBeforeUpgrade < v1.6.0, it is v1.5.x. The `CheckUpgradePathSupported` method would have failed us out earlier if it was not v1.5.x.
resourceMaps := map[string]interface{}{}
if semver.Compare(lhVersionBeforeUpgrade, "v1.5.0") < 0 {
logrus.Info("Walking through the resource upgrade path v1.4.x to v1.5.0")
if err := v14xto150.UpgradeResources(namespace, lhClient, kubeClient, resourceMaps); err != nil {
if semver.Compare(lhVersionBeforeUpgrade, "v1.6.0") < 0 {
logrus.Info("Walking through the resource upgrade path v1.5.x to v1.6.0")
if err := v15xto160.UpgradeResources(namespace, lhClient, kubeClient, resourceMaps); err != nil {
return err
}
}
if err := upgradeutil.UpdateResources(namespace, lhClient, resourceMaps); err != nil {
return err
}

// When lhVersionBeforeUpgrade < v1.5.0, it is v1.4.x. The `CheckUpgradePathSupported` method would have failed us out earlier if it was not v1.4.x.
// When lhVersionBeforeUpgrade < v1.6.0, it is v1.5.x. The `CheckUpgradePathSupported` method would have failed us out earlier if it was not v1.5.x.
resourceMaps = map[string]interface{}{}
if semver.Compare(lhVersionBeforeUpgrade, "v1.5.0") < 0 {
logrus.Info("Walking through the resource status upgrade path v1.4.x to v1.5.0")
if err := v14xto150.UpgradeResourcesStatus(namespace, lhClient, kubeClient, resourceMaps); err != nil {
logrus.Info("Walking through the resource status upgrade path v1.5.x to v1.6.0")
if err := v15xto160.UpgradeResourcesStatus(namespace, lhClient, kubeClient, resourceMaps); err != nil {
return err
}
}
Expand Down
Loading

0 comments on commit 7933ad9

Please sign in to comment.