diff --git a/.github/workflows/deploy-kube-secrets-hono-api-test.yaml b/.github/workflows/deploy-kube-secrets-hono-api-test.yaml index cdc5b03e1..cb4dceb67 100644 --- a/.github/workflows/deploy-kube-secrets-hono-api-test.yaml +++ b/.github/workflows/deploy-kube-secrets-hono-api-test.yaml @@ -33,6 +33,14 @@ jobs: - name: deploy Kubernetes secrets to test environment run: | + # Check if the namespace 'hono-api-test' is already created, if not, create it. + NAMESPACE=$(kubectl get namespaces -o jsonpath="{.items[?(@.metadata.name=='hono-api-test')].metadata.name}") + if [ -z "$NAMESPACE" ]; then + echo "Namespace does not exist. Creating namespace..." + kubectl apply -f microk8s-hono-api/hono-api-test/namespace.yaml + else + echo "Namespace already exists. Skipping creation." + fi # create secret regcred for kubernetes to pull image from private registry on Github if ! kubectl -n hono-api-test get secret regcred; then # create the secret when no secret is found