Skip to content

Commit 3e6d936

Browse files
committed
store secret in a shared namespace
1 parent 8192128 commit 3e6d936

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ jobs:
188188
run: |
189189
# Using kubectl to check if a Certificate resource already exists
190190
# we are doing this to avoid letsenrypt rate limits
191-
if ! kubectl get certificate pr${{ env.PR_NUMBER }}-tls -n pr${{ env.PR_NUMBER }} > /dev/null 2>&1; then
191+
if ! kubectl get certificate pr${{ env.PR_NUMBER }}-tls -n pr-deployment-certs > /dev/null 2>&1; then
192192
echo "Certificate doesn't exist. Creating a new one."
193193
cat <<EOF | kubectl apply -f -
194194
apiVersion: cert-manager.io/v1
195195
kind: Certificate
196196
metadata:
197197
name: pr${{ env.PR_NUMBER }}-tls
198-
namespace: pr${{ env.PR_NUMBER }}
198+
namespace: pr-deployment-certs
199199
spec:
200200
secretName: pr${{ env.PR_NUMBER }}-tls
201201
issuerRef:
@@ -206,7 +206,9 @@ jobs:
206206
- "*.${{ env.PR_DEPLOYMENT_ACCESS_URL }}"
207207
EOF
208208
else
209-
echo "Certificate exists."
209+
echo "Certificate exists. Skipping certificate creation."
210+
echo "Copy certificate from pr-deployment-certs to pr${{ env.PR_NUMBER }} namespace"
211+
kubectl get secret pr${{ env.PR_NUMBER }}-tls -n pr-deployment-certs -o yaml | sed 's/pr-deployment-certs/pr${{ env.PR_NUMBER }}/g' | kubectl apply -f -
210212
fi
211213
212214
- name: Set up PostgreSQL database

0 commit comments

Comments
 (0)