From 1766b3a71b4b351c80a11f25ace95a2a285c6eb4 Mon Sep 17 00:00:00 2001 From: Brendan Shephard Date: Tue, 13 Aug 2024 13:06:53 +1000 Subject: [PATCH] Allow for Jobs instead of AnsibleEE CR in kuttl Signed-off-by: Brendan Shephard --- ...tackdataplanedeployment_controller_test.go | 6 +- .../01-assert.yaml | 4 +- .../02-assert.yaml | 6 -- .../02-assert.yaml | 68 ++++++++++++------- .../dataplane-service-failure/00-assert.yaml | 22 +++--- 5 files changed, 56 insertions(+), 50 deletions(-) diff --git a/tests/functional/dataplane/openstackdataplanedeployment_controller_test.go b/tests/functional/dataplane/openstackdataplanedeployment_controller_test.go index bfec131e2..499c8ba97 100644 --- a/tests/functional/dataplane/openstackdataplanedeployment_controller_test.go +++ b/tests/functional/dataplane/openstackdataplanedeployment_controller_test.go @@ -1217,7 +1217,7 @@ var _ = Describe("Dataplane Deployment Test", func() { Namespace: dataplaneMultiNodesetDeploymentName.Namespace, } ansibleEE := GetAnsibleee(ansibleeeName) - ansibleEE.Status.JobStatus = ansibleeev1.JobStatusSucceeded + ansibleEE.Status.Succeeded = 1 g.Expect(th.K8sClient.Status().Update(th.Ctx, ansibleEE)).To(Succeed()) }, th.Timeout, th.Interval).Should(Succeed()) } @@ -1424,7 +1424,7 @@ var _ = Describe("Dataplane Deployment Test", func() { Namespace: dataplaneMultiNodesetDeploymentName.Namespace, } ansibleEE := GetAnsibleee(ansibleeeName) - ansibleEE.Status.JobStatus = ansibleeev1.JobStatusSucceeded + ansibleEE.Status.Succeeded = 1 g.Expect(th.K8sClient.Status().Update(th.Ctx, ansibleEE)).To(Succeed()) }, th.Timeout, th.Interval).Should(Succeed()) } @@ -1449,7 +1449,7 @@ var _ = Describe("Dataplane Deployment Test", func() { Namespace: dataplaneMultiNodesetDeploymentName.Namespace, } ansibleEE := GetAnsibleee(ansibleeeName) - ansibleEE.Status.JobStatus = ansibleeev1.JobStatusSucceeded + ansibleEE.Status.Succeeded = 1 g.Expect(th.K8sClient.Status().Update(th.Ctx, ansibleEE)).To(Succeed()) }, th.Timeout, th.Interval).Should(Succeed()) } diff --git a/tests/kuttl/tests/dataplane-deploy-global-service-test/01-assert.yaml b/tests/kuttl/tests/dataplane-deploy-global-service-test/01-assert.yaml index 584d5018d..7714ebbf3 100644 --- a/tests/kuttl/tests/dataplane-deploy-global-service-test/01-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-global-service-test/01-assert.yaml @@ -149,7 +149,7 @@ spec: volumeMounts: - mountPath: /runner/env/ssh_key/ssh_key_edpm-compute-global name: ssh-key-edpm-compute-global - subPath: ssh_key_edpm-compute-global + subPath: ssh_key_edpm-compute-global - mountPath: /runner/inventory/inventory-0 name: inventory-0 subPath: inventory-0 @@ -157,7 +157,7 @@ spec: schedulerName: default-scheduler securityContext: {} serviceAccount: edpm-compute-global - serviceAccountName: edpm-compute-global + serviceAccountName: edpm-compute-global terminationGracePeriodSeconds: 30 volumes: - name: ssh-key-edpm-compute-global diff --git a/tests/kuttl/tests/dataplane-deploy-global-service-test/02-assert.yaml b/tests/kuttl/tests/dataplane-deploy-global-service-test/02-assert.yaml index 444501871..90a7a8440 100644 --- a/tests/kuttl/tests/dataplane-deploy-global-service-test/02-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-global-service-test/02-assert.yaml @@ -102,8 +102,6 @@ spec: suspend: false template: metadata: - annotations: - k8s.v1.cni.cncf.io/networks: '[]' creationTimestamp: null labels: app: openstackansibleee @@ -151,7 +149,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - dnsPolicy: ClusterFirst restartPolicy: OnFailure schedulerName: default-scheduler securityContext: {} @@ -211,8 +208,6 @@ spec: suspend: false template: metadata: - annotations: - k8s.v1.cni.cncf.io/networks: '[]' creationTimestamp: null labels: app: openstackansibleee @@ -260,7 +255,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - dnsPolicy: ClusterFirst restartPolicy: OnFailure schedulerName: default-scheduler securityContext: {} diff --git a/tests/kuttl/tests/dataplane-deploy-multiple-secrets/02-assert.yaml b/tests/kuttl/tests/dataplane-deploy-multiple-secrets/02-assert.yaml index 520085517..9c09dade7 100644 --- a/tests/kuttl/tests/dataplane-deploy-multiple-secrets/02-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-multiple-secrets/02-assert.yaml @@ -169,8 +169,8 @@ spec: - name: RUNNER_EXTRA_VARS value: |2+ - edpm_override_hosts: all - edpm_service_type: custom-global-service + edpm_override_hosts: openstack-edpm-tls + edpm_service_type: install-certs-ovr imagePullPolicy: Always @@ -179,27 +179,45 @@ spec: terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - - mountPath: /runner/env/ssh_key/ssh_key_openstack-edpm-tls - name: ssh-key-openstack-edpm-tls - subPath: ssh_key_openstack-edpm-tls - - mountPath: /runner/inventory/inventory + - mountPath: /var/lib/openstack/certs/generic-service1/default + name: openstack-edpm-tls-generic-service1-default-certs-0 + - mountPath: /var/lib/openstack/cacerts/generic-service1 + name: generic-service1-combined-ca-bundle + - mountPath: /runner/env/ssh_key + name: ssh-key + subPath: ssh_key + - mountPath: /runner/inventory/hosts name: inventory subPath: inventory restartPolicy: OnFailure schedulerName: default-scheduler securityContext: {} serviceAccount: openstack-edpm-tls - serviceAccountName: openstack-edpm-tls + serviceAccountName: openstack-edpm-tls terminationGracePeriodSeconds: 30 volumes: - - name: ssh-key-openstack-edpm-tls + - name: openstack-edpm-tls-generic-service1-default-certs-0 + projected: + defaultMode: 420 + sources: + - secret: + name: openstack-edpm-tls-generic-service1-default-certs-0 + - secret: + name: openstack-edpm-tls-generic-service1-default-certs-1 + - secret: + name: openstack-edpm-tls-generic-service1-default-certs-2 + - name: generic-service1-combined-ca-bundle + secret: + defaultMode: 420 + secretName: combined-ca-bundle + - name: ssh-key secret: defaultMode: 420 items: - key: ssh-privatekey - path: ssh_key_openstack-edpm-tls + path: ssh_key secretName: dataplane-ansible-ssh-private-key-secret - - name: inventory-0 + - name: inventory secret: defaultMode: 420 items: @@ -219,12 +237,11 @@ metadata: generation: 1 labels: app: openstackansibleee - batch.kubernetes.io/job-name: generic-service1-openstack-edpm-tls-openstack-edpm-tls job-name: generic-service1-openstack-edpm-tls-openstack-edpm-tls openstackansibleee_cr: generic-service1-openstack-edpm-tls-openstack-edpm-tls openstackdataplanedeployment: openstack-edpm-tls openstackdataplanenodeset: openstack-edpm-tls - openstackdataplaneservice: generic-service1-openstack-edpm-tls + openstackdataplaneservice: generic-service1 osaee: "true" name: generic-service1-openstack-edpm-tls-openstack-edpm-tls namespace: openstack-kuttl-tests @@ -246,12 +263,11 @@ spec: metadata: labels: app: openstackansibleee - batch.kubernetes.io/job-name: generic-service1-openstack-edpm-tls-openstack-edpm-tls job-name: generic-service1-openstack-edpm-tls-openstack-edpm-tls openstackansibleee_cr: generic-service1-openstack-edpm-tls-openstack-edpm-tls openstackdataplanedeployment: openstack-edpm-tls openstackdataplanenodeset: openstack-edpm-tls - openstackdataplaneservice: generic-service1-openstack-edpm-tls + openstackdataplaneservice: generic-service1 osaee: "true" spec: containers: @@ -271,7 +287,7 @@ spec: - hosts: localhost gather_facts: no - name: global kuttl play + name: kuttl play tasks: - name: Sleep command: sleep 1 @@ -281,37 +297,37 @@ spec: - name: RUNNER_EXTRA_VARS value: |2+ - edpm_override_hosts: all - edpm_service_type: custom-global-service + edpm_override_hosts: openstack-edpm-tls + edpm_service_type: generic-service1 imagePullPolicy: Always - name: custom-global-service-openstack-edpm-tls + name: generic-service1-openstack-edpm-tls-openstack-edpm-tls resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - - mountPath: /runner/env/ssh_key/ssh_key_openstack-edpm-tls - name: ssh-key-openstack-edpm-tls - subPath: ssh_key_openstack-edpm-tls - - mountPath: /runner/inventory/inventory + - mountPath: /runner/env/ssh_key + name: ssh-key + subPath: ssh_key + - mountPath: /runner/inventory/hosts name: inventory subPath: inventory restartPolicy: OnFailure schedulerName: default-scheduler securityContext: {} serviceAccount: openstack-edpm-tls - serviceAccountName: openstack-edpm-tls + serviceAccountName: openstack-edpm-tls terminationGracePeriodSeconds: 30 volumes: - - name: ssh-key-openstack-edpm-tls + - name: ssh-key secret: defaultMode: 420 items: - key: ssh-privatekey - path: ssh_key_openstack-edpm-tls + path: ssh_key secretName: dataplane-ansible-ssh-private-key-secret - - name: inventory-0 + - name: inventory secret: defaultMode: 420 items: diff --git a/tests/kuttl/tests/dataplane-service-failure/00-assert.yaml b/tests/kuttl/tests/dataplane-service-failure/00-assert.yaml index bebaf7643..a07dc6272 100644 --- a/tests/kuttl/tests/dataplane-service-failure/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-service-failure/00-assert.yaml @@ -80,7 +80,6 @@ spec: edpm_service_type: failed-service - image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest imagePullPolicy: Always name: failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes resources: {} @@ -116,10 +115,7 @@ spec: path: inventory secretName: dataplanenodeset-edpm-compute-no-nodes status: - active: 1 - ready: 0 - terminating: 0 - uncountedTerminatedPods: {} + failed: 1 --- apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneNodeSet @@ -140,14 +136,14 @@ status: conditions: - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: Error severity: Error status: "False" type: Ready - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: Error severity: Error status: "False" @@ -176,14 +172,14 @@ status: edpm-compute-no-nodes: - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False" type: NodeSetDeploymentReady - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False" @@ -205,14 +201,14 @@ status: conditions: - message: 'Deployment error occurred nodeSet: edpm-compute-no-nodes error: backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False" type: Ready - message: 'Deployment error occurred nodeSet: edpm-compute-no-nodes error: backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False" @@ -225,14 +221,14 @@ status: edpm-compute-no-nodes: - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False" type: NodeSetDeploymentReady - message: 'Deployment error occurred in failed-service service error backoff limit reached for execution.name failed-service-edpm-compute-no-nodes-edpm-compute-no-nodes - execution.namespace openstack-kuttl-tests execution.status.jobstatus: Failed' + execution.namespace openstack-kuttl-tests execution.condition.message: Job has reached the specified backoff limit' reason: BackoffLimitExceeded severity: Error status: "False"