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

Adding E2E tests for Powermax Authorization 2.0 #701

Merged
merged 8 commits into from
Sep 27, 2024
6 changes: 6 additions & 0 deletions tests/e2e/array-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ export PMAX_PASS_ENCODED="password"
export PMAX_SERVICE_LEVEL="Bronze"
# The following are Authorization Proxy Server specific for powermax:
export PMAX_POOL_V1="SRP_1"
export PMAX_POOL_V2="SRP_1"
export PMAX_STORAGE="powermax"
export PMAX_VAULT_STORAGE_PATH="storage\/powermax" # escape / with \
export PMAX_QUOTA="0GB"
export PMAX_ROLE="csmrole-powermax"
export PMAX_TENANT="csmtenant-powermax"
export PMAX_TENANT_PREFIX="tn1"
export PMAX_PORTGROUPS=""
export PMAX_PROTOCOL=""
export PMAX_ARRAYS="000000000000,000000000001"


# The following is PowerStore specific:
export PSTORE_USER="username"
Expand Down
25 changes: 17 additions & 8 deletions tests/e2e/steps/steps_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ var (
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"}

// Auth V2
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", "REPLACE_PORT": "PSCALE_PORT"}
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"}
Expand Down Expand Up @@ -832,6 +832,8 @@ func determineMap(crType string) (map[string]string, error) {
mapValues = pmaxCredMap
} else if crType == "pmaxReverseProxy" {
mapValues = pmaxReverseProxyMap
} else if crType == "pmaxArrayConfig" {
mapValues = pmaxArrayConfigMap
} else if crType == "authSidecarCert" {
mapValues = authSidecarRootCertMap
} else if crType == "application-mobility" {
Expand All @@ -840,6 +842,8 @@ func determineMap(crType string) (map[string]string, error) {
mapValues = pflexCrMap
} else if crType == "pscaleAuthCRs" {
mapValues = pscaleCrMap
} else if crType == "pmaxAuthCRs" {
mapValues = pmaxCrMap
} else if crType == "pstore" {
mapValues = pstoreSecretMap
} else if crType == "unity" {
Expand Down Expand Up @@ -1483,10 +1487,13 @@ func (step *Step) AuthorizationV2Resources(storageType, driver, driverNamespace,

if driver == "powerflex" {
crMap = "pflexAuthCRs"
updatedTemplateFile = "testfiles/authorization-templates/csm-authorization-crs-powerflex.yaml"
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powerflex.yaml"
} else if driver == "powerscale" {
crMap = "pscaleAuthCRs"
updatedTemplateFile = "testfiles/authorization-templates/csm-authorization-crs-powerscale.yaml"
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powerscale.yaml"
} else if driver == "powermax" {
crMap = "pmaxAuthCRs"
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powermax.yaml"
}

copyFile := exec.Command("cp", templateFile, updatedTemplateFile)
Expand Down Expand Up @@ -1858,9 +1865,11 @@ func (step *Step) validateCustomResourceDefinition(res Resource, crdName string)
func (step *Step) deleteAuthorizationCRs(_ Resource, driver string) error {
updatedTemplateFile := ""
if driver == "powerflex" {
updatedTemplateFile = "testfiles/authorization-templates/csm-authorization-crs-powerflex.yaml"
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powerflex.yaml"
} else if driver == "powerscale" {
updatedTemplateFile = "testfiles/authorization-templates/csm-authorization-crs-powerscale.yaml"
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powerscale.yaml"
} else if driver == "powermax" {
updatedTemplateFile = "testfiles/authorization-templates/storage_csm_authorization_crs_powermax.yaml"
}

cmd := exec.Command("kubectl", "delete", "-f", updatedTemplateFile)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright © 2024 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To create this configmap use: kubectl create -f powermax-array-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: powermax-array-config
namespace: powermax
data:
powermax-array-config.yaml: |
X_CSI_POWERMAX_PORTGROUPS: "REPLACE_PORTGROUPS"
X_CSI_TRANSPORT_PROTOCOL: "REPLACE_PROTOCOL"
X_CSI_POWERMAX_ENDPOINT: "https://REPLACE_AUTH_ENDPOINT:9400"
X_CSI_MANAGED_ARRAYS: "REPLACE_ARRAYS"
128 changes: 116 additions & 12 deletions tests/e2e/testfiles/scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1665,47 +1665,52 @@
name: verify app-mobility
run:
- /bin/bash verify-app-mobility.sh

- scenario: "Install PowerMax Driver(Standalone)"
paths:
- "testfiles/storage_csm_powermax.yaml"
tags:
- "powermax"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [powermax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Run custom test"
# Last two steps perform Clean Up
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
customTest:
name: Cert CSI
run:
- cert-csi test vio --sc powermax --chainNumber 2 --chainLength 2
- cert-csi test vio --sc op-e2e-pmax --chainNumber 2 --chainLength 2

- scenario: "Install PowerMax Driver(Sidecar)"
paths:
- "testfiles/storage_csm_powermax_sidecar.yaml"
tags:
- "powermax"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [powermax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up secret with template [testfiles/powermax-templates/powermax-secret-template.yaml] name [powermax-creds] in namespace [powermax] for [pmax]"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Run custom test"
# Last two steps perform Clean Up
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
customTest:
name: Cert CSI
run:
- cert-csi test vio --sc powermax --chainNumber 2 --chainLength 2
- cert-csi test vio --sc op-e2e-pmax --chainNumber 2 --chainLength 2

- scenario: "Install PowerMax Driver(With Observability)"
paths:
- "testfiles/storage_csm_powermax_observability.yaml"
Expand All @@ -1715,17 +1720,18 @@
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up secret with template [testfiles/powermax-templates/powermax-secret-template.yaml] name [powermax-creds] in namespace [powermax] for [pmax]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Validate [observability] module from CR [1] is installed"
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmax]"
- scenario: "Install PowerMax Driver (With Auth module)"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"

- scenario: "Install PowerMax Driver (With Authorization V1)"
paths:
- "testfiles/authorization-templates/storage_csm_authorization_proxy_server_n_minus_1.yaml"
- "testfiles/storage_csm_powermax_reverseproxy_authorization.yaml"
Expand Down Expand Up @@ -1759,6 +1765,95 @@
name: Cert CSI
run:
- cert-csi test vio --sc op-e2e-pmax --chainNumber 2 --chainLength 2

- scenario: "Install Powermax Driver (With Authorization v2)"
paths:
- "testfiles/authorization-templates/storage_csm_authorization_proxy_server.yaml"
- "testfiles/authorization-templates/storage_csm_authorization_crds.yaml"
- "testfiles/storage_csm_powermax_authorization.yaml"
tags:
- "authorizationproxyserver"
- "authorization"
- "powermax"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Install Authorization CRDs [2]"
- "Create [authorization-proxy-server] prerequisites from CR [1]"
- "Apply custom resource [1]"
- "Validate [authorization-proxy-server] module from CR [1] is installed"
- "Configure authorization-proxy-server for [powermax] for CR [1]"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up secret with template [testfiles/powermax-templates/csm-authorization-config.json] name [karavi-authorization-config] in namespace [powermax] for [pmaxAuthSidecar]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Set up creds with template [testfiles/powermax-templates/powermax-array-config.yaml] for [pmaxArrayConfig]"
- "Set up configMap with template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] name [powermax-reverseproxy-config] in namespace [powermax] for [pmaxReverseProxy]"
- "Apply custom resource [3]"
- "Validate custom resource [3]"
- "Validate [powermax] driver from CR [3] is installed"
- "Validate [authorization] module from CR [3] is installed"
- "Run custom test"
# cleanup
- "Enable forceRemoveDriver on CR [3]"
- "Delete custom resource [3]"
- "Delete Authorization CRs for [powermax]"
- "Delete custom resource [1]"
- "Delete Authorization CRDs [2]"
- "Restore template [testfiles/powermax-templates/csm-authorization-config.json] for [pmaxAuthSidecar]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Restore template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] for [pmaxReverseProxy]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-array-config.yaml] for [pmaxArrayConfig]"
customTest:
name: Cert CSI
run:
- cert-csi test vio --sc op-e2e-pmax --chainNumber 2 --chainLength 2

- scenario: "Install Powermax Driver (With Authorization v2 and Observability)"
paths:
- "testfiles/authorization-templates/storage_csm_authorization_proxy_server.yaml"
- "testfiles/authorization-templates/storage_csm_authorization_crds.yaml"
- "testfiles/storage_csm_powermax_observability_authorization.yaml"
tags:
- "authorizationproxyserver"
- "authorization"
- "powermax"
- "observability"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Install Authorization CRDs [2]"
- "Create [authorization-proxy-server] prerequisites from CR [1]"
- "Apply custom resource [1]"
- "Validate [authorization-proxy-server] module from CR [1] is installed"
- "Configure authorization-proxy-server for [powermax] for CR [1]"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up secret with template [testfiles/powermax-templates/csm-authorization-config.json] name [karavi-authorization-config] in namespace [powermax] for [pmaxAuthSidecar]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Set up creds with template [testfiles/powermax-templates/powermax-array-config.yaml] for [pmaxArrayConfig]"
- "Set up configMap with template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] name [powermax-reverseproxy-config] in namespace [powermax] for [pmaxReverseProxy]"
- "Restore template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] for [pmaxReverseProxy]"
- "Set up configMap with template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] name [powermax-reverseproxy-config] in namespace [karavi] for [pmaxReverseProxy]"
- "Apply custom resource [3]"
- "Validate custom resource [3]"
- "Validate [powermax] driver from CR [3] is installed"
- "Validate [authorization] module from CR [3] is installed"
- "Validate [observability] module from CR [3] is installed"
- "Run custom test"
# cleanup
- "Enable forceRemoveDriver on CR [3]"
- "Delete custom resource [3]"
- "Delete Authorization CRs for [powermax]"
- "Delete custom resource [1]"
- "Delete Authorization CRDs [2]"
- "Restore template [testfiles/powermax-templates/csm-authorization-config.json] for [pmaxAuthSidecar]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Restore template [testfiles/powermax-templates/powermax_reverse_proxy_config.yaml] for [pmaxReverseProxy]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-array-config.yaml] for [pmaxArrayConfig]"
customTest:
name: Cert CSI
run:
- cert-csi test vio --sc op-e2e-pmax --chainNumber 2 --chainLength 2

- scenario: "Install Powermax Driver(Standalone), Enable Resiliency"
paths:
- "testfiles/storage_csm_powermax.yaml"
Expand All @@ -1767,6 +1862,8 @@
- "resiliency"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
Expand All @@ -1777,6 +1874,9 @@
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"

- scenario: "Install Powermax Driver(With Resiliency), Disable Resiliency module"
paths:
- "testfiles/storage_csm_powermax_resiliency.yaml"
Expand All @@ -1785,6 +1885,8 @@
- "resiliency"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Create storageclass with name [op-e2e-pmax] and template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Set up creds with template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
Expand All @@ -1795,3 +1897,5 @@
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
- "Restore template [testfiles/powermax-templates/powermax-storageclass-template.yaml] for [pmax]"
- "Restore template [testfiles/powermax-templates/powermax-secret-template.yaml] for [pmaxCreds]"
Loading
Loading