feat: add deployment-metadata configmap to trigger pod restarts on git changes
This commit is contained in:
@@ -18,10 +18,6 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: storefront
|
app: storefront
|
||||||
annotations:
|
|
||||||
# Flux will substitute this with the actual git revision
|
|
||||||
# Changing this annotation forces pod restart on git updates
|
|
||||||
gitRevision: ${GIT_REVISION:-unknown}
|
|
||||||
spec:
|
spec:
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: clone
|
- name: clone
|
||||||
@@ -120,6 +116,10 @@ spec:
|
|||||||
- start
|
- start
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: deployment-metadata
|
||||||
|
optional: true
|
||||||
env:
|
env:
|
||||||
- name: NODE_ENV
|
- name: NODE_ENV
|
||||||
value: "production"
|
value: "production"
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- deployment-nodejs.yaml
|
- deployment-nodejs.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
|
|
||||||
|
# Generate a ConfigMap with git revision info
|
||||||
|
# This ConfigMap changes on each Flux reconciliation, triggering pod restarts
|
||||||
|
configMapGenerator:
|
||||||
|
- name: deployment-metadata
|
||||||
|
literals:
|
||||||
|
- GIT_REVISION=${GIT_REVISION}
|
||||||
|
- DEPLOY_TIME=${DEPLOY_TIME}
|
||||||
|
options:
|
||||||
|
disableNameSuffixHash: false # Changing hash forces pod restart
|
||||||
|
|||||||
Reference in New Issue
Block a user