From 7bcf4d73d01208bec25d45ea310c99d43902c9ac Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Mon, 21 Oct 2024 20:40:36 +0000 Subject: [PATCH] Adding openstackclient in kuttl --- .../openstackclient/kustomization.yaml | 13 +++++ .../openstackclient/openstackclient.yaml | 58 +++++++++++++++++++ .../common/assert_sample_deployment.yaml | 6 ++ .../octavia_scale/00-test-resources.yaml | 2 + 4 files changed, 79 insertions(+) create mode 100644 config/samples/openstackclient/kustomization.yaml create mode 100644 config/samples/openstackclient/openstackclient.yaml diff --git a/config/samples/openstackclient/kustomization.yaml b/config/samples/openstackclient/kustomization.yaml new file mode 100644 index 00000000..47281b90 --- /dev/null +++ b/config/samples/openstackclient/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ./openstackclient.yaml + +patches: +- patch: |- + - op: replace + path: /spec/containers/0/image + value: quay.io/podified-antelope-centos9/openstack-openstackclient:current-podified + target: + kind: Pod diff --git a/config/samples/openstackclient/openstackclient.yaml b/config/samples/openstackclient/openstackclient.yaml new file mode 100644 index 00000000..f3abe51f --- /dev/null +++ b/config/samples/openstackclient/openstackclient.yaml @@ -0,0 +1,58 @@ +# This pod assumes at least mariadb && keystone are running in the ctlplane +# and the associated openstack secrets (osp-secret and openstack-config) have +# been created, as well as the configmap where clouds.yaml is stored. +# It gets a cli that can be used to interact with the deployed components. +apiVersion: v1 +kind: Pod +metadata: + annotations: + openshift.io/scc: anyuid + labels: + app: openstackclient + name: openstackclient +spec: + containers: + - args: + - --single-child + - -- + - /bin/bash + - -c + - /bin/sleep infinity + command: + - /bin/dumb-init + env: + - name: OS_CLOUD + value: default + imagePullPolicy: IfNotPresent + name: openstackclient + resources: {} + securityContext: + capabilities: + drop: + - ALL + runAsGroup: 42401 + runAsNonRoot: true + runAsUser: 42401 + allowPrivilegeEscalation: false + seccompProfile: + type: RuntimeDefault + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/openstack/clouds.yaml + name: openstack-config + subPath: clouds.yaml + - mountPath: /etc/openstack/secure.yaml + name: openstack-config-secret + subPath: secure.yaml + dnsPolicy: ClusterFirst + enableServiceLinks: true + volumes: + - configMap: + defaultMode: 420 + name: openstack-config + name: openstack-config + - name: openstack-config-secret + secret: + defaultMode: 420 + secretName: openstack-config-secret diff --git a/tests/kuttl/common/assert_sample_deployment.yaml b/tests/kuttl/common/assert_sample_deployment.yaml index 8ac52c8a..5b80c949 100644 --- a/tests/kuttl/common/assert_sample_deployment.yaml +++ b/tests/kuttl/common/assert_sample_deployment.yaml @@ -361,3 +361,9 @@ commands: exit 1 fi exit 0 + - script: | + n_images=$(oc exec -n $NAMESPACE openstackclient -- openstack image list -f value --tag amphora-image | wc -l) + if [ "$n_images" != "0" ]; then + exit 0 + fi + exit 1 diff --git a/tests/kuttl/tests/octavia_scale/00-test-resources.yaml b/tests/kuttl/tests/octavia_scale/00-test-resources.yaml index 1f512b0f..2eaed878 100644 --- a/tests/kuttl/tests/octavia_scale/00-test-resources.yaml +++ b/tests/kuttl/tests/octavia_scale/00-test-resources.yaml @@ -17,3 +17,5 @@ commands: default: replicas: 1 ' + - script: | + oc kustomize ../../../../config/samples/openstackclient | oc apply -n $NAMESPACE -f -