From fa1eb6e772a1ea2e97a639a4b7a5daa71f823a29 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Mon, 21 Oct 2024 12:42:25 +0000 Subject: [PATCH 1/2] Enable glance in kuttl tests --- config/samples/octavia_v1beta1_octavia.yaml | 1 + .../common/assert_sample_deployment.yaml | 95 +++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/config/samples/octavia_v1beta1_octavia.yaml b/config/samples/octavia_v1beta1_octavia.yaml index 4680e6eb..6d10872f 100644 --- a/config/samples/octavia_v1beta1_octavia.yaml +++ b/config/samples/octavia_v1beta1_octavia.yaml @@ -3,6 +3,7 @@ kind: Octavia metadata: name: octavia spec: + amphoraImageContainerImage: quay.io/gthiemonge/octavia-amphora-image databaseInstance: openstack databaseAccount: octavia persistenceDatabaseAccount: octavia-persistence diff --git a/tests/kuttl/common/assert_sample_deployment.yaml b/tests/kuttl/common/assert_sample_deployment.yaml index d7001f6d..41e94ac5 100644 --- a/tests/kuttl/common/assert_sample_deployment.yaml +++ b/tests/kuttl/common/assert_sample_deployment.yaml @@ -74,6 +74,101 @@ spec: service: OctaviaPassword secret: osp-secret serviceUser: octavia +status: + apireadyCount: 1 + healthmanagerreadyCount: 1 + housekeepingreadyCount: 1 + rsyslogreadyCount: 1 + databaseHostname: openstack.octavia-kuttl-tests.svc + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: Create service completed + reason: Ready + status: "True" + type: CreateServiceReady + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: Setup complete + reason: Ready + status: "True" + type: OctaviaAPIReady + - message: Octavia Amphora certificates setup completed + reason: Ready + status: "True" + type: OctaviaAmphoraCertsReady + - message: Octavia Amphora Images setup completed + reason: Ready + status: "True" + type: OctaviaAmphoraImagesReady + - message: Octavia Amphora SSH setup completed + reason: Ready + status: "True" + type: OctaviaAmphoraSSHReady + - message: Setup complete + reason: Ready + status: "True" + type: OctaviaHealthManagerReady + - message: Setup complete + reason: Ready + status: "True" + type: OctaviaHousekeepingReady + - message: Octavia Management Network setup completed + reason: Ready + status: "True" + type: OctaviaManagementNetworkReady + - message: Octavia quotas setup completed + reason: Ready + status: "True" + type: OctaviaQuotasReady + - message: Setup complete + reason: Ready + status: "True" + type: OctaviaRsyslogReady + - message: Setup complete + reason: Ready + status: "True" + type: OctaviaWorkerReady + - message: RabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: RabbitMqTransportURLReady + - message: RoleBinding created + reason: Ready + status: "True" + type: RoleBindingReady + - message: Role created + reason: Ready + status: "True" + type: RoleReady + - message: ServiceAccount created + reason: Ready + status: "True" + type: ServiceAccountReady + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady --- apiVersion: apps/v1 kind: Deployment From 0607fb029249f70e54e9e2d68933b60d924e2951 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Mon, 21 Oct 2024 20:40:36 +0000 Subject: [PATCH 2/2] 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 41e94ac5..bd5eee52 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 a2932aa7..c3a27be9 100644 --- a/tests/kuttl/tests/octavia_scale/00-test-resources.yaml +++ b/tests/kuttl/tests/octavia_scale/00-test-resources.yaml @@ -10,3 +10,5 @@ commands: availability-zones: - zone-1 ' + - script: | + oc kustomize ../../../../config/samples/openstackclient | oc apply -n $NAMESPACE -f -