Browse Source

Add a new initContainer to copy default config files, fix #3

develop
LecygneNoir 2 years ago
parent
commit
cfcfdaa22f
6 changed files with 39 additions and 8 deletions
  1. +1
    -1
      Chart.yaml
  2. +9
    -0
      scripts/peertube-chown.sh
  3. +1
    -3
      scripts/peertube-init.sh
  4. +20
    -2
      templates/deployment.yaml
  5. +6
    -0
      templates/peertube-chown.yml
  6. +2
    -2
      values.yaml

+ 1
- 1
Chart.yaml View File

@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "v2.1.0-buster"
description: A Helm chart for Kubernetes
name: peertube
version: 1.0.0
version: 1.0.2

+ 9
- 0
scripts/peertube-chown.sh View File

@ -0,0 +1,9 @@
#!/bin/sh
# Ensure user is ok for config files
find /config ! -user peertube -exec chown peertube:peertube {} \;
# Ensure user is ok for data files
find /data ! -user peertube -exec chown peertube:peertube {} \;
exit 0

+ 1
- 3
scripts/peertube-init.sh View File

@ -8,9 +8,7 @@ fi
# Always copy default and custom env configuration file, in cases new keys were added
cp /app/config/default.yaml /config
cp /app/support/docker/production/config/custom-environment-variables.yaml /config
# Patch user after the cp
find /config ! -user peertube -exec chown peertube:peertube {} \;
# Ensure user is ok for data files
find /data ! -user peertube -exec chown peertube:peertube {} \;
exit 0

+ 20
- 2
templates/deployment.yaml View File

@ -19,9 +19,8 @@ spec:
app: {{ template "peertube.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.initcontainer.enabled }}
initContainers:
- name: init-peertube
- name: peertube-init
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
@ -35,6 +34,21 @@ spec:
command:
- sh
- /init/peertube-init.sh
{{- if .Values.chowncontainer.enabled }}
- name: peertube-chown
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /config
- mountPath: /init
name: peertube-chown
readOnly: true
command:
- sh
- /init/peertube-chown.sh
{{- end }}
containers:
- name: {{ .Chart.Name }}
@ -136,3 +150,7 @@ spec:
defaultMode: 420
name: peertube-init
name: peertube-init
- configMap:
defaultMode: 420
name: peertube-chown
name: peertube-chown

+ 6
- 0
templates/peertube-chown.yml View File

@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: peertube-chown
data:
{{- (.Files.Glob "scripts/peertube-chown.sh").AsConfig | nindent 2 }}

+ 2
- 2
values.yaml View File

@ -28,10 +28,10 @@ ingress:
hosts:
- peertube.domain.tld
# At start initcontainer check every video files and chown it to peertube.
# At start chowncontainer check every video files and chown it to peertube user.
# If you have lots of videos, it may take age.
# If you are sure your rights are ok, you may disable this container to speed up start.
initcontainer:
chowncontainer:
enabled: true
resources:

Loading…
Cancel
Save