From 46beed24543994a465e5449acc1bb987e5368441 Mon Sep 17 00:00:00 2001 From: R-man3000 Date: Sun, 31 May 2026 13:53:25 +0300 Subject: move Heimdall deployment to helm chart --- README.md | 9 +++++-- apps/heimdall/templates/_helpers.tpl | 19 +++++++++++++- apps/heimdall/templates/deployment.yaml | 46 +++++++++++++++++++++++++++++++++ apps/heimdall/templates/ingress.yaml | 22 ++++++++++++++++ apps/heimdall/templates/pvc.yaml | 16 ++++++++++++ apps/heimdall/templates/service.yaml | 15 +++++++++++ 6 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 apps/heimdall/templates/deployment.yaml create mode 100644 apps/heimdall/templates/ingress.yaml create mode 100644 apps/heimdall/templates/pvc.yaml create mode 100644 apps/heimdall/templates/service.yaml diff --git a/README.md b/README.md index ead3c16..1e72ae2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ +# Work in porgress ... + ## Prerequisites Following tools need to be installed and working: `docker ` `kubectl ` +`helm ` `k3d ` ### Networking For me, using `Fedora`, i was not able to access internet from my k8s cluster initally. -The fix was adding dns in `/etc/docker/daemon.json` +`Docker` was looking for the DNS server at the Host's ip (127.0.0.53), which doesn't exist inside the cluster +The fix was adding DNS location explicitly in `/etc/docker/daemon.json`. ``` { "dns": ["8.8.8.8", "1.1.1.1"], @@ -18,6 +22,7 @@ I also added `hemidal.local` to my `/etc/hosts` file for the convenience of usin 127.0.0.1 localhost ... ... ... hemidall.local ``` -## Usage - TODO +## Usage (WIP) - run the setup_script.sh - open `localhost:8080` on yout browser +- ... diff --git a/apps/heimdall/templates/_helpers.tpl b/apps/heimdall/templates/_helpers.tpl index 1333ed7..b0376aa 100644 --- a/apps/heimdall/templates/_helpers.tpl +++ b/apps/heimdall/templates/_helpers.tpl @@ -1 +1,18 @@ -TODO +{{- define "heimdall.name" -}} +{{- .Chart.Name }} +{{- end }} + +{{- define "heimdall.labels" -}} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} +app.kubernetes.io/name: {{ include "heimdall.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + + +{{/* Stable subset only — selector labels cannot change after first deploy. */}} + +{{- define "heimdall.selectorLabels" -}} +app.kubernetes.io/name: {{ include "heimdall.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/apps/heimdall/templates/deployment.yaml b/apps/heimdall/templates/deployment.yaml new file mode 100644 index 0000000..97a4f5f --- /dev/null +++ b/apps/heimdall/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "heimdall.name" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "heimdall.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "heimdall.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "heimdall.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 80 + protocol: TCP + env: + - name: PUID + value: {{ .Values.env.puid | quote }} + - name: PGID + value: {{ .Values.env.pgid | quote }} + - name: APP_URL + value: {{ .Values.env.appUrl | quote }} + volumeMounts: + - name: config + mountPath: /config + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: config + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "heimdall.name" . }}-pvc + {{- else }} + emptyDir: {} + {{- end }} diff --git a/apps/heimdall/templates/ingress.yaml b/apps/heimdall/templates/ingress.yaml new file mode 100644 index 0000000..cd07205 --- /dev/null +++ b/apps/heimdall/templates/ingress.yaml @@ -0,0 +1,22 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "heimdall.name" . }}-ingress + namespace: {{ .Release.Namespace }} + labels: + {{- include "heimdall.labels" . | nindent 4 }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + - host: {{ .Values.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "heimdall.name" . }}-service + port: + number: {{ .Values.service.port }} +{{- end }} diff --git a/apps/heimdall/templates/pvc.yaml b/apps/heimdall/templates/pvc.yaml new file mode 100644 index 0000000..dc376ef --- /dev/null +++ b/apps/heimdall/templates/pvc.yaml @@ -0,0 +1,16 @@ +{{- if .Values.persistence.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "heimdall.name" . }}-pvc + namespace: {{ .Release.Namespace }} + labels: + {{- include "heimdall.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + storageClassName: {{ .Values.persistence.storageClass }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- end }} diff --git a/apps/heimdall/templates/service.yaml b/apps/heimdall/templates/service.yaml new file mode 100644 index 0000000..7743097 --- /dev/null +++ b/apps/heimdall/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "heimdall.name" . }}-service + namespace: {{ .Release.Namespace }} + labels: + {{- include "heimdall.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + selector: + {{- include "heimdall.selectorLabels" . | nindent 4 }} + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: 80 -- cgit v1.2.3