Skip to content

Instantly share code, notes, and snippets.

@martincalvert
Created November 9, 2017 16:33
Show Gist options
  • Save martincalvert/64584ddca406a42d953e575fc2a4cd60 to your computer and use it in GitHub Desktop.
Save martincalvert/64584ddca406a42d953e575fc2a4cd60 to your computer and use it in GitHub Desktop.
K8s: Deployment Template
{{ define "ruby_api_deployment" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ .Values.rubyApi.name }}-api
labels:
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
annotations:
"helm/created": {{ .Release.Time.Seconds | quote }}
spec:
replicas: {{ .Values.rubyApi.replicas }}
template:
metadata:
labels:
app: {{ .Values.rubyApi.name }}
tier: {{ .Values.rubyApi.name }}-api
annotations:
date: {{ .Release.Time.Seconds | quote }}
spec:
{{ include "affinity_notation" . | indent 6 }}
containers:
- name: {{ .Values.rubyApi.name }}
image: {{ .Values.rubyApi.image.name }}:{{ .Values.rubyApi.image.tag }}
imagePullPolicy: {{ .Values.rubyApi.image.pullPolicy }}
command:
- bundle
- exec
- unicorn
- "-E"
- {{ .Values.environment }}
- "-c"
- /etc/unicorn/unicorn.rb
- "-l"
- :3000
ports:
- containerPort: 3000
{{ include "pod_resources" .Values.rubyApi.resources | indent 8 }}
{{ include "http_get_probe" .Values.rubyApi.livenessProbe | indent 8 }}
{{ include "http_get_probe" .Values.rubyApi.readinessProbe | indent 8 }}
volumeMounts:
- mountPath: /etc/unicorn/unicorn.rb
subPath: unicorn.rb
name: {{ .Values.rubyApi.name }}-unicorn-config
readOnly: true
volumes:
- name: {{ .Values.rubyApi.name }}-unicorn-config
configMap:
name: {{ .Values.rubyApi.name }}-unicorn-config
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment