Skip to content

Commit

Permalink
[bug-1502]: Add csi-ephemeral-volume-profile label to CSIDriver (#731)
Browse files Browse the repository at this point in the history
* ephemeral tests

* finish udpating tests

* new lines

* dynamic vol name in pflex

* and sanity tags
  • Loading branch information
atye authored Oct 11, 2024
1 parent 43a0636 commit 1a1ebd2
Show file tree
Hide file tree
Showing 31 changed files with 145 additions and 18 deletions.
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerflex/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerflex/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerflex/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerscale/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerscale/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerscale/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerstore/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerstore/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/powerstore/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/unity/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/unity/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions operatorconfig/driverconfig/unity/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerflex/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerflex/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerflex/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-vxflexos.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
fsGroupPolicy: ReadWriteOnceWithFSType
attachRequired: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerscale/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerscale/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerscale/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-isilon.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerstore/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerstore/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/powerstore/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-powerstore.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
storageCapacity: false
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/unity/v2.10.1/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/unity/v2.11.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
2 changes: 2 additions & 0 deletions tests/config/driverconfig/unity/v2.12.0/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi-unity.dellemc.com
labels:
security.openshift.io/csi-ephemeral-volume-profile: restricted
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
81 changes: 63 additions & 18 deletions tests/e2e/steps/steps_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"bytes"
"context"
"fmt"
"math/rand"
"os"
"os/exec"
"strconv"
Expand Down Expand Up @@ -48,29 +49,33 @@ const (
)

var (
authString = "karavi-authorization-proxy"
operatorNamespace = "dell-csm-operator"
quotaLimit = "30000000"
pflexSecretMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_PASS": "PFLEX_PASS", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_ENDPOINT", "REPLACE_MDM": "PFLEX_MDM", "REPLACE_POOL": "PFLEX_POOL", "REPLACE_NAS": "PFLEX_NAS"}
pflexAuthSecretMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_AUTH_ENDPOINT", "REPLACE_MDM": "PFLEX_MDM"}
pscaleSecretMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_USER": "PSCALE_USER", "REPLACE_PASS": "PSCALE_PASS", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_PORT": "PSCALE_PORT"}
pscaleAuthSecretMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_USER": "PSCALE_USER", "REPLACE_PASS": "PSCALE_PASS", "REPLACE_AUTH_ENDPOINT": "PSCALE_AUTH_ENDPOINT", "REPLACE_AUTH_PORT": "PSCALE_AUTH_PORT", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_PORT": "PSCALE_PORT"}
pscaleAuthSidecarMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PSCALE_AUTH_ENDPOINT", "REPLACE_AUTH_PORT": "PSCALE_AUTH_PORT", "REPLACE_PORT": "PSCALE_PORT"}
pflexAuthSidecarMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_PASS": "PFLEX_PASS", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PFLEX_AUTH_ENDPOINT"}
pmaxCredMap = map[string]string{"REPLACE_USER": "PMAX_USER_ENCODED", "REPLACE_PASS": "PMAX_PASS_ENCODED"}
pmaxAuthSidecarMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_ENDPOINT": "PMAX_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
pmaxStorageMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_RESOURCE_POOL": "PMAX_POOL_V1", "REPLACE_SERVICE_LEVEL": "PMAX_SERVICE_LEVEL"}
pmaxReverseProxyMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
authSidecarRootCertMap = map[string]string{}
amConfigMap = map[string]string{"REPLACE_ALT_BUCKET_NAME": "ALT_BUCKET_NAME", "REPLACE_BUCKET_NAME": "BUCKET_NAME", "REPLACE_S3URL": "BACKEND_STORAGE_URL", "REPLACE_CONTROLLER_IMAGE": "AM_CONTROLLER_IMAGE", "REPLACE_PLUGIN_IMAGE": "AM_PLUGIN_IMAGE"}
pmaxArrayConfigMap = map[string]string{"REPLACE_PORTGROUPS": "PMAX_PORTGROUPS", "REPLACE_PROTOCOL": "PMAX_PROTOCOL", "REPLACE_ARRAYS": "PMAX_ARRAYS", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
authString = "karavi-authorization-proxy"
operatorNamespace = "dell-csm-operator"
quotaLimit = "30000000"
pflexSecretMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_PASS": "PFLEX_PASS", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_ENDPOINT", "REPLACE_MDM": "PFLEX_MDM", "REPLACE_POOL": "PFLEX_POOL", "REPLACE_NAS": "PFLEX_NAS"}
pflexEphemeralVolumeMap = map[string]string{"REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_POOL": "PFLEX_POOL", "REPLACE_VOLUME": "PFLEX_VOLUME"}
pflexAuthSecretMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_AUTH_ENDPOINT", "REPLACE_MDM": "PFLEX_MDM"}
pscaleSecretMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_USER": "PSCALE_USER", "REPLACE_PASS": "PSCALE_PASS", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_PORT": "PSCALE_PORT"}
pscaleAuthSecretMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_USER": "PSCALE_USER", "REPLACE_PASS": "PSCALE_PASS", "REPLACE_AUTH_ENDPOINT": "PSCALE_AUTH_ENDPOINT", "REPLACE_AUTH_PORT": "PSCALE_AUTH_PORT", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_PORT": "PSCALE_PORT"}
pscaleAuthSidecarMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PSCALE_AUTH_ENDPOINT", "REPLACE_AUTH_PORT": "PSCALE_AUTH_PORT", "REPLACE_PORT": "PSCALE_PORT"}
pscaleEphemeralVolumeMap = map[string]string{"REPLACE_CLUSTERNAME": "PSCALE_CLUSTER", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT"}
pflexAuthSidecarMap = map[string]string{"REPLACE_USER": "PFLEX_USER", "REPLACE_PASS": "PFLEX_PASS", "REPLACE_SYSTEMID": "PFLEX_SYSTEMID", "REPLACE_ENDPOINT": "PFLEX_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PFLEX_AUTH_ENDPOINT"}
pmaxCredMap = map[string]string{"REPLACE_USER": "PMAX_USER_ENCODED", "REPLACE_PASS": "PMAX_PASS_ENCODED"}
pmaxAuthSidecarMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_ENDPOINT": "PMAX_ENDPOINT", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
pmaxStorageMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_RESOURCE_POOL": "PMAX_POOL_V1", "REPLACE_SERVICE_LEVEL": "PMAX_SERVICE_LEVEL"}
pmaxReverseProxyMap = map[string]string{"REPLACE_SYSTEMID": "PMAX_SYSTEMID", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
authSidecarRootCertMap = map[string]string{}
amConfigMap = map[string]string{"REPLACE_ALT_BUCKET_NAME": "ALT_BUCKET_NAME", "REPLACE_BUCKET_NAME": "BUCKET_NAME", "REPLACE_S3URL": "BACKEND_STORAGE_URL", "REPLACE_CONTROLLER_IMAGE": "AM_CONTROLLER_IMAGE", "REPLACE_PLUGIN_IMAGE": "AM_PLUGIN_IMAGE"}
pmaxArrayConfigMap = map[string]string{"REPLACE_PORTGROUPS": "PMAX_PORTGROUPS", "REPLACE_PROTOCOL": "PMAX_PROTOCOL", "REPLACE_ARRAYS": "PMAX_ARRAYS", "REPLACE_AUTH_ENDPOINT": "PMAX_AUTH_ENDPOINT"}
// Auth V2
pflexCrMap = map[string]string{"REPLACE_STORAGE_NAME": "PFLEX_STORAGE", "REPLACE_STORAGE_TYPE": "PFLEX_STORAGE", "REPLACE_ENDPOINT": "PFLEX_ENDPOINT", "REPLACE_SYSTEM_ID": "PFLEX_SYSTEMID", "REPLACE_VAULT_STORAGE_PATH": "PFLEX_VAULT_STORAGE_PATH", "REPLACE_ROLE_NAME": "PFLEX_ROLE", "REPLACE_QUOTA": "PFLEX_QUOTA", "REPLACE_STORAGE_POOL_PATH": "PFLEX_POOL", "REPLACE_TENANT_NAME": "PFLEX_TENANT", "REPLACE_TENANT_ROLES": "PFLEX_ROLE", "REPLACE_TENANT_VOLUME_PREFIX": "PFLEX_TENANT_PREFIX"}
pscaleCrMap = map[string]string{"REPLACE_STORAGE_NAME": "PSCALE_STORAGE", "REPLACE_STORAGE_TYPE": "PSCALE_STORAGE", "REPLACE_ENDPOINT": "PSCALE_ENDPOINT", "REPLACE_SYSTEM_ID": "PSCALE_CLUSTER", "REPLACE_VAULT_STORAGE_PATH": "PSCALE_VAULT_STORAGE_PATH", "REPLACE_ROLE_NAME": "PSCALE_ROLE", "REPLACE_QUOTA": "PSCALE_QUOTA", "REPLACE_STORAGE_POOL_PATH": "PSCALE_POOL_V2", "REPLACE_TENANT_NAME": "PSCALE_TENANT", "REPLACE_TENANT_ROLES": "PSCALE_ROLE", "REPLACE_TENANT_VOLUME_PREFIX": "PSCALE_TENANT_PREFIX"}
pmaxCrMap = map[string]string{"REPLACE_STORAGE_NAME": "PMAX_STORAGE", "REPLACE_STORAGE_TYPE": "PMAX_STORAGE", "REPLACE_ENDPOINT": "PMAX_ENDPOINT", "REPLACE_SYSTEM_ID": "PMAX_SYSTEMID", "REPLACE_VAULT_STORAGE_PATH": "PMAX_VAULT_STORAGE_PATH", "REPLACE_ROLE_NAME": "PMAX_ROLE", "REPLACE_QUOTA": "PMAX_QUOTA", "REPLACE_STORAGE_POOL_PATH": "PMAX_POOL_V2", "REPLACE_TENANT_NAME": "PMAX_TENANT", "REPLACE_TENANT_ROLES": "PMAX_ROLE", "REPLACE_TENANT_VOLUME_PREFIX": "PMAX_TENANT_PREFIX"}

pstoreSecretMap = map[string]string{"REPLACE_USER": "PSTORE_USER", "REPLACE_PASS": "PSTORE_PASS", "REPLACE_GLOBALID": "PSTORE_GLOBALID", "REPLACE_ENDPOINT": "PSTORE_ENDPOINT"}
unitySecretMap = map[string]string{"REPLACE_USER": "UNITY_USER", "REPLACE_PASS": "UNITY_PASS", "REPLACE_ARRAYID": "UNITY_ARRAYID", "REPLACE_ENDPOINT": "UNITY_ENDPOINT", "REPLACE_POOL": "UNITY_POOL", "REPLACE_NAS": "UNITY_NAS"}
pstoreSecretMap = map[string]string{"REPLACE_USER": "PSTORE_USER", "REPLACE_PASS": "PSTORE_PASS", "REPLACE_GLOBALID": "PSTORE_GLOBALID", "REPLACE_ENDPOINT": "PSTORE_ENDPOINT"}
pstoreEphemeralVolumeMap = map[string]string{"REPLACE_GLOBALID": "PSTORE_GLOBALID"}
unitySecretMap = map[string]string{"REPLACE_USER": "UNITY_USER", "REPLACE_PASS": "UNITY_PASS", "REPLACE_ARRAYID": "UNITY_ARRAYID", "REPLACE_ENDPOINT": "UNITY_ENDPOINT", "REPLACE_POOL": "UNITY_POOL", "REPLACE_NAS": "UNITY_NAS"}
unityEphemeralVolumeMap = map[string]string{"REPLACE_ARRAYID": "UNITY_ARRAYID", "REPLACE_POOL": "UNITY_POOL"}
)

var correctlyAuthInjected = func(cr csmv1.ContainerStorageModule, annotations map[string]string, vols []acorev1.VolumeApplyConfiguration, cnt []acorev1.ContainerApplyConfiguration) error {
Expand Down Expand Up @@ -816,8 +821,12 @@ func determineMap(crType string) (map[string]string, error) {
mapValues = pflexSecretMap
} else if crType == "pflexAuth" {
mapValues = pflexAuthSecretMap
} else if crType == "pflexEphemeral" {
mapValues = pflexEphemeralVolumeMap
} else if crType == "pscale" {
mapValues = pscaleSecretMap
} else if crType == "pscaleEphemeral" {
mapValues = pscaleEphemeralVolumeMap
} else if crType == "pscaleAuth" {
mapValues = pscaleAuthSecretMap
} else if crType == "pscaleAuthSidecar" {
Expand Down Expand Up @@ -846,8 +855,12 @@ func determineMap(crType string) (map[string]string, error) {
mapValues = pmaxCrMap
} else if crType == "pstore" {
mapValues = pstoreSecretMap
} else if crType == "pstoreEphemeral" {
mapValues = pstoreEphemeralVolumeMap
} else if crType == "unity" {
mapValues = unitySecretMap
} else if crType == "unityEphemeral" {
mapValues = unityEphemeralVolumeMap
} else {
return mapValues, fmt.Errorf("type: %s is not supported", crType)
}
Expand Down Expand Up @@ -906,6 +919,38 @@ func (step *Step) runCustomTest(res Resource) error {
return nil
}

func (step *Step) setupEphemeralVolumeProperties(res Resource, templateFile string, crType string) error {
mapValues, err := determineMap(crType)
if err != nil {
return err
}

if crType == "pflexEphemeral" {
os.Setenv("PFLEX_VOLUME", fmt.Sprintf("k8s-%s", randomAlphaNumberic(10)))
}

for key := range mapValues {
err := replaceInFile(key, os.Getenv(mapValues[key]), templateFile)
if err != nil {
return err
}
}

return nil
}

func randomAlphaNumberic(length int) string {
charset := "abcdefghijklmnopqrstuvwxyz0123456789"

var result []byte
for i := 0; i < length; i++ {
randomIndex := rand.Intn(len(charset))
result = append(result, charset[randomIndex])
}

return string(result)
}

func (step *Step) enableModule(res Resource, module string, crNumStr string) error {
crNum, _ := strconv.Atoi(crNumStr)
cr := res.CustomResource[crNum-1].(csmv1.ContainerStorageModule)
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/steps/steps_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func StepRunnerInit(runner *Runner, ctrlClient client.Client, clientSet *kuberne
runner.addStep(`^Restore template \[([^"]*)\] for \[([^"]*)\]`, step.restoreTemplate)
runner.addStep(`^Create storageclass with name \[([^"]*)\] and template \[([^"]*)\] for \[([^"]*)\]`, step.setUpStorageClass)
runner.addStep(`^Create \[([^"]*)\] prerequisites from CR \[(\d+)\]$`, step.createPrereqs)
runner.addStep(`^Set up ephemeral volume properties \[([^"]*)\] for \[([^"]*)\]`, step.setupEphemeralVolumeProperties)

// Configure authorization-proxy-server for [powerflex]
runner.addStep(`^Configure authorization-proxy-server for \[([^"]*)\] for CR \[(\d+)\]$`, step.configureAuthorizationProxyServer)
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/testfiles/powerflex-templates/ephemeral.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
volumeName=REPLACE_VOLUME
size=8Gi
storagepool=REPLACE_POOL
systemID=REPLACE_SYSTEMID
6 changes: 6 additions & 0 deletions tests/e2e/testfiles/powerscale-templates/ephemeral.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
size=8Gi
ClusterName=REPLACE_CLUSTERNAME
AccessZone=system
IsiPath=/ifs/data/csi
IsiVolumePathPermissions=0777
AzServiceIP=REPLACE_ENDPOINT
2 changes: 2 additions & 0 deletions tests/e2e/testfiles/powerstore-templates/ephemeral.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
size=8Gi
arrayID=REPLACE_GLOBALID
Loading

0 comments on commit 1a1ebd2

Please sign in to comment.