Browse Source

Release initContainer branch, fix MR #1

Merge remote-tracking branch 'origin/initContainers'
pull/4/head 1.0.0
LecygneNoir 4 years ago
parent
commit
31c2fe86d5
5 changed files with 61 additions and 7 deletions
  1. +2
    -2
      Chart.yaml
  2. +16
    -0
      scripts/peertube-init.sh
  3. +29
    -3
      templates/deployment.yaml
  4. +6
    -0
      templates/peertube-init.yml
  5. +8
    -2
      values.yaml

+ 2
- 2
Chart.yaml View File

@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "1.0.x"
appVersion: "1.0.1"
description: A Helm chart for Kubernetes
name: peertube
version: 0.1.0
version: 1.0.0

+ 16
- 0
scripts/peertube-init.sh View File

@ -0,0 +1,16 @@
#!/bin/sh
# Populate config directory
if [ -z "$(ls -A /config)" ]; then
cp /app/support/docker/production/config/* /config
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
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

+ 29
- 3
templates/deployment.yaml View File

@ -19,6 +19,23 @@ spec:
app: {{ template "peertube.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.initcontainer.enabled }}
initContainers:
- name: init-peertube
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /config
- mountPath: /init
name: peertube-init
readOnly: true
command:
- sh
- /init/peertube-init.sh
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@ -31,12 +48,17 @@ spec:
httpGet:
path: /
port: http
initialDelaySeconds: 300
initialDelaySeconds: 60
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 300
initialDelaySeconds: 60
command:
- gosu
- peertube
- npm
- start
env:
- name: PEERTUBE_WEBSERVER_HOSTNAME
value: {{ .Values.environment.hostname }}
@ -109,4 +131,8 @@ spec:
{{- else }}
- name: config
emptyDir: {}
{{- end }}
{{- end }}
- configMap:
defaultMode: 420
name: peertube-init
name: peertube-init

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

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

sample/values.yml → values.yaml View File

@ -28,6 +28,12 @@ ingress:
hosts:
- peertube.domain.tld
# At start initcontainer check every video files and chown it to peertube.
# 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:
enabled: true
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
@ -53,7 +59,7 @@ tolerations: []
# values:
# - yournodes.domain.tld
# Currently pvc are not handled by helm, you need to create both config and data volume before launching the helm
# PVC are not handled by helm, you need to create both config and data volume before launching the helm
persistence:
data:
enabled: true
@ -87,7 +93,7 @@ redis:
persistence:
enabled: true
path: /data
# Currently pvc are not handled by helm, you need to create redis volume before deploying helm
# PVC are not handled by helm, you need to create redis volume before deploying helm
persistence:
enabled: true
existingClaim: pvc-redis-prod

Loading…
Cancel
Save