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

[Bugfix]: Powerflex minimal manifest issue #855

Merged
merged 7 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 10 additions & 4 deletions pkg/drivers/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Comment on lines +76 to +78

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, because with minimal sample files, the replicas can be 0 in the CR. In this case, we want to use the default values in operatorconfig.

Without that check, the minimal manifests would deploy the driver pods w/o the deployment pods

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 {
Expand Down Expand Up @@ -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
}
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions tests/e2e/testfiles/scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2140,3 +2140,28 @@
run:
- /bin/bash modify_zoning_labels.sh remove-all-zones
- kubectl get nodes --show-labels

- scenario: "Install PowerFlex Driver (Minimal, Standalone)"
mgandharva marked this conversation as resolved.
Show resolved Hide resolved
paths:
- "testfiles/minimal-testfiles/storage_csm_powerflex.yaml"
tags:
- "powerflex"
- "sanity"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [op-e2e-vxflexos] and template [testfiles/powerflex-templates/powerflex-storageclass-template.yaml] for [pflex]"
- "Set up temporary secret with template [testfiles/powerflex-templates/powerflex-secret-template.yaml] name [test-vxflexos-config] in namespace [test-vxflexos] for [pflex]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powerflex] driver from CR [1] is installed"
- "Validate [powerflex] driver spec from CR [1]"
- "Run custom test"
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Validate [powerflex] driver from CR [1] is not installed"
- "Restore template [testfiles/powerflex-templates/powerflex-storageclass-template.yaml] for [pflex]"
customTest:
- name: Cert CSI
run:
- cert-csi test vio --sc op-e2e-vxflexos --chainNumber 2 --chainLength 2
Loading