From 920de18bc5fc78e693ede5ad6bee692dd7768328 Mon Sep 17 00:00:00 2001 From: Christian Coffield Date: Tue, 23 Jul 2024 14:51:06 -0400 Subject: [PATCH] Bug 1389 cert persister 017 (#646) * Update cert-persister and install scripts. * Some updates to the e2e tests. * update env to apex-client type * Fix e2e tests --------- Co-authored-by: nitesh3108 --- samples/connectivity_client_v110.yaml | 4 ++-- scripts/install_connectivity_client.sh | 6 +++--- scripts/uninstall_connectivity_client.sh | 8 ++++---- tests/e2e/e2e_test.go | 2 +- tests/e2e/run-e2e-test.sh | 3 +++ tests/e2e/steps/steps_def.go | 7 ++++--- tests/e2e/steps/steps_runner.go | 2 +- tests/e2e/testfiles/connectivity-values.yaml | 20 +++++++++++-------- tests/e2e/testfiles/connectivity_client.yaml | 5 ++--- .../e2e/testfiles/connectivity_client_1.yaml | 7 +++---- .../testfiles/connectivity_client_secret.yaml | 18 ----------------- 11 files changed, 35 insertions(+), 47 deletions(-) diff --git a/samples/connectivity_client_v110.yaml b/samples/connectivity_client_v110.yaml index 5c4fc0730..6044d81c5 100644 --- a/samples/connectivity_client_v110.yaml +++ b/samples/connectivity_client_v110.yaml @@ -22,5 +22,5 @@ spec: image: bitnami/kubectl:1.29 imagePullPolicy: IfNotPresent - name: cert-persister - image: dellemc/connectivity-cert-persister-k8s:0.11.0 - imagePullPolicy: IfNotPresent \ No newline at end of file + image: dellemc/connectivity-cert-persister-k8s:0.17.0 + imagePullPolicy: IfNotPresent diff --git a/scripts/install_connectivity_client.sh b/scripts/install_connectivity_client.sh index 42ff4aede..6eea45523 100644 --- a/scripts/install_connectivity_client.sh +++ b/scripts/install_connectivity_client.sh @@ -14,9 +14,9 @@ if [[ $# -ne 1 ]]; then echo "Incorrect input parameters provided to script $0." - echo "Script Usage:" + echo "Script usage:" echo "$0 " - echo "Example:- connectivityclient-version => v100 , v110" + echo "Example: $0 v110" exit 1 fi @@ -60,7 +60,7 @@ if [[ $(echo "$secret_check" | wc -l) -gt 1 ]]; then echo "Dell Connectivity Client ${connectivity_ver} installed." else echo "No secrets found" + $CMD apply -f $ROOTDIR/samples/connectivity_client_secret.yaml $CMD apply -f $ROOTDIR/samples/connectivity_client_${connectivity_ver}.yaml - $CMD apply -f $ROOTDIR/samples/conn_secret_test.yaml echo "Dell Connectivity Client ${connectivity_ver} installed." fi diff --git a/scripts/uninstall_connectivity_client.sh b/scripts/uninstall_connectivity_client.sh index 9388556e7..3c385e163 100644 --- a/scripts/uninstall_connectivity_client.sh +++ b/scripts/uninstall_connectivity_client.sh @@ -14,9 +14,9 @@ if [[ $# -ne 1 ]]; then echo "Incorrect input parameters provided to script $0." - echo "Script Usage:" + echo "Script usage:" echo "$0 " - echo "Example:- connectivityclient-version => v100 , v110" + echo "Example: $0 v110" exit 1 fi @@ -40,7 +40,7 @@ if [ -z "$CMD" ]; then exit 1 fi -$CMD apply -f $ROOTDIR/samples/connectivity_client_${connectivity_ver}.yaml -$CMD apply -f $ROOTDIR/samples/conn_secret_test.yaml +$CMD delete -f $ROOTDIR/samples/connectivity_client_${connectivity_ver}.yaml +$CMD delete -f $ROOTDIR/samples/connectivity_client_secret.yaml echo "Dell Connectivity Client ${connectivity_ver} uninstalled." diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index cb665d05e..de8364078 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -79,7 +79,7 @@ func TestE2E(t *testing.T) { } var _ = BeforeSuite(func() { - tagEnvVars := []string{"AUTHORIZATION", "REPLICATION", "OBSERVABILITY", "AUTHORIZATIONPROXYSERVER", "RESILIENCY", "APPLICATIONMOBILITY", "POWERFLEX", "POWERSCALE", "POWERMAX", "POWERSTORE", "UNITY", "SANITY"} + tagEnvVars := []string{"AUTHORIZATION", "REPLICATION", "OBSERVABILITY", "AUTHORIZATIONPROXYSERVER", "RESILIENCY", "APPLICATIONMOBILITY", "POWERFLEX", "POWERSCALE", "POWERMAX", "POWERSTORE", "UNITY", "SANITY", "CLIENT"} By("Getting test environment variables") valuesFile := os.Getenv(valuesFileEnvVar) Expect(valuesFile).NotTo(BeEmpty(), "Missing environment variable required for tests. E2E_SCENARIOS_FILE must be set.") diff --git a/tests/e2e/run-e2e-test.sh b/tests/e2e/run-e2e-test.sh index bf4648e85..3b531fe90 100755 --- a/tests/e2e/run-e2e-test.sh +++ b/tests/e2e/run-e2e-test.sh @@ -154,6 +154,7 @@ function usage() { echo " --pstore use to run e2e powerstore suite" echo " --unity use to run e2e unity suite" echo " --pmax use to run e2e powermax suite" + echo " --client use to run e2e connectivity client suite" echo exit 0 @@ -190,6 +191,8 @@ while getopts ":h-:" optchar; do export UNITY=true ;; pmax) export POWERMAX=true ;; + client) + export CLIENT=true ;; cert-csi) CERT_CSI="${!OPTIND}" OPTIND=$((OPTIND + 1)) diff --git a/tests/e2e/steps/steps_def.go b/tests/e2e/steps/steps_def.go index 9a5b4b9ce..f41887527 100644 --- a/tests/e2e/steps/steps_def.go +++ b/tests/e2e/steps/steps_def.go @@ -1676,12 +1676,13 @@ func (step *Step) applyClientCustomResource(res ResourceApex, crNumStr string, s return fmt.Errorf("failed to read secret testdata: %v", err) } - if _, err := kubectl.RunKubectlInput(cr.Namespace, string(crBuff), "apply", "--validate=true", "-f", "-"); err != nil { - return fmt.Errorf("failed to apply connecivity client CR %s in namespace %s: %v", cr.Name, cr.Namespace, err) - } if _, err := kubectl.RunKubectlInput(scr.Namespace, string(scrBuff), "apply", "--validate=true", "-f", "-"); err != nil { return fmt.Errorf("failed to apply secret CR %s in namespace %s: %v", scr.Name, scr.Namespace, err) } + if _, err := kubectl.RunKubectlInput(scr.Namespace, string(crBuff), "apply", "--validate=true", "-f", "-"); err != nil { + return fmt.Errorf("failed to apply connecivity client CR %s in namespace %s: %v", cr.Name, cr.Namespace, err) + } + return nil } diff --git a/tests/e2e/steps/steps_runner.go b/tests/e2e/steps/steps_runner.go index 3025afcc1..47514b04d 100644 --- a/tests/e2e/steps/steps_runner.go +++ b/tests/e2e/steps/steps_runner.go @@ -83,7 +83,7 @@ func StepRunnerInit(runner *Runner, ctrlClient client.Client, clientSet *kuberne runner.addStep(`^Set up application mobility CR \[([^"]*)\]$`, step.configureAMInstall) // Connectivity Client steps - runner.addStep(`^Given an client environment with k8s or openshift, and CSM operator installed$`, step.validateClientTestEnvironment) + runner.addStep(`^Given a client environment with k8s or openshift, and CSM operator installed$`, step.validateClientTestEnvironment) runner.addStep(`^Install connectivity client from CR \[(\d+)\] and create secret \[(\d+)\]$`, step.applyClientCustomResource) runner.addStep(`^Validate connectivity client from CR \[(\d+)\] is installed$`, step.validateConnectivityClientInstalled) runner.addStep(`^Validate connectivity client from CR \[(\d+)\] is not installed$`, step.validateConnectivityClientNotInstalled) diff --git a/tests/e2e/testfiles/connectivity-values.yaml b/tests/e2e/testfiles/connectivity-values.yaml index eb9bff2c3..2932d933b 100644 --- a/tests/e2e/testfiles/connectivity-values.yaml +++ b/tests/e2e/testfiles/connectivity-values.yaml @@ -4,8 +4,9 @@ - "testfiles/connectivity_client_secret.yaml" tags: - "sanity" + - "client" steps: - - "Given an environment with k8s or openshift, and CSM operator installed" + - "Given a client environment with k8s or openshift, and CSM operator installed" - "Install connectivity client from CR [1] and create secret [2]" - "Validate connectivity client from CR [1] is installed" - "Uninstall connectivity client from CR [1]" @@ -19,8 +20,9 @@ - "testfiles/connectivity_client_secret.yaml" tags: - "sanity" + - "client" steps: - - "Given an client environment with k8s or openshift, and CSM operator installed" + - "Given a client environment with k8s or openshift, and CSM operator installed" - "Install connectivity client from CR [1] and create secret [3]" - "Validate connectivity client from CR [1] is installed" - "Upgrade client from custom resource [1] to [2]" @@ -30,13 +32,14 @@ - "Validate connectivity client from CR [2] is not installed" - scenario: "Validate role/rolebindings created for brownfield-onboard scenario" - paths: + paths: - "testfiles/connectivity_client.yaml" - "testfiles/storage_csm_powerflex.yaml" - tags: + tags: - "sanity" - steps: - - "Given an environment with k8s or openshift, and CSM operator installed" + - "client" + steps: + - "Given a client environment with k8s or openshift, and CSM operator installed" - "Set up secret with template [testfiles/powerflex-templates/powerflex-secret-template.yaml] name [test-vxflexos-config] in namespace [test-vxflexos] for [pflex]" - "Apply custom resource [2]" - "Validate custom resource [2]" @@ -51,15 +54,16 @@ - "Delete custom resource [2]" - "Restore template [testfiles/powerflex-templates/powerflex-secret-template.yaml] for [pflex]" - "Restore template [testfiles/powerflex-templates/powerflex-storageclass-template.yaml] for [pflex]" - + - scenario: "Validate rbac objects created for brownfield scenario when the client is running and CSM is created" paths: - "testfiles/connectivity_client.yaml" - "testfiles/storage_csm_powerflex.yaml" tags: - "sanity" + - "client" steps: - - "Given an environment with k8s or openshift, and CSM operator installed" + - "Given a client environment with k8s or openshift, and CSM operator installed" - "Install connectivity client from CR [1]" - "Validate connectivity client from CR [1] is installed" - "Set up secret with template [testfiles/powerflex-templates/powerflex-secret-template.yaml] name [test-vxflexos-config] in namespace [test-vxflexos] for [pflex]" diff --git a/tests/e2e/testfiles/connectivity_client.yaml b/tests/e2e/testfiles/connectivity_client.yaml index 6f7109357..05c521535 100644 --- a/tests/e2e/testfiles/connectivity_client.yaml +++ b/tests/e2e/testfiles/connectivity_client.yaml @@ -8,8 +8,7 @@ spec: csmClientType: "apexConnectivityClient" configVersion: v1.0.0 forceRemoveClient: true - connectionTarget: connect-p3.dell.com - usePrivateCaCerts: true + connectionTarget: connect-into.dell.com common: name: connectivity-client-docker-k8s image: dellemc/connectivity-client-docker-k8s:1.2.3 @@ -20,7 +19,7 @@ spec: imagePullPolicy: IfNotPresent sideCars: - name: kubernetes-proxy - image: bitnami/kubectl:latest + image: bitnami/kubectl:1.29 imagePullPolicy: IfNotPresent - name: cert-persister image: dellemc/connectivity-cert-persister-k8s:0.11.0 diff --git a/tests/e2e/testfiles/connectivity_client_1.yaml b/tests/e2e/testfiles/connectivity_client_1.yaml index 8b9733a0a..62c6c0463 100644 --- a/tests/e2e/testfiles/connectivity_client_1.yaml +++ b/tests/e2e/testfiles/connectivity_client_1.yaml @@ -8,8 +8,7 @@ spec: csmClientType: "apexConnectivityClient" configVersion: v1.1.0 forceRemoveClient: true - connectionTarget: connect-p3.dell.com - usePrivateCaCerts: true + connectionTarget: connect-into.dell.com common: name: connectivity-client-docker-k8s image: dellemc/connectivity-client-docker-k8s:1.19.0 @@ -23,5 +22,5 @@ spec: image: bitnami/kubectl:latest imagePullPolicy: IfNotPresent - name: cert-persister - image: dellemc/connectivity-cert-persister-k8s:0.11.0 - imagePullPolicy: IfNotPresent + image: dellemc/connectivity-cert-persister-k8s:0.17.0 + imagePullPolicy: Always diff --git a/tests/e2e/testfiles/connectivity_client_secret.yaml b/tests/e2e/testfiles/connectivity_client_secret.yaml index 201a014a8..783fad5de 100644 --- a/tests/e2e/testfiles/connectivity_client_secret.yaml +++ b/tests/e2e/testfiles/connectivity_client_secret.yaml @@ -1,23 +1,5 @@ apiVersion: v1 kind: Secret -metadata: - name: connectivity-client-docker-k8s-loadbalancer-ca-cert - namespace: dell-connectivity-client -type: Opaque -data: - loadbalancer_root_ca_cert.crt: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM5ekNDQWQrZ0F3SUJBZ0lKQU0xYThtb0UzaldhTUEwR0NTcUdTSWIzRFFFQkN3VUFNQkl4RURBT0JnTlYKQkFNTUIzUmxjM1F0WTJFd0hoY05Nak14TURBMU1EYzBOVE0yV2hjTk16TXhNREF5TURjME5UTTJXakFTTVJBdwpEZ1lEVlFRRERBZDBaWE4wTFdOaE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBCndXemtVNnZwOEZVK1ZKeFBSQk43andLclJ5WEozTHhWbGpkTDVkVUw1WnVMSitsZjhDUGlaTmNLSGs3YnlUTDIKdUNvV3NFU3NJY0xsV3NYR3pUTGEyTFl5VGN6YStSTHJyL2d0TFpZbldtNVpBOWdZT0FQSlkyWVlQVXMxWjZKYgorU3ZTZldtY0tsdmN4YUVXbVhELzhacm52ek9ITW9vY0F6TmFqSEZ3TnArcHVrU3RQQXJNY0F0cnFtWWR3TW5hCkcvMGJrTndBdkRiTW1Bc1VCTXJwYkxub2wvZWd6bkt4ZUtUMkNkejJuWEZiUE82SWRVSmZTU0hHRktxaWFwa1cKZ3lLdUNuMlJKd09CbHpvekRVUnJzVTg4bTdKRW8zS3BtTmtkZ3hYNzNackdJWUtPcmFlRVRmTUdBOEl0NEQ2UQo5cFlHWTQ5Mk5mM1JvV2dvelM3TzFRSURBUUFCbzFBd1RqQWRCZ05WSFE0RUZnUVV6bXFmVk0rYy82dlRiTDgwCndqTUJ2K3FwSHBNd0h3WURWUjBqQkJnd0ZvQVV6bXFmVk0rYy82dlRiTDgwd2pNQnYrcXBIcE13REFZRFZSMFQKQkFVd0F3RUIvekFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBVXNydDRCZk5iY2UwK3pjWm0raWJXcTlFRGZOaQozdlVONHEyYkZUNUV0bWkvbTZkbi9veHBwSGNyL3dWQ05Ka2pzSFZ2ZXhYMnVGU3VQeFBYUTN6aVFxbVpKK2NpCmJZR29lTDBTdmZQZEoyUllBeVhFRitjNVpNUGkvV2l2cHh0QWxjNlUwcHp4cUJpTElMOVBUM1lJa1hZSk81bncKNDYyY3ZLQnFjVTNlTkJpQXVGWkdYUVBYNVUwTmZSNEN3bzE0OFphNDhEclVzc1ArNjZhSVRteExXY1dzOVczWgpmSVNDbDJIMmxvTXg1RzU2My9TTWgzS0ZXL3JCTkgyUnpxUHNUWkhockd4OEVYYjVFdkpJT0M3bHpBb1A0eUs4CldBZUpXd3dTRldUVkM0Z2Z5bHR6RnFOSGlqNENITkVxRTBrbXprRDN4K3MxTnUxTWtESDF5SFhpcXc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==" ---- -apiVersion: v1 -kind: Secret -metadata: - name: connectivity-client-docker-k8s-aggregator-internal-ca-cert - namespace: dell-connectivity-client -type: Opaque -data: - aggregator_internal_root_ca_cert.crt: "LS0tLS1CRUdJTiBDRVJUSUZJQ0F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tCCjJiWGlpaDJYZERtSUlEbEx2dkNlMkRONytHSSt2WjFocXFOSTRUZFFuOS9XcUkwZDdiZVBId2RyRTl2WGUvcEsKSUUzcEk5eDA2SXJwV3pGRjJOcHQ5S1pLL1djeThPN3gyRGlGQWRpaE5tUUxMNHZUTUkvZW03VllFZ0hRSGRuZApXcnkySlFIcHBiVzcxN2VKUWJERDFTbnptemdCOWdUTXE2bDhObEE2NE5kYnFHaHNTMk91cFNoeHlFNHVtZ2poCk1NaElZaksvUmQ4eVllcnRBQVpoYUdoTzhIakpUYXJRak9TeUpHbHI0M1N3QWZVSXBwblJzVzMxSXc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==" ---- -apiVersion: v1 -kind: Secret metadata: name: connectivity-client-docker-k8s-cert namespace: dell-connectivity-client