diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de1e2f71cc602947fb8fc51afe58c6d30f8098b2..7a1444e1fe4ddfb9479a0701e5319e5cf3acf4a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,4 +96,5 @@ deploy: before_script: - kubectl config use-context $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:maps-deployment script: - - helm -n $KUBE_NAMESPACE upgrade --install $DEPLOYMENT_CHART_NAME maps/ --set nginx.image.repository=$CI_REGISTRY_IMAGE/nginx --set nginx.image.tag=$IMAGE_TAG --set fpm.image.repository=$CI_REGISTRY_IMAGE/fpm --set fpm.image.tag=$IMAGE_TAG + - kubectl -n $KUBE_NAMESPACE create secret generic $DEPLOYMENT_CHART_NAME --from-file=.env=$ENV_PRODUCTION --dry-run=client --save-config -o yaml | kubectl apply -f - + - helm -n $KUBE_NAMESPACE upgrade --install $DEPLOYMENT_CHART_NAME maps/ --set nginx.image.repository=$CI_REGISTRY_IMAGE/nginx --set secretName=$DEPLOYMENT_CHART_NAME --set nginx.image.tag=$IMAGE_TAG --set fpm.image.repository=$CI_REGISTRY_IMAGE/fpm --set fpm.image.tag=$IMAGE_TAG diff --git a/maps/templates/deployment.yaml b/maps/templates/deployment.yaml index e9992b24d92bc78f86c39e1c7c51eb279b597986..94f89e2bfb14000795f3619ccfb9afaecbec6586 100644 --- a/maps/templates/deployment.yaml +++ b/maps/templates/deployment.yaml @@ -48,8 +48,12 @@ spec: port: fpm resources: {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.fpm.volumeMounts }} volumeMounts: + - name: env + mountPath: "/html/.env" + subPath: .env + readOnly: true + {{- with .Values.fpm.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} - name: nginx @@ -75,8 +79,15 @@ spec: volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} - {{- with .Values.volumes }} + volumes: + - name: env + secret: + secretName: {{ .Values.secretName }} + items: + - key: .env + path: .env + {{- with .Values.volumes }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }}