diff --git a/Makefile b/Makefile index 1c1c4def..cd506273 100644 --- a/Makefile +++ b/Makefile @@ -364,3 +364,43 @@ scale-down-placement-controller-csv: if [ "$(has_webhooks)" != "null" ]; then \ oc patch csv -n $(OPERATOR_NAMESPACE) placement-operator.v0.0.1 --type json -p='[{"op": "remove", "path": "/spec/webhookdefinitions"}]'; \ fi + +KUTTL_SUITE ?= default +KUTTL_NAMESPACE ?= placement-kuttl-tests +KUTTL_SUITE_DIR ?= tests/kuttl/test-suites/$(KUTTL_SUITE) + +.PHONY: kuttl-test-prep +kuttl-test-prep: + oc apply -k $(KUTTL_SUITE_DIR)/deps/ --timeout=120s + oc wait -n $(KUTTL_NAMESPACE) openstackcontrolplane openstack --for condition=Ready --timeout=300s + +.PHONY: kuttl-test-run +kuttl-test-run: export NAMESPACE = $(KUTTL_NAMESPACE) +kuttl-test-run: + oc kuttl test --v 1 --start-kind=false --config $(KUTTL_SUITE_DIR)/config.yaml + +.PHONY: kuttl-test +kuttl-test: kuttl-test-prep kuttl-test-run + +.PHONY: kuttl-test-cleanup +kuttl-test-cleanup: + # only cleanup if the $(KUTTL_NAMESPACE) exists + $(eval namespace_exists=$(shell oc get namespace $(KUTTL_NAMESPACE) --ignore-not-found -o name)) + # We need to order the deletion. Simply deleting the namespace will + # result in errors in mariadb- and keystone-operator and then + # finalizer removal get stuck blocking the namespace deletion. + if [ "${namespace_exists}" != "" ]; then \ + if [ "$(KUTTL_SUITE)" == "autoscaling" ]; then \ + oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Autoscaling; \ + fi; \ + if [ "$(KUTTL_SUITE)" == "ceilometer" ]; then \ + oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Ceilometer; \ + fi; \ + if [ "$(KUTTL_SUITE)" == "default" ]; then \ + oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Telemetry; \ + fi; \ + oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s OpenStackControlPlane; \ + oc delete --wait=true namespace $(KUTTL_NAMESPACE); \ + else \ + echo "Namespce already cleaned up. Nothing to do"; \ + fi \ No newline at end of file diff --git a/renovate.json b/renovate.json index 000eea33..a6b0c154 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,6 @@ { "extends": [ - "github>openstack-k8s-operators/renovate-config" + "github>openstack-k8s-operators/renovate-config:default.json5" ], "constraints": { "go": "1.19" diff --git a/tests/kuttl/common/assert_sample_deployment.yaml b/tests/kuttl/common/assert_sample_deployment.yaml index 4dfd90ca..7a99c144 100644 --- a/tests/kuttl/common/assert_sample_deployment.yaml +++ b/tests/kuttl/common/assert_sample_deployment.yaml @@ -5,9 +5,6 @@ metadata: - PlacementAPI name: placement spec: - customServiceConfig: | - [DEFAULT] - debug = true databaseInstance: openstack databaseUser: placement debug: @@ -18,7 +15,7 @@ spec: service: PlacementPassword preserveJobs: false replicas: 1 - secret: osp-secret + secret: placement-secret serviceUser: placement status: databaseHostname: openstack @@ -188,12 +185,12 @@ spec: valueFrom: secretKeyRef: key: PlacementDatabasePassword - name: osp-secret + name: placement-secret - name: PlacementPassword valueFrom: secretKeyRef: key: PlacementPassword - name: osp-secret + name: placement-secret - name: DatabaseHost value: openstack - name: DatabaseName diff --git a/tests/kuttl/test-suites/default/config.yaml b/tests/kuttl/test-suites/default/config.yaml new file mode 100644 index 00000000..ccd47c38 --- /dev/null +++ b/tests/kuttl/test-suites/default/config.yaml @@ -0,0 +1,14 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +reportFormat: JSON +reportName: kuttl-test-placement +namespace: placement-kuttl-tests +# we could set this lower, but the initial image pull can take a while +timeout: 300 +parallel: 1 +skipDelete: true +testDirs: + - tests/kuttl/test-suites/default/ +suppress: + - events +artifactsDir: tests/kuttl/test-suites/default/output diff --git a/tests/kuttl/test-suites/default/deps/OpenStackControlPlane.yaml b/tests/kuttl/test-suites/default/deps/OpenStackControlPlane.yaml new file mode 100644 index 00000000..1d208a29 --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/OpenStackControlPlane.yaml @@ -0,0 +1,16 @@ +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + storageClass: "crc-csi-hostpath-provisioner" + ironic: + enabled: false + template: + ironicConductors: [] + manila: + enabled: false + template: + manilaShares: {} + horizon: + enabled: false diff --git a/tests/kuttl/test-suites/default/deps/infra.yaml b/tests/kuttl/test-suites/default/deps/infra.yaml new file mode 100644 index 00000000..1dd64e87 --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/infra.yaml @@ -0,0 +1,32 @@ +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + mariadb: + enabled: false + galera: + enabled: true + templates: + openstack: + storageRequest: 500M + openstack-cell1: + storageRequest: 500M + rabbitmq: + templates: + rabbitmq: + replicas: 1 + rabbitmq-cell1: + replicas: 1 + memcached: + templates: + memcached: + replicas: 1 + ovn: + enabled: false + template: + ovnController: + external-ids: + ovn-encap-type: geneve + ovs: + enabled: false diff --git a/tests/kuttl/test-suites/default/deps/keystone.yaml b/tests/kuttl/test-suites/default/deps/keystone.yaml new file mode 100644 index 00000000..e4a3c945 --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/keystone.yaml @@ -0,0 +1,9 @@ +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + keystone: + template: + databaseInstance: openstack + secret: placement-secret diff --git a/tests/kuttl/test-suites/default/deps/kustomization.yaml b/tests/kuttl/test-suites/default/deps/kustomization.yaml new file mode 100644 index 00000000..0714cacc --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/kustomization.yaml @@ -0,0 +1,42 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: placement-kuttl-tests + +secretGenerator: +- literals: + - AdminPassword=password + - DbRootPassword=password + - DatabasePassword=password + - KeystoneDatabasePassword=password + - PlacementPassword=password + - PlacementDatabasePassword=password + - GlancePassword=password + - GlanceDatabasePassword=password + - NeutronPassword=password + - NeutronDatabasePassword=password + - NovaPassword=password + - NovaAPIDatabasePassword=password + - NovaCell0DatabasePassword=password + - NovaCell1DatabasePassword=password + - MetadataSecret=42 + name: placement-secret +generatorOptions: + disableNameSuffixHash: true + labels: + type: placement-secret + +resources: +- namespace.yaml +- OpenStackControlPlane.yaml + +patches: +- patch: |- + apiVersion: core.openstack.org/v1beta1 + kind: OpenStackControlPlane + metadata: + name: openstack + spec: + secret: placement-secret +- path: infra.yaml +- path: keystone.yaml +- path: placement.yaml diff --git a/tests/kuttl/test-suites/default/deps/namespace.yaml b/tests/kuttl/test-suites/default/deps/namespace.yaml new file mode 100644 index 00000000..0c572311 --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placement-kuttl-tests diff --git a/tests/kuttl/test-suites/default/deps/placement.yaml b/tests/kuttl/test-suites/default/deps/placement.yaml new file mode 100644 index 00000000..9776469d --- /dev/null +++ b/tests/kuttl/test-suites/default/deps/placement.yaml @@ -0,0 +1,9 @@ +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + placement: + template: + databaseInstance: openstack + secret: placement-secret diff --git a/tests/kuttl/test-suites/default/output/.keep b/tests/kuttl/test-suites/default/output/.keep new file mode 100644 index 00000000..e69de29b diff --git a/tests/kuttl/test-suites/default/output/kuttl-default-results.json b/tests/kuttl/test-suites/default/output/kuttl-default-results.json new file mode 100644 index 00000000..b0d5f48e --- /dev/null +++ b/tests/kuttl/test-suites/default/output/kuttl-default-results.json @@ -0,0 +1,36 @@ +{ + "name": "", + "tests": 3, + "failures": 0, + "time": "214.322", + "testsuite": [ + { + "tests": 3, + "failures": 0, + "timestamp": "2023-08-04T11:39:21.251975663+02:00", + "time": "202.907", + "name": "test/kuttl/test-suites/default/", + "testcase": [ + { + "classname": "default", + "name": "deps", + "timestamp": "2023-08-04T11:39:21.252056484+02:00", + "time": "0.000" + }, + { + "classname": "default", + "name": "scale-tests", + "timestamp": "2023-08-04T11:39:21.257387947+02:00", + "time": "202.901", + "assertions": 69 + }, + { + "classname": "default", + "name": "output", + "timestamp": "2023-08-04T11:42:44.158903202+02:00", + "time": "0.000" + } + ] + } + ] + } diff --git a/tests/kuttl/test-suites/default/output/kuttl-test-placement.json b/tests/kuttl/test-suites/default/output/kuttl-test-placement.json new file mode 100644 index 00000000..086db3d9 --- /dev/null +++ b/tests/kuttl/test-suites/default/output/kuttl-test-placement.json @@ -0,0 +1,40 @@ +{ + "name": "", + "tests": 3, + "failures": 1, + "time": "334.084", + "testsuite": [ + { + "tests": 3, + "failures": 1, + "timestamp": "2024-01-05T16:01:14.739927108+01:00", + "time": "322.664", + "name": "tests/kuttl/test-suites/default/", + "testcase": [ + { + "classname": "default", + "name": "deps", + "timestamp": "2024-01-05T16:01:14.740035321+01:00", + "time": "0.000" + }, + { + "classname": "default", + "name": "scale-tests", + "timestamp": "2024-01-05T16:01:14.743540703+01:00", + "time": "322.661", + "assertions": 18, + "failure": { + "text": "resource Deployment:placement-kuttl-tests/placement: .spec.replicas: value mismatch, expected: 2 != actual: 1", + "message": "failed in step 3-scale-placementapi" + } + }, + { + "classname": "default", + "name": "output", + "timestamp": "2024-01-05T16:06:37.404168159+01:00", + "time": "0.000" + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/kuttl/test-suites/default/scale-tests/00-cleanup-placement.yaml b/tests/kuttl/test-suites/default/scale-tests/00-cleanup-placement.yaml new file mode 100644 index 00000000..764fa435 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/00-cleanup-placement.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: placement.openstack.org/v1beta1 + kind: PlacementAPI + name: placement-kuttl + namespace: placement-kuttl-tests diff --git a/tests/kuttl/test-suites/default/scale-tests/01-assert.yaml b/tests/kuttl/test-suites/default/scale-tests/01-assert.yaml new file mode 100644 index 00000000..de4ae604 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/01-assert.yaml @@ -0,0 +1,285 @@ +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + finalizers: + - PlacementAPI + name: placement + namespace: placement-kuttl-tests +spec: + databaseInstance: openstack + databaseUser: placement + debug: + dbSync: false + service: false + passwordSelectors: + database: PlacementDatabasePassword + service: PlacementPassword + preserveJobs: false + replicas: 1 + secret: placement-secret + serviceUser: placement +status: + databaseHostname: openstack + readyCount: 1 + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Deployment completed + reason: Ready + status: "True" + type: DeploymentReady + - message: Exposing service completed + reason: Ready + status: "True" + type: ExposeServiceReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneEndpointReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneServiceReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - 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 +metadata: + name: placement +spec: + replicas: 1 + template: + metadata: + labels: + service: placement + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: service + operator: In + values: + - placement + topologyKey: kubernetes.io/hostname + weight: 1 + containers: + - args: + - --single-child + - -- + - /usr/bin/tail + - -n+1 + - -F + - /var/log/placement/placement-api.log + command: + - /usr/bin/dumb-init + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 3 + successThreshold: 1 + timeoutSeconds: 5 + name: placement-log + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 5 + resources: {} + securityContext: + runAsUser: 42482 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /usr/local/bin/container-scripts + name: scripts + readOnly: true + - mountPath: /var/lib/config-data/merged + name: config-data-merged + - mountPath: /var/lib/kolla/config_files/config.json + name: config-data-merged + readOnly: true + subPath: placement-api-config.json + - mountPath: /var/log/placement + name: logs + - args: + - -c + - /usr/local/bin/kolla_start + command: + - /bin/bash + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 3 + successThreshold: 1 + timeoutSeconds: 5 + name: placement-api + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 5 + resources: {} + initContainers: + - args: + - -c + - /usr/local/bin/container-scripts/init.sh + command: + - /bin/bash + env: + - name: DatabasePassword + valueFrom: + secretKeyRef: + key: PlacementDatabasePassword + name: placement-secret + - name: PlacementPassword + valueFrom: + secretKeyRef: + key: PlacementPassword + name: placement-secret + - name: DatabaseHost + value: openstack + - name: DatabaseName + value: placement + - name: DatabaseUser + value: placement + imagePullPolicy: IfNotPresent + name: init + resources: {} + restartPolicy: Always + securityContext: {} + serviceAccount: placement-placement + serviceAccountName: placement-placement +status: + availableReplicas: 1 + replicas: 1 +--- +# the openshift annotations can't be checked through the deployment above +apiVersion: v1 +kind: Pod +metadata: + annotations: + openshift.io/scc: anyuid + labels: + service: placement +status: + phase: Running +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: internal + service: placement + name: placement-internal +spec: + ports: + - name: placement-internal + selector: + service: placement + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: public + service: placement + name: placement-public +spec: + ports: + - name: placement-public + selector: + service: placement + type: ClusterIP +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + placement.openstack.org/name: placement + name: placement-scripts + ownerReferences: + - blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + placement.openstack.org/name: placement + name: placement-config-data + ownerReferences: + - blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement +--- +apiVersion: keystone.openstack.org/v1beta1 +kind: KeystoneEndpoint +metadata: + name: placement + ownerReferences: + - apiVersion: placement.openstack.org/v1beta1 + blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement + diff --git a/tests/kuttl/test-suites/default/scale-tests/01-deploy.yaml b/tests/kuttl/test-suites/default/scale-tests/01-deploy.yaml new file mode 100644 index 00000000..33074e24 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/01-deploy.yaml @@ -0,0 +1,17 @@ +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + name: placement-kuttl +spec: + serviceUser: placement + customServiceConfig: | + [DEFAULT] + debug = true + databaseInstance: openstack + databaseUser: placement + debug: + dbSync: false + service: false + preserveJobs: false + replicas: 1 + secret: placement-secret \ No newline at end of file diff --git a/tests/kuttl/test-suites/default/scale-tests/02-assert.yaml b/tests/kuttl/test-suites/default/scale-tests/02-assert.yaml new file mode 100644 index 00000000..de4ae604 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/02-assert.yaml @@ -0,0 +1,285 @@ +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + finalizers: + - PlacementAPI + name: placement + namespace: placement-kuttl-tests +spec: + databaseInstance: openstack + databaseUser: placement + debug: + dbSync: false + service: false + passwordSelectors: + database: PlacementDatabasePassword + service: PlacementPassword + preserveJobs: false + replicas: 1 + secret: placement-secret + serviceUser: placement +status: + databaseHostname: openstack + readyCount: 1 + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Deployment completed + reason: Ready + status: "True" + type: DeploymentReady + - message: Exposing service completed + reason: Ready + status: "True" + type: ExposeServiceReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneEndpointReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneServiceReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - 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 +metadata: + name: placement +spec: + replicas: 1 + template: + metadata: + labels: + service: placement + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: service + operator: In + values: + - placement + topologyKey: kubernetes.io/hostname + weight: 1 + containers: + - args: + - --single-child + - -- + - /usr/bin/tail + - -n+1 + - -F + - /var/log/placement/placement-api.log + command: + - /usr/bin/dumb-init + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 3 + successThreshold: 1 + timeoutSeconds: 5 + name: placement-log + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 5 + resources: {} + securityContext: + runAsUser: 42482 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /usr/local/bin/container-scripts + name: scripts + readOnly: true + - mountPath: /var/lib/config-data/merged + name: config-data-merged + - mountPath: /var/lib/kolla/config_files/config.json + name: config-data-merged + readOnly: true + subPath: placement-api-config.json + - mountPath: /var/log/placement + name: logs + - args: + - -c + - /usr/local/bin/kolla_start + command: + - /bin/bash + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 3 + successThreshold: 1 + timeoutSeconds: 5 + name: placement-api + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8778 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 5 + resources: {} + initContainers: + - args: + - -c + - /usr/local/bin/container-scripts/init.sh + command: + - /bin/bash + env: + - name: DatabasePassword + valueFrom: + secretKeyRef: + key: PlacementDatabasePassword + name: placement-secret + - name: PlacementPassword + valueFrom: + secretKeyRef: + key: PlacementPassword + name: placement-secret + - name: DatabaseHost + value: openstack + - name: DatabaseName + value: placement + - name: DatabaseUser + value: placement + imagePullPolicy: IfNotPresent + name: init + resources: {} + restartPolicy: Always + securityContext: {} + serviceAccount: placement-placement + serviceAccountName: placement-placement +status: + availableReplicas: 1 + replicas: 1 +--- +# the openshift annotations can't be checked through the deployment above +apiVersion: v1 +kind: Pod +metadata: + annotations: + openshift.io/scc: anyuid + labels: + service: placement +status: + phase: Running +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: internal + service: placement + name: placement-internal +spec: + ports: + - name: placement-internal + selector: + service: placement + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: public + service: placement + name: placement-public +spec: + ports: + - name: placement-public + selector: + service: placement + type: ClusterIP +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + placement.openstack.org/name: placement + name: placement-scripts + ownerReferences: + - blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + placement.openstack.org/name: placement + name: placement-config-data + ownerReferences: + - blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement +--- +apiVersion: keystone.openstack.org/v1beta1 +kind: KeystoneEndpoint +metadata: + name: placement + ownerReferences: + - apiVersion: placement.openstack.org/v1beta1 + blockOwnerDeletion: true + controller: true + kind: PlacementAPI + name: placement + diff --git a/tests/kuttl/test-suites/default/scale-tests/02-patch_placement_deploy.yaml b/tests/kuttl/test-suites/default/scale-tests/02-patch_placement_deploy.yaml new file mode 100644 index 00000000..a7573dc3 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/02-patch_placement_deploy.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch placementapi -n placement-kuttl-tests placement --type='json' -p='[{"op": "replace", "path": "/spec/secret", "value":"placement-secret"}]' diff --git a/tests/kuttl/test-suites/default/scale-tests/03-assert.yaml b/tests/kuttl/test-suites/default/scale-tests/03-assert.yaml new file mode 100644 index 00000000..b287b01b --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/03-assert.yaml @@ -0,0 +1,28 @@ +# +# Check for: +# +# - 1 placementAPI CR +# - 3 Pods for placementAPI CR +# + +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + finalizers: + - PlacementAPI + name: placement + namespace: placement-kuttl-tests +spec: + replicas: 2 +status: + readyCount: 2 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: placement + namespace: placement-kuttl-tests +spec: + replicas: 2 +status: + availableReplicas: 2 diff --git a/tests/kuttl/test-suites/default/scale-tests/03-scale-placementapi.yaml b/tests/kuttl/test-suites/default/scale-tests/03-scale-placementapi.yaml new file mode 100644 index 00000000..0b9aabbe --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/03-scale-placementapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch placementapi -n placement-kuttl-tests placement --type='json' -p='[{"op": "replace", "path": "/spec/replicas", "value":2}]' diff --git a/tests/kuttl/test-suites/default/scale-tests/04-assert.yaml b/tests/kuttl/test-suites/default/scale-tests/04-assert.yaml new file mode 100644 index 00000000..1ddd91c0 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/04-assert.yaml @@ -0,0 +1,26 @@ +# +# Check for: +# +# - 1 placementAPI CR +# - 3 Pods for placementAPI CR +# + +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + finalizers: + - PlacementAPI + name: placement +spec: + replicas: 3 +status: + readyCount: 3 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: placement +spec: + replicas: 3 +status: + availableReplicas: 3 diff --git a/tests/kuttl/test-suites/default/scale-tests/04-scale-down-placementapi.yaml b/tests/kuttl/test-suites/default/scale-tests/04-scale-down-placementapi.yaml new file mode 100644 index 00000000..bea2a0d2 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/04-scale-down-placementapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch placementapi -n placement-kuttl-tests placement --type='json' -p='[{"op": "replace", "path": "/spec/replicas", "value":1}]' diff --git a/tests/kuttl/test-suites/default/scale-tests/05-assert.yaml b/tests/kuttl/test-suites/default/scale-tests/05-assert.yaml new file mode 100644 index 00000000..d1ac9fc6 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/05-assert.yaml @@ -0,0 +1,26 @@ +# +# Check for: +# +# - 1 PlacementAPI CR +# - 1 Pods for PlacementAPI CR +# + +apiVersion: placement.openstack.org/v1beta1 +kind: PlacementAPI +metadata: + finalizers: + - PlacementAPI + name: placement +spec: + replicas: 1 +status: + readyCount: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: placement +spec: + replicas: 1 +status: + availableReplicas: 1 diff --git a/tests/kuttl/test-suites/default/scale-tests/05-scale-down-zero-placementapi.yaml b/tests/kuttl/test-suites/default/scale-tests/05-scale-down-zero-placementapi.yaml new file mode 100644 index 00000000..f3ba9f48 --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/05-scale-down-zero-placementapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch placementapi -n placement-kuttl-tests placement --type='json' -p='[{"op": "replace", "path": "/spec/replicas", "value":0}]' diff --git a/tests/kuttl/test-suites/default/scale-tests/06-cleanup-placementapi.yaml b/tests/kuttl/test-suites/default/scale-tests/06-cleanup-placementapi.yaml new file mode 100644 index 00000000..06857f7d --- /dev/null +++ b/tests/kuttl/test-suites/default/scale-tests/06-cleanup-placementapi.yaml @@ -0,0 +1,6 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: placement.openstack.org/v1beta1 + kind: PlacementAPI + name: placement