From 6be85aaad6e224a5967998d56ef9cada58293fb3 Mon Sep 17 00:00:00 2001 From: esparig <5576714+esparig@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:46:09 +0200 Subject: [PATCH 1/2] Adding test for OSCAR cowsay Fix: added configmap to OSCAR cowsay test Added second file in the config map and additional check_logs --- vktestset/templates/oscar-cowsay.yaml | 126 ++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 vktestset/templates/oscar-cowsay.yaml diff --git a/vktestset/templates/oscar-cowsay.yaml b/vktestset/templates/oscar-cowsay.yaml new file mode 100644 index 0000000..20b04b8 --- /dev/null +++ b/vktestset/templates/oscar-cowsay.yaml @@ -0,0 +1,126 @@ +apiVersion: v1 +kind: Pod +metadata: + name: oscar-cowsay-{{ uuid }} + namespace: {{ namespace }} + annotations: {{ annotations | tojson }} + +spec: + nodeSelector: + kubernetes.io/hostname: {{ target_node }} + + containers: + - args: + - ' echo $EVENT | /data/supervisor ' + command: + - /bin/sh + - -c + env: + - name: fprocess + value: /oscar/bin/supervisor + - name: max_inflight + value: "1" + - name: write_debug + value: "true" + - name: exec_timeout + value: "0" + - name: read_timeout + value: "300" + - name: write_timeout + value: "300" + - name: healthcheck_interval + value: "5" + - name: EVENT + value: MTIzNDU2NzgK + - name: JOB_UUID + value: fdfc2d23-294f-43ea-bc68-4a2807fdf5f0 + - name: RESOURCE_ID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: ghcr.io/grycap/cowsay + imagePullPolicy: Always + name: oscar-container + volumeMounts: + - mountPath: /oscar/config + name: oscar-config + readOnly: true + - mountPath: /data + name: shared-data + initContainers: + - args: + - cp -r /supervisor-folder/* /data + command: + - /bin/sh + - -c + env: + - name: FAAS_SUPERVISOR_VERSION + value: 1.5.7 + - name: WATCHDOG_VERSION + value: 0.2.1 + image: ghcr.io/grycap/faas-supervisor-kit:1.5.8 + imagePullPolicy: Always + name: supervisor-container + volumeMounts: + - mountPath: /data + name: shared-data + volumes: + - configMap: + defaultMode: 420 + name: oscar-cowsay-cm-{{ uuid }} + name: oscar-config + - emptyDir: {} + name: shared-data + + tolerations: {{ tolerations | tojson }} + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: oscar-cowsay-cm-{{ uuid }} + namespace: {{ namespace }} +data: + script.sh: | + #!/bin/sh + + if [ "$INPUT_TYPE" = "json" ] + then + jq '.message' "$INPUT_FILE_PATH" -r | /usr/games/cowsay + else + cat "$INPUT_FILE_PATH" | /usr/games/cowsay + fi + signature.txt: | + 99999999 + +################################################################################ +# VALIDATION +timeout_seconds: 60 +check_pods: + - name: oscar-cowsay-{{ uuid }} + namespace: {{ namespace }} + +check_logs: + - name: oscar-cowsay-{{ uuid }} + namespace: {{ namespace }} + container: oscar-container + regex: 12345678 + operator: Exists + + - name: oscar-cowsay-{{ uuid }} + namespace: {{ namespace }} + container: oscar-container + regex: 99999999 + operator: Exists + +clean_configs: + - type: pod + name: oscar-cowsay-{{ uuid }} + namespace: {{ namespace }} + condition: onSuccess + + - type: config_map + name: oscar-cowsay-cm-{{ uuid }} + namespace: {{ namespace }} + condition: always \ No newline at end of file From 91416dcf35f0f84c29f4480a40312e92bf631f12 Mon Sep 17 00:00:00 2001 From: esparig <5576714+esparig@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:48:31 +0200 Subject: [PATCH 2/2] Minor fixes --- vktestset/templates/oscar-cowsay.yaml | 31 +++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/vktestset/templates/oscar-cowsay.yaml b/vktestset/templates/oscar-cowsay.yaml index 20b04b8..ad94edb 100644 --- a/vktestset/templates/oscar-cowsay.yaml +++ b/vktestset/templates/oscar-cowsay.yaml @@ -6,11 +6,9 @@ metadata: annotations: {{ annotations | tojson }} spec: - nodeSelector: - kubernetes.io/hostname: {{ target_node }} - containers: - - args: + - name: oscar-container + args: - ' echo $EVENT | /data/supervisor ' command: - /bin/sh @@ -39,9 +37,14 @@ spec: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - image: ghcr.io/grycap/cowsay - imagePullPolicy: Always - name: oscar-container + image: docker://ghcr.io/grycap/cowsay + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: "1" + memory: 1Gi volumeMounts: - mountPath: /oscar/config name: oscar-config @@ -49,8 +52,9 @@ spec: - mountPath: /data name: shared-data initContainers: - - args: - - cp -r /supervisor-folder/* /data + - name: supervisor-container + args: + - cp -r /supervisor/* /data command: - /bin/sh - -c @@ -59,9 +63,7 @@ spec: value: 1.5.7 - name: WATCHDOG_VERSION value: 0.2.1 - image: ghcr.io/grycap/faas-supervisor-kit:1.5.8 - imagePullPolicy: Always - name: supervisor-container + image: docker://ghcr.io/grycap/faas-supervisor-kit:1.5.8 volumeMounts: - mountPath: /data name: shared-data @@ -72,9 +74,10 @@ spec: name: oscar-config - emptyDir: {} name: shared-data - + nodeSelector: + kubernetes.io/hostname: {{ target_node }} tolerations: {{ tolerations | tojson }} - + restartPolicy: Never --- apiVersion: v1 kind: ConfigMap