kube-exam/helm/exam/templates/deployment.yaml

64 lines
1.9 KiB
YAML

{{- range $deploy := .Values.deployments }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "exam.fullname" $ }}-{{ $deploy.name }}
labels:
app: {{ $deploy.name }}
{{- include "exam.labels" $ | nindent 4 }}
spec:
replicas: {{ .replicas }}
selector:
matchLabels:
app: {{ $deploy.name }}
tier: {{ $deploy.tier }}
{{- include "exam.selectorLabels" $ | nindent 6 }}
template:
metadata:
labels:
app: {{ $deploy.name }}
tier: {{ $deploy.tier }}
{{- include "exam.selectorLabels" $ | nindent 8 }}
spec:
containers:
- name: {{ $deploy.name }}
{{- with $deploy.image }}
image: {{ .repository }}:{{ .tag | default $.Chart.AppVersion }}
{{- end }}
ports:
- name: {{ $deploy.name }}
containerPort: {{ $deploy.port }}
{{- if $deploy.env }}
env:
{{- with $deploy.env }}
{{- range $key, $val := .nonsecrets }}
{{- $envKey := $key | upper | replace "-" "_" }}
- name: {{ $envKey }}
value: {{ quote $val }}
{{- end }}
{{- range $key, $val := .secrets }}
{{- $envKey := $key | upper | replace "-" "_" }}
- name: {{ $envKey }}
valueFrom:
secretKeyRef:
# TODO
name: {{ include "exam.fullname" $ }}-secrets
key: {{ $val }}
{{- end }}
{{- end }}
{{- end }}
resources: {}
{{- if $deploy.mountPath }}
volumeMounts:
- mountPath: {{ .mountPath }}
name: {{ .storage }}
{{- end }}
{{- if $deploy.mountPath }}
volumes:
- name: {{ .storage }}
persistentVolumeClaim:
# TODO
claimName: {{ include "exam.fullname" $ }}-postgres-pv-claim
{{- end }}
{{- end }}