diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1aefe7f900ea2b03c0ce2c8ed8e9827a8fe2f57..83abd90fc9e1a62e9e2d300f69b1746d3d0b01bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -161,10 +161,10 @@ test-helm: - cd helm - helm dependencies update . - helm install theodolite . -f preconfigs/minimal.yaml --wait - - helm test theodolite - kubectl get nodes -o wide - kubectl get pods --all-namespaces -o wide - kubectl get services --all-namespaces -o wide + - helm test theodolite after_script: - k3d cluster delete $CLUSTERNAME diff --git a/helm/benchmark-definitions b/helm/benchmark-definitions deleted file mode 120000 index e25d86a1f35f9815225c23d78b8524f9df81f9b5..0000000000000000000000000000000000000000 --- a/helm/benchmark-definitions +++ /dev/null @@ -1 +0,0 @@ -../theodolite-benchmarks/definitions/ \ No newline at end of file diff --git a/helm/benchmark-definitions/examples b/helm/benchmark-definitions/examples new file mode 120000 index 0000000000000000000000000000000000000000..af08c07e453910f801445770e30d44377da34dec --- /dev/null +++ b/helm/benchmark-definitions/examples @@ -0,0 +1 @@ +../../theodolite/examples/operator/ \ No newline at end of file diff --git a/helm/benchmark-definitions/test/test-example-execution.yaml b/helm/benchmark-definitions/test/test-example-execution.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1b5d99e92d420c11baa6a0459faf824a4d07bad8 --- /dev/null +++ b/helm/benchmark-definitions/test/test-example-execution.yaml @@ -0,0 +1,26 @@ +apiVersion: theodolite.com/v1 +kind: execution +metadata: + name: theodolite-test-execution +spec: + benchmark: "example-benchmark" + loads: + loadType: "NumSensors" + loadValues: [100] + resources: + resourceType: "Instances" + resourceValues: [1] + slos: + - name: "lag trend" + properties: + warmup: 0 # in seconds + execution: + strategy: + name: "RestrictionSearch" + restrictions: + - "LowerBound" + searchStrategy: "LinearSearch" + duration: 60 # in seconds + repetitions: 1 + loadGenerationDelay: 0 # in seconds + configOverrides: [] diff --git a/helm/benchmark-definitions/theodolite-benchmarks b/helm/benchmark-definitions/theodolite-benchmarks new file mode 120000 index 0000000000000000000000000000000000000000..543d7d30cc5a252829abc477075d693832c95e88 --- /dev/null +++ b/helm/benchmark-definitions/theodolite-benchmarks @@ -0,0 +1 @@ +../../theodolite-benchmarks/definitions/ \ No newline at end of file diff --git a/helm/templates/tests/test-prometheus-connection.yaml b/helm/templates/tests/test-prometheus-connection.yaml index 313a0825adf5d654642c6e1d8ff6beb4ee59df97..4c51c0854e14dc7d4d4e23e268226f99114716d4 100644 --- a/helm/templates/tests/test-prometheus-connection.yaml +++ b/helm/templates/tests/test-prometheus-connection.yaml @@ -7,7 +7,7 @@ metadata: {{- include "theodolite.labels" . | nindent 4 }} annotations: "helm.sh/hook": test - "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: containers: - name: wget diff --git a/helm/templates/tests/test-theodolite-example.yaml b/helm/templates/tests/test-theodolite-example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..02f7890c56ed67e4c2b63e3f02426745c64f876f --- /dev/null +++ b/helm/templates/tests/test-theodolite-example.yaml @@ -0,0 +1,52 @@ +{{- if .Values.operator.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "theodolite.fullname" . }}-test-example-files" + annotations: + "helm.sh/hook": test + "helm.sh/hook-weight": "1" + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +data: +{{ ($.Files.Glob "benchmark-definitions/examples/*").AsConfig | indent 2 }} +{{ ($.Files.Glob "benchmark-definitions/test/*").AsConfig | indent 2 }} +--- +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "theodolite.fullname" . }}-test-example" + labels: + {{- include "theodolite.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test + "helm.sh/hook-weight": "2" + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + restartPolicy: Never + containers: + - name: kubectl + image: bitnami/kubectl + command: + - bash + - -c + - | + cd /example-resources/ + kubectl apply -f example-configmap.yaml + kubectl apply -f example-benchmark.yaml + kubectl apply -f test-example-execution.yaml + timeout 180s bash -c "until kubectl get exec theodolite-test-execution -o json | jq -r .status.executionState | grep -i '^Finished$'; do kubectl get exec theodolite-test-execution -o json | jq -r .status.executionState; sleep 5s; done" + RETURN=$? + echo "RETURN: $RETURN" + kubectl delete -f example-configmap.yaml + kubectl delete -f example-benchmark.yaml + kubectl delete -f test-example-execution.yaml + exit $RETURN + volumeMounts: + - name: example-resources + mountPath: /example-resources + volumes: + - name: example-resources + configMap: + name: "{{ include "theodolite.fullname" . }}-test-example-files" + serviceAccountName: {{ include "theodolite.serviceAccountName" . }} +{{- end }} diff --git a/helm/templates/theodolite/benchmarks/benchmark-resources-config-map.yaml b/helm/templates/theodolite/benchmarks/benchmark-resources-config-map.yaml index 2dd355141350921d772edb73a1e8e7795600b0d1..b525ba1ec756232f8f2f6b33321fd808dc68679c 100644 --- a/helm/templates/theodolite/benchmarks/benchmark-resources-config-map.yaml +++ b/helm/templates/theodolite/benchmarks/benchmark-resources-config-map.yaml @@ -6,7 +6,7 @@ kind: ConfigMap metadata: name: benchmark-resources-{{ $name }} data: -{{ ($.Files.Glob (printf "benchmark-definitions/%s/resources/*" $name)).AsConfig | indent 2 }} +{{ ($.Files.Glob (printf "benchmark-definitions/theodolite-benchmarks/%s/resources/*" $name)).AsConfig | indent 2 }} --- {{- end }} {{- end }} diff --git a/helm/templates/theodolite/benchmarks/benchmark.yaml b/helm/templates/theodolite/benchmarks/benchmark.yaml index 1c4cb02ea69dbed711b781535127e00e2a24f1d7..f4d8641afab7b2d52fd57eb561e896dae4278ed6 100644 --- a/helm/templates/theodolite/benchmarks/benchmark.yaml +++ b/helm/templates/theodolite/benchmarks/benchmark.yaml @@ -1,7 +1,7 @@ {{- range $benchmark, $enabled := .Values.operator.theodoliteBenchmarks.benchmarks }} {{- if $enabled -}} {{- $name := kebabcase $benchmark }} -{{ $.Files.Get (printf "benchmark-definitions/%s/%s-benchmark-operator.yaml" $name $name) }} +{{ $.Files.Get (printf "benchmark-definitions/theodolite-benchmarks/%s/%s-benchmark-operator.yaml" $name $name) }} --- {{- end }} {{- end }}