From a74f588640143e103fbde3e99b3c09b3f1b7bff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Fri, 1 Nov 2024 05:08:49 +0800 Subject: [PATCH] Use configmap instead of secrets --- .gitignore | 1 + concourse/prepare-deployment-resources.yaml | 2 ++ k8s/configmap.yaml | 25 +++++++++++++++++++++ k8s/deployments.yaml | 4 ++-- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 k8s/configmap.yaml diff --git a/.gitignore b/.gitignore index fff347a..7ff9941 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store *~ *.swp *.pyc diff --git a/concourse/prepare-deployment-resources.yaml b/concourse/prepare-deployment-resources.yaml index ab371da..49b63fa 100644 --- a/concourse/prepare-deployment-resources.yaml +++ b/concourse/prepare-deployment-resources.yaml @@ -18,4 +18,6 @@ run: - -exc - | VERSION=$( cat commit.sha ) + cat k8s/configmap.yaml >> deploy-confs/prod.yaml + echo "---" sed "s/IMAGE_TAG/$VERSION/g" k8s/deployments.yaml >> deploy-confs/prod.yaml diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml new file mode 100644 index 0000000..bed48fc --- /dev/null +++ b/k8s/configmap.yaml @@ -0,0 +1,25 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: astrojs-nginx-ctmpls + namespace: default +data: + default.conf.template: | + server { + listen 80; + listen [::]:80; + server_name localhost; + + expires 10d; + add_header Cache-Control "public"; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index fbdaf1d..5ea0e7d 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -71,8 +71,8 @@ spec: persistentVolumeClaim: claimName: astrojs-cache - name: nginx-conf-templates - secret: - secretName: nginx-conf-templates + configMap: + name: astrojs-nginx-ctmpls ---