Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade): allow upgrades for volumes without monitor #1760

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/apis/openebs.io/v1alpha1/versionDetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
"1.4.0": true, "1.5.0": true, "1.6.0": true, "1.7.0": true,
"1.8.0": true, "1.9.0": true, "1.10.0": true, "1.11.0": true,
"1.12.0": true, "2.0.0": true, "2.1.0": true, "2.2.0": true,
"2.3.0": true,
}
validDesiredVersion = strings.Split(version.GetVersion(), "-")[0]
)
Expand Down
2 changes: 2 additions & 0 deletions pkg/upgrade/templates/v1/cstor_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var (
]
{{end}}
},
{{if .IsMonitorEnabled}}
{
"name": "maya-volume-exporter",
"image": "{{.MExporterImage}}:{{.ImageTag}}"{{if isCurrentLessThanNewVersion .CurrentVersion "1.7.0"}},
Expand All @@ -55,6 +56,7 @@ var (
]
{{end}}
},
{{end}}
{
"name": "cstor-volume-mgmt",
"image": "{{.VolumeMgmtImage}}:{{.ImageTag}}"{{if isCurrentLessThanNewVersion .CurrentVersion "1.7.0"}},
Expand Down
3 changes: 2 additions & 1 deletion pkg/upgrade/templates/v1/jiva_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ var (
{
"name": "{{.ControllerContainerName}}",
"image": "{{.ControllerImage}}:{{.ImageTag}}"
},
}{{if .IsMonitorEnabled}},
{
"name": "maya-volume-exporter",
"image": "{{.MExporterImage}}:{{.ImageTag}}"
}
{{end}}
]
}
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/upgrade/upgrader/cstor_volume_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
type cstorTargetPatchDetails struct {
CurrentVersion, UpgradeVersion, ImageTag, IstgtImage,
BaseDir, MExporterImage, VolumeMgmtImage, PVName string
IsMonitorEnabled bool
}

const (
Expand Down Expand Up @@ -69,6 +70,7 @@ func getTargetDeployPatchDetails(
d *appsv1.Deployment,
) (*cstorTargetPatchDetails, error) {
patchDetails := &cstorTargetPatchDetails{}
patchDetails.IsMonitorEnabled = true
if d.Name == "" {
return nil, errors.Errorf("missing deployment name")
}
Expand All @@ -79,7 +81,11 @@ func getTargetDeployPatchDetails(
patchDetails.IstgtImage = istgtImage
mexporterImage, err := getBaseImage(d, "maya-volume-exporter")
if err != nil {
return nil, err
if err.Error() == "image not found for container maya-volume-exporter" {
patchDetails.IsMonitorEnabled = false
} else {
return nil, err
}
}
patchDetails.MExporterImage = mexporterImage
volumeMgmtImage, err := getBaseImage(d, "cstor-volume-mgmt")
Expand Down
8 changes: 7 additions & 1 deletion pkg/upgrade/upgrader/jiva_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type replicaPatchDetails struct {

type controllerPatchDetails struct {
UpgradeVersion, ImageTag, ControllerContainerName, ControllerImage, MExporterImage string
IsMonitorEnabled bool
}

type replicaDetails struct {
Expand Down Expand Up @@ -92,6 +93,7 @@ func getControllerPatchDetails(d *appsv1.Deployment) (
error,
) {
patchDetails := &controllerPatchDetails{}
patchDetails.IsMonitorEnabled = true
// verify delpoyment name
if d.Name == "" {
return nil, errors.New("missing deployment name")
Expand All @@ -108,7 +110,11 @@ func getControllerPatchDetails(d *appsv1.Deployment) (
patchDetails.ControllerImage = image
image, err = getBaseImage(d, "maya-volume-exporter")
if err != nil {
return nil, err
if err.Error() == "image not found for container maya-volume-exporter" {
patchDetails.IsMonitorEnabled = false
} else {
return nil, err
}
}
patchDetails.MExporterImage = image
if imageTag != "" {
Expand Down