diff --git a/pkg/drivers/common_test.go b/pkg/drivers/common_test.go index bc79de9b..2942160d 100644 --- a/pkg/drivers/common_test.go +++ b/pkg/drivers/common_test.go @@ -116,7 +116,7 @@ func csmWithTolerations(driver csmv1.DriverType, version string) csmv1.Container return res } -// JJL make a functino that uses the standard name and calls this function +// JJL make a function that uses the standard name and calls this function // makes a pflex csm object func csmForPowerFlex(customCSMName string) csmv1.ContainerStorageModule { res := shared.MakeCSM(customCSMName, pFlexNS, shared.PFlexConfigVersion) @@ -158,6 +158,11 @@ func csmForPowerFlex(customCSMName string) csmv1.ContainerStorageModule { // Add driver common image res.Spec.Driver.Common.Image = "driverimage" + // minimal manifests will not have a common section + if customCSMName == "no-common-section" { + res.Spec.Driver.Common = nil + } + return res } diff --git a/pkg/drivers/commonconfig.go b/pkg/drivers/commonconfig.go index ea78fce3..390acaf6 100644 --- a/pkg/drivers/commonconfig.go +++ b/pkg/drivers/commonconfig.go @@ -71,8 +71,11 @@ func GetController(ctx context.Context, cr csmv1.ContainerStorageModule, operato } controllerYAML := driverYAML.(utils.ControllerYAML) - controllerYAML.Deployment.Spec.Replicas = &cr.Spec.Driver.Replicas + // if using a minimal manifest, replicas may not be present. + if cr.Spec.Driver.Replicas != 0 { + controllerYAML.Deployment.Spec.Replicas = &cr.Spec.Driver.Replicas + } if cr.Spec.Driver.Controller != nil && len(cr.Spec.Driver.Controller.Tolerations) != 0 { tols := make([]acorev1.TolerationApplyConfiguration, 0) for _, t := range cr.Spec.Driver.Controller.Tolerations { @@ -340,9 +343,12 @@ func GetNode(ctx context.Context, cr csmv1.ContainerStorageModule, operatorConfi utils.UpdateInitContainerApply(updatedCr.Spec.Driver.InitContainers, &initcontainers[i]) // mdm-container is exclusive to powerflex driver deamonset, will use the driver image as an init container if *initcontainers[i].Name == "mdm-container" { - if string(cr.Spec.Driver.Common.Image) != "" { - image := string(cr.Spec.Driver.Common.Image) - initcontainers[i].Image = &image + // driver minimial manifest may not have common section + if cr.Spec.Driver.Common != nil { + if string(cr.Spec.Driver.Common.Image) != "" { + image := string(cr.Spec.Driver.Common.Image) + initcontainers[i].Image = &image + } } } } diff --git a/pkg/drivers/commonconfig_test.go b/pkg/drivers/commonconfig_test.go index 6e85ce50..8e5b19b5 100644 --- a/pkg/drivers/commonconfig_test.go +++ b/pkg/drivers/commonconfig_test.go @@ -52,6 +52,7 @@ var ( {"powerscale happy path", pScaleCSM, csmv1.PowerScaleName, "node.yaml", ""}, {"pflex happy path", pFlexCSM, csmv1.PowerFlex, "node.yaml", ""}, {"pflex no-sdc path", csmForPowerFlex("no-sdc"), csmv1.PowerFlex, "node.yaml", ""}, + {"pflex with no common section", csmForPowerFlex("no-common-section"), csmv1.PowerFlex, "node.yaml", ""}, {"pstore happy path", pStoreCSM, csmv1.PowerStore, "node.yaml", ""}, {"unity happy path", unityCSM, csmv1.Unity, "node.yaml", ""}, {"unity happy path when secrets with certificates provided", unityCSMCertProvided, csmv1.Unity, "node.yaml", ""}, @@ -142,7 +143,10 @@ func TestGetNode(t *testing.T) { for i := range initcontainers { if *initcontainers[i].Name == "mdm-container" { foundInitMdm = true - assert.Equal(t, string(tt.csm.Spec.Driver.Common.Image), *initcontainers[i].Image) + // if min manifest test case, there will be no common section + if tt.name != "pflex with no common section" { + assert.Equal(t, string(tt.csm.Spec.Driver.Common.Image), *initcontainers[i].Image) + } } } // if driver is powerflex, then check that mdm-container is present diff --git a/tests/e2e/testfiles/scenarios.yaml b/tests/e2e/testfiles/scenarios.yaml index a22ea9f8..cfec3229 100644 --- a/tests/e2e/testfiles/scenarios.yaml +++ b/tests/e2e/testfiles/scenarios.yaml @@ -168,7 +168,6 @@ - "Delete custom resource [4]" - "Validate [powerflex] driver from CR [4] is not installed" - "Delete custom resource [2]" - - "Validate [authorization-proxy-server] module from CR [2] is not installed" - "Restore template [testfiles/powerflex-templates/powerflex-storageclass-template.yaml] for [pflex]" customTest: - name: Cert CSI diff --git a/tests/e2e/testfiles/storage_csm_powerflex_alt_vals_2.yaml b/tests/e2e/testfiles/storage_csm_powerflex_alt_vals_2.yaml index 995597d7..6f9e29dc 100644 --- a/tests/e2e/testfiles/storage_csm_powerflex_alt_vals_2.yaml +++ b/tests/e2e/testfiles/storage_csm_powerflex_alt_vals_2.yaml @@ -12,7 +12,8 @@ spec: # Default value: ReadWriteOnceWithFSType fSGroupPolicy: "None" configVersion: v2.13.0 - replicas: 2 + # setting replicas to 1 since this file is using control node to install deployment on control plane node + replicas: 1 dnsPolicy: ClusterFirstWithHostNet forceRemoveDriver: false common: