aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2022-09-23 09:32:46 +0200
committerPatrick Spek <p.spek@tyil.nl>2022-09-23 09:32:46 +0200
commit258ae0c022e0c57e9e87c61e9ca5890ef0480da1 (patch)
treefb08d7d06b4bf606925da3db12f4d84b3bfbe884
Initial commit
-rw-r--r--Chart.lock6
-rw-r--r--Chart.yaml18
-rw-r--r--README.md41
-rw-r--r--templates/_helpers.tpl16
-rw-r--r--templates/configmap.yaml11
-rw-r--r--templates/deployment.yaml56
-rw-r--r--templates/hpa.yaml18
-rw-r--r--templates/ingress.yaml42
-rw-r--r--templates/service.yaml22
-rw-r--r--values.yaml63
10 files changed, 293 insertions, 0 deletions
diff --git a/Chart.lock b/Chart.lock
new file mode 100644
index 0000000..37fcdbb
--- /dev/null
+++ b/Chart.lock
@@ -0,0 +1,6 @@
+dependencies:
+- name: postgresql
+ repository: https://charts.bitnami.com/bitnami/
+ version: 11.1.3
+digest: sha256:79061645472b6fb342d45e8e5b3aacd018ef5067193e46a060bccdc99fe7f6e1
+generated: "2022-03-02T05:57:20.081432389+13:00"
diff --git a/Chart.yaml b/Chart.yaml
new file mode 100644
index 0000000..48af2d5
--- /dev/null
+++ b/Chart.yaml
@@ -0,0 +1,18 @@
+apiVersion: v2
+name: invidious
+description: Invidious is an alternative front-end to YouTube
+version: 2.0.0
+appVersion: 0.20.1
+keywords:
+- youtube
+- proxy
+- video
+- privacy
+home: https://invidio.us/
+icon: https://raw.githubusercontent.com/iv-org/invidious/05988c1c49851b7d0094fca16aeaf6382a7f64ab/assets/favicon-32x32.png
+sources:
+- https://github.com/iv-org/invidious
+maintainers:
+- name: Patrick Spek
+ email: p.spek@tyil.work
+engine: gotpl
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..35478f9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,41 @@
+# Invidious Helm chart
+
+Easily deploy Invidious to Kubernetes.
+
+## Installing Helm chart
+
+```sh
+# Build Helm dependencies
+$ helm dep build
+
+# Add PostgreSQL init scripts
+$ kubectl create configmap invidious-postgresql-init \
+ --from-file=../config/sql/channels.sql \
+ --from-file=../config/sql/videos.sql \
+ --from-file=../config/sql/channel_videos.sql \
+ --from-file=../config/sql/users.sql \
+ --from-file=../config/sql/session_ids.sql \
+ --from-file=../config/sql/nonces.sql \
+ --from-file=../config/sql/annotations.sql \
+ --from-file=../config/sql/playlists.sql \
+ --from-file=../config/sql/playlist_videos.sql
+
+# Install Helm app to your Kubernetes cluster
+$ helm install invidious ./
+```
+
+## Upgrading
+
+```sh
+# Upgrading is easy, too!
+$ helm upgrade invidious ./
+```
+
+## Uninstall
+
+```sh
+# Get rid of everything (except database)
+$ helm delete invidious
+
+# To also delete the database, remove all invidious-postgresql PVCs
+```
diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl
new file mode 100644
index 0000000..52158b7
--- /dev/null
+++ b/templates/_helpers.tpl
@@ -0,0 +1,16 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "invidious.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+*/}}
+{{- define "invidious.fullname" -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/templates/configmap.yaml b/templates/configmap.yaml
new file mode 100644
index 0000000..58542a3
--- /dev/null
+++ b/templates/configmap.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "invidious.fullname" . }}
+ labels:
+ app: {{ template "invidious.name" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: {{ .Release.Name }}
+data:
+ INVIDIOUS_CONFIG: |
+{{ toYaml .Values.config | indent 4 }}
diff --git a/templates/deployment.yaml b/templates/deployment.yaml
new file mode 100644
index 0000000..ea1bab5
--- /dev/null
+++ b/templates/deployment.yaml
@@ -0,0 +1,56 @@
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ template "invidious.fullname" . }}
+ labels:
+ app: {{ template "invidious.name" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: {{ .Release.Name }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ app: {{ template "invidious.name" . }}
+ release: {{ .Release.Name }}
+ template:
+ metadata:
+ labels:
+ app: {{ template "invidious.name" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: {{ .Release.Name }}
+ spec:
+ securityContext:
+ runAsUser: {{ .Values.securityContext.runAsUser }}
+ runAsGroup: {{ .Values.securityContext.runAsGroup }}
+ fsGroup: {{ .Values.securityContext.fsGroup }}
+ containers:
+ - name: {{ .Chart.Name }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ ports:
+ - containerPort: 3000
+ env:
+ - name: INVIDIOUS_CONFIG
+ valueFrom:
+ configMapKeyRef:
+ key: INVIDIOUS_CONFIG
+ name: {{ template "invidious.fullname" . }}
+ securityContext:
+ allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation }}
+ capabilities:
+ drop:
+ - ALL
+ resources:
+{{ toYaml .Values.resources | indent 10 }}
+ readinessProbe:
+ httpGet:
+ port: 3000
+ path: /
+ livenessProbe:
+ httpGet:
+ port: 3000
+ path: /
+ initialDelaySeconds: 15
+ restartPolicy: Always
+...
diff --git a/templates/hpa.yaml b/templates/hpa.yaml
new file mode 100644
index 0000000..c6fbefe
--- /dev/null
+++ b/templates/hpa.yaml
@@ -0,0 +1,18 @@
+{{- if .Values.autoscaling.enabled }}
+apiVersion: autoscaling/v1
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ template "invidious.fullname" . }}
+ labels:
+ app: {{ template "invidious.name" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: {{ .Release.Name }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ template "invidious.fullname" . }}
+ minReplicas: {{ .Values.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}
+ targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
+{{- end }}
diff --git a/templates/ingress.yaml b/templates/ingress.yaml
new file mode 100644
index 0000000..b51d695
--- /dev/null
+++ b/templates/ingress.yaml
@@ -0,0 +1,42 @@
+---
+{{- if .Values.ingress.enabled -}}
+{{- $fullName := include "invidious.fullname" . -}}
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ name: {{ $fullName }}
+ labels:
+ {{- include "invidious.labels" . | nindent 4 }}
+ {{- with .Values.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ ingressClassName: {{ .Values.ingress.className }}
+ {{- if .Values.ingress.tls }}
+ tls:
+ {{- range .Values.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ .path }}
+ pathType: {{ .pathType | default "ImplementationSpecific"}}
+ backend:
+ service:
+ name: {{ $fullName }}
+ port:
+ number: {{ $.Values.service.port }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+...
diff --git a/templates/service.yaml b/templates/service.yaml
new file mode 100644
index 0000000..f1dc7ea
--- /dev/null
+++ b/templates/service.yaml
@@ -0,0 +1,22 @@
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ template "invidious.fullname" . }}
+ labels:
+ app: {{ template "invidious.name" . }}
+ chart: {{ .Chart.Name }}
+ release: {{ .Release.Name }}
+spec:
+ type: {{ .Values.service.type }}
+ ports:
+ - name: http
+ port: {{ .Values.service.port }}
+ targetPort: 3000
+ selector:
+ app: {{ template "invidious.name" . }}
+ release: {{ .Release.Name }}
+{{- if .Values.service.loadBalancerIP }}
+ loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+{{- end }}
+...
diff --git a/values.yaml b/values.yaml
new file mode 100644
index 0000000..8bba538
--- /dev/null
+++ b/values.yaml
@@ -0,0 +1,63 @@
+name: invidious
+
+image:
+ repository: quay.io/invidious/invidious
+ tag: latest
+ pullPolicy: Always
+
+replicaCount: 1
+
+autoscaling:
+ enabled: false
+ minReplicas: 1
+ maxReplicas: 16
+ targetCPUUtilizationPercentage: 50
+
+service:
+ type: ClusterIP
+ port: 3000
+ #loadBalancerIP:
+
+ingress:
+ enabled: false
+ className: ""
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ hosts:
+ - host: chart-example.local
+ paths:
+ - path: /
+ pathType: ImplementationSpecific
+ tls: []
+ # - secretName: chart-example-tls
+ # hosts:
+ # - chart-example.local
+
+resources: {}
+ #requests:
+ # cpu: 100m
+ # memory: 64Mi
+ #limits:
+ # cpu: 800m
+ # memory: 512Mi
+
+securityContext:
+ allowPrivilegeEscalation: false
+ runAsUser: 1000
+ runAsGroup: 1000
+ fsGroup: 1000
+
+# Adapted from ../config/config.yml
+config:
+ channel_threads: 1
+ feed_threads: 1
+ db:
+ user: kemal
+ password: kemal
+ host: invidious-postgresql
+ port: 5432
+ dbname: invidious
+ full_refresh: false
+ https_only: false
+ domain: