charts/sonarr/templates/statefulset.yaml
2020-07-27 12:01:29 +08:00

111 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "sonarr.fullname" . }}
labels:
{{- include "sonarr.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "sonarr.fullname" . }}
selector:
matchLabels:
{{- include "sonarr.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "sonarr.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "sonarr.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: sonarr-sidecar
image: harbor.ervine.dev/public/x86_64/alpine/sonarr-sidecar:v3.12.0
securityContext:
privileged: true
lifecycle:
preStop:
exec:
command:
- umount
- /mnt/sonarr-local-config
volumeMounts:
- name: sonarr-config
mountPath: /app-remote-config
- name: sonarr-local-config
mountPath: /mnt/app-local-config
mountPropagation: Bidirectional
resources:
requests:
cpu: 20m
memory: 32Mi
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: sonarr
containerPort: 8989
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 8989
readinessProbe:
httpGet:
path: /
port: 8989
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: sonarr-local-config
mountPath: /config
mountPropagation: HostToContainer
- name: sonarr-config
mountPath: /config/Backups
subPath: Backups
- name: sonarr-config
mountPath: /config/MediaCover
subPath: MediaCover
- name: sonarr-config
mountPath: /config/logs
subPath: logs
- name: sonarr-media
mountPath: /tv
subPath: tv
- name: sonarr-media
mountPath: /tv-kids
subPath: tv-kids
volumes:
- emptyDir: {}
name: sonarr-local-config
- name: sonarr-media
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: sonarr-config
spec:
accessModes: ['ReadWriteOnce']
storageClassName: {{ .Values.config.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.config.storageSize }}