aboutsummaryrefslogtreecommitdiff
path: root/templates
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 /templates
Initial commit
Diffstat (limited to 'templates')
-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
6 files changed, 165 insertions, 0 deletions
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 }}
+...