From 52c85cbacecac00aa92badbb091fc003ffabccd4 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <janne@kuschku.de>
Date: Sat, 14 May 2022 01:32:59 +0200
Subject: [PATCH] feat: port asynqmon and imghost

---
 .gitlab-ci.yml                             |  2 +
 asynqmon/Chart.yaml                        |  6 ++
 asynqmon/pipeline.yml                      | 12 +++
 asynqmon/templates/_helpers.tpl            | 56 ++++++++++++++
 asynqmon/templates/configmap.yaml          |  9 +++
 asynqmon/templates/deployment.yaml         | 85 ++++++++++++++++++++++
 asynqmon/templates/ingress.yaml            | 20 +++++
 asynqmon/templates/secret.yaml             |  8 ++
 asynqmon/templates/service.yaml            | 21 ++++++
 asynqmon/values.yaml                       | 52 +++++++++++++
 imghost/Chart.yaml                         |  6 ++
 imghost/pipeline.yml                       | 12 +++
 imghost/templates/_helpers.tpl             | 56 ++++++++++++++
 imghost/templates/deployment-backend.yaml  | 82 +++++++++++++++++++++
 imghost/templates/deployment-frontend.yaml | 82 +++++++++++++++++++++
 imghost/templates/ingress.yaml             | 21 ++++++
 imghost/templates/secret.yaml              | 11 +++
 imghost/templates/service-backend.yaml     | 23 ++++++
 imghost/templates/service-frontend.yaml    | 23 ++++++
 imghost/values.yaml                        | 84 +++++++++++++++++++++
 20 files changed, 671 insertions(+)
 create mode 100644 asynqmon/Chart.yaml
 create mode 100644 asynqmon/pipeline.yml
 create mode 100644 asynqmon/templates/_helpers.tpl
 create mode 100644 asynqmon/templates/configmap.yaml
 create mode 100644 asynqmon/templates/deployment.yaml
 create mode 100644 asynqmon/templates/ingress.yaml
 create mode 100644 asynqmon/templates/secret.yaml
 create mode 100644 asynqmon/templates/service.yaml
 create mode 100644 asynqmon/values.yaml
 create mode 100644 imghost/Chart.yaml
 create mode 100644 imghost/pipeline.yml
 create mode 100644 imghost/templates/_helpers.tpl
 create mode 100644 imghost/templates/deployment-backend.yaml
 create mode 100644 imghost/templates/deployment-frontend.yaml
 create mode 100644 imghost/templates/ingress.yaml
 create mode 100644 imghost/templates/secret.yaml
 create mode 100644 imghost/templates/service-backend.yaml
 create mode 100644 imghost/templates/service-frontend.yaml
 create mode 100644 imghost/values.yaml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 05c5d0e..396e931 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,8 @@ stages:
   - release
 include:
 - actual/pipeline.yml
+- asynqmon/pipeline.yml
+- imghost/pipeline.yml
 - jellyfin/pipeline.yml
 - languagetool/pipeline.yml
 - mailu/pipeline.yml
