From f38d6735920088aa2ed6be32153a4a5bc56c3544 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Fri, 13 Sep 2024 11:57:25 -0400 Subject: [PATCH] check for cert file and env vars in deployment --- .github/workflows/build-test.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 0206f36733..075fd91195 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -4276,6 +4276,30 @@ jobs: echo "check if the kotsadm deployment is using the configmap" kubectl get deployment kotsadm -n "$APP_SLUG" -o yaml + echo "exec into the deployment and check for the file and its contents" + if ! kubectl exec -n "$APP_SLUG" deployment/kotsadm -- cat /certs/ca.crt | grep "test value"; then + echo "expected /certs/ca.crt to contain 'test value'" + kubectl exec -n "$APP_SLUG" deployment/kotsadm -- cat /certs/ca.crt + exit 1 + fi + + echo "check that the deployment has an environment variable pointing to the file" + if ! kubectl exec -n "$APP_SLUG" deployment/kotsadm -- env | grep "SSL_CERT_DIR" | grep "/certs"; then + echo "expected env output to contain SSL_CERT_DIR=/certs" + kubectl exec -n "$APP_SLUG" deployment/kotsadm -- env + exit 1 + fi + + echo "check that the deployment has an environment variable with the configmap name" + if ! kubectl exec -n "$APP_SLUG" deployment/kotsadm -- env | grep "SSL_CERT_CONFIGMAP" | grep "custom-cas"; then + echo "expected env output to contain SSL_CERT_CONFIGMAP=custom-cas" + kubectl exec -n "$APP_SLUG" deployment/kotsadm -- env + exit 1 + fi + + ./bin/kots admin-console generate-manifests -n "$NAMESPACE" --shared-password password --private-ca-configmap generated-custom-cas > generated-manifests.yaml + cat generated-manifests.yaml + - name: Generate support bundle on failure if: failure() uses: ./.github/actions/generate-support-bundle