mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-11-26 19:30:47 +00:00
An unclean stop leaves the lock file in the session directory. rTorrent then exits and the pod loops in CrashLoopBackOff. An init container now removes both files.
103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .Release.Name }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ .Chart.Name }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
app.kubernetes.io/component: torrent
|
|
annotations:
|
|
version-source: {{ index .Chart.Annotations "version-source" }}
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ .Release.Name }}
|
|
spec:
|
|
{{- with .Values.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
initContainers:
|
|
# An unclean stop (node reboot, OOM kill) leaves a stale lock and socket on the config volume.
|
|
# rTorrent then refuses to start. The Recreate strategy and the RWO volume guarantee that no other
|
|
# rTorrent uses this session directory, so removing both files is safe.
|
|
- name: clean-stale-locks
|
|
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
command: ["sh", "-c", "rm -f /config/session/rtorrent.lock {{ .Values.rtorrentSocket }}"]
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /config
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
command: ["/sbin/tini", "--"]
|
|
args:
|
|
- flood
|
|
- --rtsocket
|
|
- {{ .Values.rtorrentSocket }}
|
|
{{- if .Values.floodNoAuth }}
|
|
- --auth
|
|
- none
|
|
{{- end }}
|
|
env:
|
|
{{- range $key, $value := .Values.env }}
|
|
- name: {{ $key }}
|
|
value: {{ $value | quote }}
|
|
{{- end }}
|
|
ports:
|
|
- containerPort: {{ .Values.webuiPort }}
|
|
name: webui
|
|
- containerPort: {{ .Values.torrentPort }}
|
|
name: torrent-tcp
|
|
protocol: TCP
|
|
- containerPort: {{ .Values.torrentPort }}
|
|
name: torrent-udp
|
|
protocol: UDP
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
{{- omit .Values.livenessProbe "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /config
|
|
- name: data
|
|
mountPath: /data
|
|
- name: rtorrent-config
|
|
mountPath: /config/.rtorrent.rc
|
|
subPath: rtorrent.rc
|
|
volumes:
|
|
- name: config
|
|
persistentVolumeClaim:
|
|
claimName: {{ .Release.Name }}-config
|
|
- name: data
|
|
hostPath:
|
|
path: {{ .Values.volumes.data.hostPath }}
|
|
type: DirectoryOrCreate
|
|
- name: rtorrent-config
|
|
configMap:
|
|
name: {{ .Release.Name }}-rtorrent-config
|