diff --git a/asynqmon/Chart.yaml b/asynqmon/Chart.yaml
new file mode 100644
index 0000000..c348f33
--- /dev/null
+++ b/asynqmon/Chart.yaml
@@ -0,0 +1,6 @@
+apiVersion: v2
+name: asynqmon
+description: Helm Chart for asynqmon
+type: application
+version: 1.0.0
+appVersion: "v0.7.1"
diff --git a/asynqmon/pipeline.yml b/asynqmon/pipeline.yml
new file mode 100644
index 0000000..b3aea8d
--- /dev/null
+++ b/asynqmon/pipeline.yml
@@ -0,0 +1,12 @@
+lint-asynqmon:
+  stage: lint
+  script:
+    - helm lint asynqmon
+
+release-asynqmon:
+  stage: release
+  script:
+    - apk add --no-cache git
+    - helm plugin install https://github.com/chartmuseum/helm-push.git
+    - helm repo add --username gitlab-ci-token --password $CI_JOB_TOKEN repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable
+    - helm cm-push asynqmon repo
diff --git a/asynqmon/templates/_helpers.tpl b/asynqmon/templates/_helpers.tpl
new file mode 100644
index 0000000..41eb512
--- /dev/null
+++ b/asynqmon/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "asynqmon-helm.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).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "asynqmon-helm.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "asynqmon-helm.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "asynqmon-helm.labels" -}}
+helm.sh/chart: {{ include "asynqmon-helm.chart" . }}
+{{ include "asynqmon-helm.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "asynqmon-helm.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "asynqmon-helm.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+
+{{- define "asynqmon-helm.sslPath" -}}
+/certs
+{{- end }}
diff --git a/asynqmon/templates/configmap.yaml b/asynqmon/templates/configmap.yaml
new file mode 100644
index 0000000..c2b433a
--- /dev/null
+++ b/asynqmon/templates/configmap.yaml
@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "asynqmon-helm.fullname" . }}
+  labels:
+    {{- include "asynqmon-helm.labels" . | nindent 4 }}
+data:
+  redis-address: {{ .Values.redis.address }}
+  redis-database: {{ .Values.redis.database }}
diff --git a/asynqmon/templates/deployment.yaml b/asynqmon/templates/deployment.yaml
new file mode 100644
index 0000000..9a94784
--- /dev/null
+++ b/asynqmon/templates/deployment.yaml
@@ -0,0 +1,85 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "asynqmon-helm.fullname" . }}
+  labels:
+    {{- include "asynqmon-helm.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      {{- include "asynqmon-helm.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      {{- with .Values.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      labels:
+        {{- include "asynqmon-helm.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      securityContext:
+        {{- toYaml .Values.podSecurityContext | nindent 8 }}
+      containers:
+        - name: {{ .Chart.Name }}
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          env:
+            - name: REDIS_ADDRESS
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ include "asynqmon-helm.fullname" . }}
+                  key: redis-address
+            - name: REDIS_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: {{ include "asynqmon-helm.fullname" . }}
+                  key: redis-password
+            - name: REDIS_DATABASE
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ include "asynqmon-helm.fullname" . }}
+                  key: redis-database
+          args:
+            - "--redis-addr=${REDIS_ADDRESS}"
+            - "--redis-password=${REDIS_PASSWORD}"
+            - "--redis-db=${REDIS_DATABASE}"
+            {{ if .Values.metrics.enabled }}
+            - "--enable-metrics-exporter"
+            {{ end }}
+          ports:
+            - name: http
+              containerPort: 8080
+              protocol: TCP
+          startupProbe:
+            httpGet:
+              path: /
+              port: http
+          livenessProbe:
+            httpGet:
+              path: /
+              port: http
+          readinessProbe:
+            httpGet:
+              path: /
+              port: http
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+      {{- with .Values.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
diff --git a/asynqmon/templates/ingress.yaml b/asynqmon/templates/ingress.yaml
new file mode 100644
index 0000000..6d5e583
--- /dev/null
+++ b/asynqmon/templates/ingress.yaml
@@ -0,0 +1,20 @@
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: {{ include "asynqmon-helm.fullname" . }}
+  labels:
+    {{- include "asynqmon-helm.labels" . | nindent 4 }}
+  annotations:
+    {{- .Values.ingress.annotations | toYaml | nindent 4 }}
+spec:
+  rules:
+    - host: "{{ .Values.ingress.host }}"
+      http:
+        paths:
+          - path: "{{ .Values.ingress.path }}"
+            backend:
+              service:
+                name: {{ include "asynqmon-helm.fullname" . }}
+                port:
+                  name: http
+            pathType: Prefix
diff --git a/asynqmon/templates/secret.yaml b/asynqmon/templates/secret.yaml
new file mode 100644
index 0000000..6d23538
--- /dev/null
+++ b/asynqmon/templates/secret.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "asynqmon-helm.fullname" . }}
+  labels:
+    {{- include "asynqmon-helm.labels" . | nindent 4 }}
+stringData:
+  redis-password: {{ .Values.redis.password }}
diff --git a/asynqmon/templates/service.yaml b/asynqmon/templates/service.yaml
new file mode 100644
index 0000000..bcf3f93
--- /dev/null
+++ b/asynqmon/templates/service.yaml
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "asynqmon-helm.fullname" . }}
+  {{ if .Values.metrics.enabled }}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/port: "80"
+    prometheus.io/scrape: "true"
+  {{ end }}
+  labels:
+    {{- include "asynqmon-helm.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.type }}
+  ports:
+    - port: 80
+      targetPort: http
+      protocol: TCP
+      name: http
+  selector:
+    {{- include "asynqmon-helm.selectorLabels" . | nindent 4 }}
diff --git a/asynqmon/values.yaml b/asynqmon/values.yaml
new file mode 100644
index 0000000..4a7b72f
--- /dev/null
+++ b/asynqmon/values.yaml
@@ -0,0 +1,52 @@
+replicaCount: 1
+
+image:
+  repository: hibiken/asynqmon
+  pullPolicy: IfNotPresent
+  tag: ""
+
+imagePullSecrets: [ ]
+nameOverride: ""
+fullnameOverride: ""
+
+redis:
+  address: "example.com:6379"
+  database: 0
+  password: ""
+
+metrics:
+  enabled: false
+
+service:
+  type: ClusterIP
+
+ingress:
+  host: "example.com"
+  path: "/"
+  annotations: { }
+
+podAnnotations: { }
+
+podSecurityContext:
+  fsGroup: 2000
+
+securityContext:
+  capabilities:
+    drop:
+      - ALL
+  runAsNonRoot: true
+  runAsUser: 1000
+
+resources:
+  limits:
+    cpu: 500m
+    memory: 512Mi
+  requests:
+    cpu: 10m
+    memory: 64Mi
+
+nodeSelector: { }
+
+tolerations: [ ]
+
+affinity: { }
diff --git a/imghost/Chart.yaml b/imghost/Chart.yaml
new file mode 100644
index 0000000..e8efff2
--- /dev/null
+++ b/imghost/Chart.yaml
@@ -0,0 +1,6 @@
+apiVersion: v2
+name: imghost
+description: Helm Chart for imghost
+type: application
+version: 1.0.0
+appVersion: "b05ab1e2"
diff --git a/imghost/pipeline.yml b/imghost/pipeline.yml
new file mode 100644
index 0000000..913bff0
--- /dev/null
+++ b/imghost/pipeline.yml
@@ -0,0 +1,12 @@
+lint-imghost:
+  stage: lint
+  script:
+    - helm lint imghost
+
+release-imghost:
+  stage: release
+  script:
+    - apk add --no-cache git
+    - helm plugin install https://github.com/chartmuseum/helm-push.git
+    - helm repo add --username gitlab-ci-token --password $CI_JOB_TOKEN repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable
+    - helm cm-push imghost repo
diff --git a/imghost/templates/_helpers.tpl b/imghost/templates/_helpers.tpl
new file mode 100644
index 0000000..b054182
--- /dev/null
+++ b/imghost/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "imghost-helm.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).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "imghost-helm.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "imghost-helm.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "imghost-helm.labels" -}}
+helm.sh/chart: {{ include "imghost-helm.chart" . }}
+{{ include "imghost-helm.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "imghost-helm.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "imghost-helm.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+
+{{- define "imghost-helm.sslPath" -}}
+/certs
+{{- end }}
diff --git a/imghost/templates/deployment-backend.yaml b/imghost/templates/deployment-backend.yaml
new file mode 100644
index 0000000..c44132a
--- /dev/null
+++ b/imghost/templates/deployment-backend.yaml
@@ -0,0 +1,82 @@
+{{- $defaultName := printf "%s-%s" "backend" .Chart.AppVersion -}}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}-backend
+  labels:
+    component: backend
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      component: backend
+      {{- include "imghost-helm.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      {{- with .Values.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      labels:
+        component: backend
+        {{- include "imghost-helm.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      securityContext:
+        {{- toYaml .Values.podSecurityContext | nindent 8 }}
+      volumes:
+        - name: data
+          {{- .Values.volumes.data | nindent 10 }}
+        - name: cache
+          {{- .Values.volumes.cache | nindent 10 }}
+        - name: config
+          secret:
+            secretName: {{ include "imghost-helm.fullname" . }}
+      containers:
+        - name: {{ .Chart.Name }}
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: "{{ .Values.backend.repository }}:{{ .Values.backend.tag | default $defaultName }}"
+          imagePullPolicy: {{ .Values.backend.pullPolicy }}
+          ports:
+            - name: metrics
+              containerPort: 2112
+              protocol: TCP
+          startupProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          livenessProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          readinessProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+          volumeMounts:
+            - mountPath: "/config.yaml"
+              name: config
+              subPath: "config"
+            - mountPath: "/data"
+              name: data
+            - mountPath: "/cache"
+              name: cache
+      {{- with .Values.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
diff --git a/imghost/templates/deployment-frontend.yaml b/imghost/templates/deployment-frontend.yaml
new file mode 100644
index 0000000..2ae1b66
--- /dev/null
+++ b/imghost/templates/deployment-frontend.yaml
@@ -0,0 +1,82 @@
+{{- $defaultName := printf "%s-%s" "frontend" .Chart.AppVersion -}}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}-frontend
+  labels:
+    component: frontend
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      component: frontend
+      {{- include "imghost-helm.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      {{- with .Values.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      labels:
+        component: frontend
+        {{- include "imghost-helm.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      securityContext:
+        {{- toYaml .Values.podSecurityContext | nindent 8 }}
+      volumes:
+        - name: data
+          {{- .Values.volumes.data | nindent 10 }}
+        - name: cache
+          {{- .Values.volumes.cache | nindent 10 }}
+        - name: config
+          secret:
+            secretName: {{ include "imghost-helm.fullname" . }}
+      containers:
+        - name: {{ .Chart.Name }}
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: "{{ .Values.frontend.repository }}:{{ .Values.frontend.tag | default $defaultName }}"
+          imagePullPolicy: {{ .Values.frontend.pullPolicy }}
+          ports:
+            - name: http
+              containerPort: 8080
+              protocol: TCP
+          startupProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          livenessProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          readinessProbe:
+            httpGet:
+              path: /healthz
+              port: metrics
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+          volumeMounts:
+            - mountPath: "/config.yaml"
+              name: config
+              subPath: "config"
+            - mountPath: "/data"
+              name: data
+            - mountPath: "/cache"
+              name: cache
+      {{- with .Values.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
diff --git a/imghost/templates/ingress.yaml b/imghost/templates/ingress.yaml
new file mode 100644
index 0000000..7b0c9b3
--- /dev/null
+++ b/imghost/templates/ingress.yaml
@@ -0,0 +1,21 @@
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}-frontend
+  labels:
+    component: frontend
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+  annotations:
+    {{- .Values.ingress.annotations | toYaml | nindent 4 }}
+spec:
+  rules:
+    - host: "{{ .Values.ingress.host }}"
+      http:
+        paths:
+          - path: "{{ .Values.ingress.path }}"
+            backend:
+              service:
+                name: {{ include "imghost-helm.fullname" . }}-frontend
+                port:
+                  name: http
+            pathType: Prefix
diff --git a/imghost/templates/secret.yaml b/imghost/templates/secret.yaml
new file mode 100644
index 0000000..6eefcc1
--- /dev/null
+++ b/imghost/templates/secret.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}
+  labels:
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+stringData:
+  config: |-
+    sourceFolder: /cache
+    targetFolder: /data
+    {{ .Values.config | toYaml | nindent 4 }}
diff --git a/imghost/templates/service-backend.yaml b/imghost/templates/service-backend.yaml
new file mode 100644
index 0000000..eb295fa
--- /dev/null
+++ b/imghost/templates/service-backend.yaml
@@ -0,0 +1,23 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}-backend
+  {{ if .Values.metrics.enabled }}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/port: "80"
+    prometheus.io/scrape: "true"
+  {{ end }}
+  labels:
+    component: backend
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.type }}
+  ports:
+    - port: 80
+      targetPort: metrics
+      protocol: TCP
+      name: metrics
+  selector:
+    component: backend
+    {{- include "imghost-helm.selectorLabels" . | nindent 4 }}
diff --git a/imghost/templates/service-frontend.yaml b/imghost/templates/service-frontend.yaml
new file mode 100644
index 0000000..eeb5e28
--- /dev/null
+++ b/imghost/templates/service-frontend.yaml
@@ -0,0 +1,23 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "imghost-helm.fullname" . }}-frontend
+  {{ if .Values.metrics.enabled }}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/port: "80"
+    prometheus.io/scrape: "true"
+  {{ end }}
+  labels:
+    component: frontend
+    {{- include "imghost-helm.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.type }}
+  ports:
+    - port: 80
+      targetPort: http
+      protocol: TCP
+      name: http
+  selector:
+    component: frontend
+    {{- include "imghost-helm.selectorLabels" . | nindent 4 }}
diff --git a/imghost/values.yaml b/imghost/values.yaml
new file mode 100644
index 0000000..161f39e
--- /dev/null
+++ b/imghost/values.yaml
@@ -0,0 +1,84 @@
+replicaCount: 1
+
+imagePullSecrets: [ ]
+nameOverride: ""
+fullnameOverride: ""
+
+frontend:
+  repository: k8r.eu/justjanne/imghost
+  pullPolicy: IfNotPresent
+  tag: ""
+
+backend:
+  repository: k8r.eu/justjanne/imghost
+  pullPolicy: IfNotPresent
+  tag: ""
+
+config:
+  sizes:
+    - suffix: "s"
+      size:
+        format: "cover"
+        height: 90
+        width: 90
+    - suffix: ""
+      size:
+        format: "contain"
+        height: 0
+        width: 0
+  quality:
+    compressionQuality: 100
+    samplingFactors: [1, 1]
+  redis:
+    address: "example.com"
+    password: ""
+    database: 0
+  database:
+    format: "postgres"
+    url: "postgresql://user:pass@host/db"
+  concurrency: 10
+  uploadTimeout: "15m"
+  baseUrl: "http://example.com"
+
+metrics:
+  enabled: false
+
+volumes:
+  data: |-
+    emptyDir: {}
+  cache: |-
+    emptyDir: {}
+
+service:
+  type: ClusterIP
+
+ingress:
+  host: "example.com"
+  path: "/"
+  annotations: { }
+
+podAnnotations: { }
+
+podSecurityContext:
+  fsGroup: 2000
+
+securityContext:
+  capabilities:
+    drop:
+      - ALL
+  runAsNonRoot: true
+  runAsUser: 1000
+
+resources:
+  limits:
+    cpu: 500m
+    memory: 512Mi
+  requests:
+    cpu: 10m
+    memory: 64Mi
+
+nodeSelector: { }
+
+tolerations: [ ]
+
+affinity: { }
-- 
GitLab