charts/watcher/templates/statefulset.yaml
2020-08-27 16:45:01 +08:00

112 lines
3.4 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "watcher.fullname" . }}
labels:
{{- include "watcher.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "watcher.fullname" . }}
selector:
matchLabels:
{{- include "watcher.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "watcher.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "watcher.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: watcher
containerPort: 9090
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 9090
readinessProbe:
httpGet:
path: /
port: 9090
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: app-local-config
mountPath: /config
mountPropagation: HostToContainer
- name: watcher-config
mountPath: /config/backup
subPath: backup
- name: watcher-config
mountPath: /config/posters
subPath: posters
- name: watcher-config
mountPath: /config/logs
subPath: logs
- name: watcher-config
mountPath: /config/templates
subPath: templates
- name: watcher-media-pv
mountPath: /media
- name: {{ .Chart.Name }}-sidecar
image: harbor.ervine.dev/public/x86_64/alpine/db-sidecar:v3.12.0
imagePullPolicy: Always
env:
- name: LIVE_DB
value: /app-remote-config/watcher.sqlite
- name: BACKUP_DB
value: /app-remote-config/watcher.backup.sqlite
securityContext:
privileged: true
lifecycle:
preStop:
exec:
command:
- umount
- /mnt/app-local-config
volumeMounts:
- name: watcher-config
mountPath: /app-remote-config
- name: app-local-config
mountPath: /mnt/app-local-config
mountPropagation: Bidirectional
volumes:
- name: app-local-config
emptyDir: {}
- name: watcher-media-pv
persistentVolumeClaim:
claimName: {{ .Values.mediaPvc }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: watcher-config
spec:
accessModes: ['ReadWriteOnce']
storageClassName: {{ .Values.config.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.config.storageSize }}