Skip to content

Instantly share code, notes, and snippets.

@mficzel
Last active January 19, 2021 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mficzel/350fa4e2df2a02da9210904c05630287 to your computer and use it in GitHub Desktop.
Save mficzel/350fa4e2df2a02da9210904c05630287 to your computer and use it in GitHub Desktop.
Kubernetes Green / Blue deployment with Helm
{{/*
Create revion color "green" / "blue" from release number
*/}}
{{- define "project.revisioncolor" -}}
{{- if mod .Release.Revision 2 -}}
{{- printf "green" -}}
{{- else -}}
{{- printf "blue" -}}
{{- end -}}
{{- end -}}
spec:
template:
spec:
containers:
...
env:
- name: STATIC_PUBLISHING_DIRECTORY
value: "{{ .Values.staticBasePath }}/{{ include "project.revisioncolor" . }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment