From 97aa1f965455493c4195acc41ff57a952955b540 Mon Sep 17 00:00:00 2001 From: James Blair Date: Fri, 15 Jul 2022 09:13:59 +1200 Subject: [PATCH] Started adding invidious chart. --- invidious/Chart.yaml | 9 +++++ invidious/templates/_helpers.tpl | 16 ++++++++ invidious/templates/configmap.yaml | 11 ++++++ invidious/templates/deployment.yaml | 61 +++++++++++++++++++++++++++++ invidious/templates/service.yaml | 20 ++++++++++ invidious/values.yaml | 54 +++++++++++++++++++++++++ jellyfin/Chart.yaml | 20 +--------- jellyfin/values.yaml | 3 -- 8 files changed, 172 insertions(+), 22 deletions(-) create mode 100644 invidious/Chart.yaml create mode 100644 invidious/templates/_helpers.tpl create mode 100644 invidious/templates/configmap.yaml create mode 100644 invidious/templates/deployment.yaml create mode 100644 invidious/templates/service.yaml create mode 100644 invidious/values.yaml diff --git a/invidious/Chart.yaml b/invidious/Chart.yaml new file mode 100644 index 0000000..e33da11 --- /dev/null +++ b/invidious/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: invidious +description: A helm chart for deploying invidious youtube front-end on kubernetes. +version: 1.1.1 +appVersion: 0.20.1 +dependencies: + - name: postgresql + version: ~11.1.3 + repository: "https://charts.bitnami.com/bitnami/" diff --git a/invidious/templates/_helpers.tpl b/invidious/templates/_helpers.tpl new file mode 100644 index 0000000..52158b7 --- /dev/null +++ b/invidious/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/invidious/templates/configmap.yaml b/invidious/templates/configmap.yaml new file mode 100644 index 0000000..58542a3 --- /dev/null +++ b/invidious/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/invidious/templates/deployment.yaml b/invidious/templates/deployment.yaml new file mode 100644 index 0000000..bb0b832 --- /dev/null +++ b/invidious/templates/deployment.yaml @@ -0,0 +1,61 @@ +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 }} + initContainers: + - name: wait-for-postgresql + image: postgres + args: + - /bin/sh + - -c + - until pg_isready -h {{ .Values.config.db.host }} -p {{ .Values.config.db.port }} -U {{ .Values.config.db.user }}; do echo waiting for database; sleep 2; done; + 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/invidious/templates/service.yaml b/invidious/templates/service.yaml new file mode 100644 index 0000000..01454d4 --- /dev/null +++ b/invidious/templates/service.yaml @@ -0,0 +1,20 @@ +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/invidious/values.yaml b/invidious/values.yaml new file mode 100644 index 0000000..fb80c71 --- /dev/null +++ b/invidious/values.yaml @@ -0,0 +1,54 @@ +name: invidious + +image: + repository: quay.io/invidious/invidious + tag: latest + pullPolicy: Always + +replicaCount: 1 + +service: + type: ClusterIP + port: 3000 + +resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 2 + memory: 1Gi + +securityContext: + allowPrivilegeEscalation: false + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + +# See https://github.com/bitnami/charts/tree/master/bitnami/postgresql +postgresql: + image: + registry: quay.io + auth: + username: kemal + password: kemal + database: invidious + primary: + initdb: + username: kemal + password: kemal + scriptsConfigMap: invidious-postgresql-init + +# 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: diff --git a/jellyfin/Chart.yaml b/jellyfin/Chart.yaml index 842e476..60d111d 100644 --- a/jellyfin/Chart.yaml +++ b/jellyfin/Chart.yaml @@ -1,24 +1,6 @@ apiVersion: v2 name: jellyfin -description: A Helm chart for deploying the jellyfin media server on kubernetes. - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. +description: A helm chart for deploying the jellyfin media server on kubernetes. type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.3 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. appVersion: "10.8.1-amd64" diff --git a/jellyfin/values.yaml b/jellyfin/values.yaml index 56671fe..5097d09 100644 --- a/jellyfin/values.yaml +++ b/jellyfin/values.yaml @@ -12,9 +12,6 @@ fullnameOverride: "" service: type: ClusterIP port: 8096 - annotations: {} - labels: {} - loadBalancerIP: ingress: enabled: true