commit d335eabf4fa0e8d86120f1349536e85ceb7db463 Author: Swordsteel Date: Sat Aug 23 10:35:48 2025 +0200 initialize heimdall diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..0dced27 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,11 @@ +name: Publish Helm Chart + +on: + workflow_dispatch: + +jobs: + call-helm-ci: + uses: helm/common-workflows/.gitea/workflows/release.yaml@master + secrets: + CI_BOT_USERNAME: ${{ secrets.CI_BOT_USERNAME }} + CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..29b95eb --- /dev/null +++ b/README.md @@ -0,0 +1,94 @@ +# Heimdall + +## Basic stuff + +### Install + +```shell +helm install heimdall ./helm --namespace heimdall --create-namespace +``` + +### Update + +```shell +helm -n heimdall upgrade heimdall .\helm\ +``` + +### Check + +```shell +kubectl -n heimdall get cm,pvc,pod,svc +``` + +### Tail Log + +```shell +kubectl -n heimdall logs -f heimdall-0 +``` + +### Delete + +```shell +kubectl delete ns heimdall +``` + +## Immigration + +We need to find the location for the files + +### Step 1 + +```shell +kubectl -n heimdall get pvc data-heimdall-0 -o wide +``` + +Output: + +``` +NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE VOLUMEMODE +data-heimdall-0 Bound pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040 1Gi RWO microk8s-hostpath 1m Filesystem +``` + +we need the volume name in this case `pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040` + +### Step 2 + +```shell +kubectl get pv pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040 -o yaml +``` + +Output: + +``` +apiVersion: v1 +kind: PersistentVolume +metadata: + ... +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + claimRef: + ... + hostPath: + path: /var/snap/microk8s/common/default-storage/heimdall-data-heimdall-0-pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040 + type: DirectoryOrCreate + nodeAffinity: + ... + persistentVolumeReclaimPolicy: Delete + storageClassName: microk8s-hostpath + volumeMode: Filesystem +status: + ... +``` + +We need `spec -> hostPath -> path` in this case `/var/snap/microk8s/common/default-storage/heimdall-data-heimdall-0-pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040` + +### Step 2 + +Login to the old server. and use rsync, don't forget stuff like puid, pgid, file access and stuff. + +```shell +rsync -avz -e ssh ./ username@0.0.0.0:/var/snap/microk8s/common/default-storage/heimdall-data-heimdall-0-pvc-b84dce5e-bc04-456c-83c1-6f6f5f326040 +``` diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..4dc9548 --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: heimdall +description: A Helm chart for Heimdall (linuxserver/heimdall) +type: application +version: 0.1.0 +appVersion: "2.7.4" diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl new file mode 100644 index 0000000..c90ec4f --- /dev/null +++ b/helm/templates/_helpers.tpl @@ -0,0 +1,7 @@ +{{ define "heimdall.name" -}} +{{ .Chart.Name | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{ define "heimdall.environment" -}} +{{ printf "environment-%s" .Chart.Name | trunc 51 | trimSuffix "-" }} +{{- end }} \ No newline at end of file diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml new file mode 100644 index 0000000..538d735 --- /dev/null +++ b/helm/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "heimdall.environment" . }} +data: + PGID: {{ .Values.environment.PGID | quote }} + PUID: {{ .Values.environment.PUID | quote }} + TZ: {{ .Values.environment.TIME_ZONE | quote }} + ALLOW_INTERNAL_REQUESTS: {{ .Values.environment.ALLOW_INTERNAL_REQUESTS | quote }} \ No newline at end of file diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml new file mode 100644 index 0000000..3a2145b --- /dev/null +++ b/helm/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "heimdall.name" . }} + labels: + app: {{ include "heimdall.name" . }} +spec: + type: {{ .Values.service.type }} + {{- if and .Values.service.loadBalancerIP (ne .Values.service.loadBalancerIP "") }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + selector: + app: {{ include "heimdall.name" . }} + ports: + - name: http + port: {{ .Values.service.portHttp }} + targetPort: 80 + - name: https + port: {{ .Values.service.portHttps }} + targetPort: 443 \ No newline at end of file diff --git a/helm/templates/statefulset.yaml b/helm/templates/statefulset.yaml new file mode 100644 index 0000000..fefd725 --- /dev/null +++ b/helm/templates/statefulset.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "heimdall.name" . }} + labels: + app: {{ include "heimdall.name" . }} +spec: + serviceName: {{ include "heimdall.name" . }} + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "heimdall.name" . }} + template: + metadata: + labels: + app: {{ include "heimdall.name" . }} + spec: + containers: + - name: heimdall + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ include "heimdall.environment" . }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + volumeMounts: + - name: data + mountPath: /config + {{- if .Values.resources }} + resources: + {{- if .Values.resources.requests }} + requests: + {{- if .Values.resources.requests.cpu }} + cpu: "{{ .Values.resources.requests.cpu }}" + {{- end }} + {{- if .Values.resources.requests.memory }} + memory: "{{ .Values.resources.requests.memory }}" + {{- end }} + {{- end }} + {{- if .Values.resources.limits }} + limits: + {{- if .Values.resources.limits.cpu }} + cpu: "{{ .Values.resources.limits.cpu }}" + {{- end }} + {{- if .Values.resources.limits.memory }} + memory: "{{ .Values.resources.limits.memory }}" + {{- end }} + {{- end }} + {{- end }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: {{ .Values.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- if and .Values.persistence.storageClass (ne .Values.persistence.storageClass "") }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..412cdf3 --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,36 @@ +replicaCount: 1 + +image: + repository: lscr.io/linuxserver/heimdall + tag: 2.7.4 + pullPolicy: IfNotPresent + +service: + type: ClusterIP + portHttp: 80 + portHttps: 443 + +persistence: + enabled: true + size: 1Gi + storageClass: + accessModes: + - ReadWriteOnce + +resources: + requests: + cpu: "100m" + memory: "128Mi" + limits: + cpu: "250m" + memory: "256Mi" + +nodeSelector: {} +tolerations: [] +affinity: [] + +environment: + PGID: 1000 + PUID: 1000 + ALLOW_INTERNAL_REQUESTS: false + TIME_ZONE: "Etc/UTC"