From 61250f16d4c9b4b05f02a48373a92c5a8b31fd98 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sat, 10 Jun 2023 12:15:31 +0000 Subject: [PATCH] Update 8 files - /invidious/values.yaml - /invidious/Chart.yaml - /invidious/templates/configmap.yaml - /invidious/templates/deployment.yaml - /invidious/templates/_helpers.tpl - /invidious/templates/hpa.yaml - /invidious/templates/service.yaml - /argocd/templates/invidious.yaml --- argocd/templates/invidious.yaml | 20 +++++++++ invidious/Chart.yaml | 22 ++++++++++ invidious/templates/_helpers.tpl | 16 ++++++++ invidious/templates/configmap.yaml | 11 +++++ invidious/templates/deployment.yaml | 61 ++++++++++++++++++++++++++++ invidious/templates/hpa.yaml | 18 +++++++++ invidious/templates/service.yaml | 20 +++++++++ invidious/values.yaml | 63 +++++++++++++++++++++++++++++ 8 files changed, 231 insertions(+) create mode 100644 argocd/templates/invidious.yaml 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/hpa.yaml create mode 100644 invidious/templates/service.yaml create mode 100644 invidious/values.yaml diff --git a/argocd/templates/invidious.yaml b/argocd/templates/invidious.yaml new file mode 100644 index 0000000..b9291f7 --- /dev/null +++ b/argocd/templates/invidious.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: invidious + namespace: argocd +spec: + project: default + source: + repoURL: https://gitlab.com/developerdurp/homelab.git + targetRevision: main + path: invidious + destination: + namespace: invidious + name: in-cluster + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/invidious/Chart.yaml b/invidious/Chart.yaml new file mode 100644 index 0000000..4e4295b --- /dev/null +++ b/invidious/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: invidious +description: Invidious is an alternative front-end to YouTube +version: 1.1.1 +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: Leon Klingele + email: mail@leonklingele.de +dependencies: +- name: postgresql + version: ~12.1.6 + repository: "https://charts.bitnami.com/bitnami/" +engine: gotpl 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/hpa.yaml b/invidious/templates/hpa.yaml new file mode 100644 index 0000000..c6fbefe --- /dev/null +++ b/invidious/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/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..a354812 --- /dev/null +++ b/invidious/values.yaml @@ -0,0 +1,63 @@ +invidious: + name: invidious + + image: + repository: registry.durp.info/invidious/invidious + tag: latest + pullPolicy: Always + + replicaCount: 1 + + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 16 + targetCPUUtilizationPercentage: 50 + + service: + type: ClusterIP + port: 3000 + #loadBalancerIP: + + resources: {} + #requests: + # cpu: 100m + # memory: 64Mi + #limits: + # cpu: 800m + # memory: 512Mi + + securityContext: + allowPrivilegeEscalation: false + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + + # See https://github.com/bitnami/charts/tree/master/bitnami/postgresql + postgresql: + image: + tag: 13 + 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: + \ No newline at end of file