helm-charts/bitwarden/templates/deployment.yaml

135 lines
4.6 KiB
YAML
Raw Normal View History

{{- if eq .Values.persistence.type "deployment" }}
{{- $fullName := include "bitwarden.fullname" . -}}
2021-01-17 01:09:41 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $fullName }}
2021-01-17 01:09:41 +00:00
labels:
{{- include "bitwarden.labels" . | nindent 4 }}
2021-01-17 01:09:41 +00:00
spec:
{{- if not .Values.autoscaling.enabled }}
2021-01-17 01:09:41 +00:00
replicas: {{ .Values.replicaCount }}
{{- end }}
2021-01-17 01:09:41 +00:00
selector:
matchLabels:
{{- include "bitwarden.selectorLabels" . | nindent 6 }}
2021-01-17 01:09:41 +00:00
template:
metadata:
{{- with .Values.podAnnotations }}
2021-01-17 01:09:41 +00:00
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "bitwarden.selectorLabels" . | nindent 8 }}
2021-01-17 01:09:41 +00:00
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "bitwarden.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
2021-01-17 01:09:41 +00:00
containers:
- name: {{ $fullName }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
2021-01-17 01:09:41 +00:00
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ $fullName }}
2021-01-17 01:09:41 +00:00
env:
{{- with .Values.bitwarden.admin }}
{{- if and .enabled (not .disableAdminToken) }}
- name: ADMIN_TOKEN
valueFrom:
secretKeyRef:
{{- if .existingSecret.enabled }}
name: {{ .existingSecret.name | quote }}
key: {{ .existingSecret.tokenKey | quote }}
{{- else }}
name: {{ $fullName }}
key: admin-token
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.bitwarden.smtp }}
{{- if eq .enabled true }}
{{- if and .existingSecret.enabled (not .user) }}
- name: SMTP_USERNAME
valueFrom:
secretKeyRef:
name: {{ .existingSecret.name | quote }}
key: {{ .existingSecret.userKey | quote }}
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .existingSecret.name | quote }}
key: {{ .existingSecret.passwordKey | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.bitwarden.yubico }}
{{- if and .enabled .existingSecret.enabled }}
- name: YUBICO_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .existingSecret.name | quote }}
key: {{ .existingSecret.clientIdKey | quote }}
- name: YUBICO_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .existingSecret.name | quote }}
key: {{ .existingSecret.secretKeyKey | quote }}
{{- end }}
{{- end }}
{{- include "bitwarden.externalDatabaseEnv" . | nindent 12 }}
2021-01-17 01:09:41 +00:00
ports:
- name: http
containerPort: {{ .Values.bitwarden.gui.port }}
protocol: TCP
{{- if .Values.bitwarden.websockets.enabled }}
- name: websocket
containerPort: {{ .Values.bitwarden.websockets.port }}
2021-01-17 01:09:41 +00:00
protocol: TCP
{{- end }}
2021-01-17 01:09:41 +00:00
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
2021-01-17 01:09:41 +00:00
volumeMounts:
- name: {{ include "bitwarden.fullname" . }}
mountPath: /data
{{- with .Values.nodeSelector }}
2021-01-17 01:09:41 +00:00
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
2021-01-17 01:09:41 +00:00
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
2021-01-17 01:09:41 +00:00
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: {{ include "bitwarden.fullname" . }}
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim | quote }}{{- else }}{{ include "bitwarden.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}