From 1a24447a492d6ab437750450f8e1e77d57dcf271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sat, 8 Aug 2026 13:18:59 +0200 Subject: [PATCH] feat: add rustical --- docker/rustical/docker-compose.yml | 18 --- k8s/argo-apps/helm-rustical.yaml | 58 +++++++++ k8s/charts/helm-rustical/Chart.yaml | 8 ++ .../helm-rustical/templates/_helpers.tpl | 60 +++++++++ .../helm-rustical/templates/ingress.yaml | 45 +++++++ .../helm-rustical/templates/service.yaml | 15 +++ .../helm-rustical/templates/statefulset.yaml | 119 ++++++++++++++++++ k8s/charts/helm-rustical/values.yaml | 63 ++++++++++ 8 files changed, 368 insertions(+), 18 deletions(-) delete mode 100644 docker/rustical/docker-compose.yml create mode 100644 k8s/argo-apps/helm-rustical.yaml create mode 100644 k8s/charts/helm-rustical/Chart.yaml create mode 100644 k8s/charts/helm-rustical/templates/_helpers.tpl create mode 100644 k8s/charts/helm-rustical/templates/ingress.yaml create mode 100644 k8s/charts/helm-rustical/templates/service.yaml create mode 100644 k8s/charts/helm-rustical/templates/statefulset.yaml create mode 100644 k8s/charts/helm-rustical/values.yaml diff --git a/docker/rustical/docker-compose.yml b/docker/rustical/docker-compose.yml deleted file mode 100644 index 25b6f12..0000000 --- a/docker/rustical/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -services: - rustical: - image: ghcr.io/lennart-k/rustical:0.14.1 - restart: unless-stopped - ports: - - '4000:4000' - volumes: - - "${RUSTICAL_DATA_VOLUME:-/mnt/nas1/shared/rustical/:/var/lib/rustical/}" - environment: - RUSTICAL_OIDC__NAME: ${RUSTICAL_OIDC_NAME:-Authentik} - RUSTICAL_OIDC__ISSUER: ${RUSTICAL_OIDC_ISSUER:-https://auth.fukurokuju.dev/application/o/rustical/} - RUSTICAL_OIDC__CLIENT_ID: ${RUSTICAL_OIDC_CLIENT_ID} - RUSTICAL_OIDC__CLIENT_SECRET: ${RUSTICAL_OIDC_CLIENT_SECRET} - RUSTICAL_OIDC__CLAIM_USERID: ${RUSTICAL_OIDC_CLAIM_USERID:-preferred_username} - RUSTICAL_OIDC__SCOPES: '["openid", "profile", "groups"]' - RUSTICAL_OIDC__ALLOW_SIGN_UP: "true" - RUSTICAL_FRONTEND__ALLOW_PASSWORD_LOGIN: ${RUSTICAL_FRONTED_ALLOW_PASSWORD_LOGIN:-false} diff --git a/k8s/argo-apps/helm-rustical.yaml b/k8s/argo-apps/helm-rustical.yaml new file mode 100644 index 0000000..8699598 --- /dev/null +++ b/k8s/argo-apps/helm-rustical.yaml @@ -0,0 +1,58 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helm-rustical + namespace: argo-cd +spec: + destination: + name: '' + namespace: apps-roboces + server: https://kubernetes.default.svc + sources: + - repoURL: git.roboces.dev/catalin/fukuops + chart: helm-rustical + targetRevision: 0.3.0 + helm: + valuesObject: + debug: + enabled: false + replicaCount: 1 + service: + type: LoadBalancer + port: 8001 + targetPort: 4000 + ingress: + enabled: true + className: "traefik" + hosts: + - host: cal.roboces.dev + paths: + - path: / + pathType: Prefix + env: + RUSTICAL_OIDC__NAME: Authentik + RUSTICAL_OIDC__ISSUER: https://auth.fukurokuju.dev/application/o/rustical/ + RUSTICAL_OIDC__CLAIM_USERID: preferred_username + RUSTICAL_OIDC__SCOPES: '["openid", "profile", "groups"]' + RUSTICAL_OIDC__ALLOW_SIGN_UP: "true" + RUSTICAL_FRONTEND__ALLOW_PASSWORD_LOGIN: false + persistence: + enabled: true + storageClass: "truenas-nfs-csi" + accessMode: ReadWriteMany + size: 50Gi + secret: + existingSecretName: rustical + resources: + requests: + cpu: 250m + memory: 256Mi + limits: + cpu: 500m + memory: 512Mi + project: roboces + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/k8s/charts/helm-rustical/Chart.yaml b/k8s/charts/helm-rustical/Chart.yaml new file mode 100644 index 0000000..f503b9a --- /dev/null +++ b/k8s/charts/helm-rustical/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: helm-rustical +description: A Helm chart for Rustical WebDAV server +type: application +version: 0.3.0 +appVersion: 0.14.1 +annotations: + artifacthub.io/images: "- name: rustical\n image: ghcr.io/lennart-k/rustical:0.14.1\n" diff --git a/k8s/charts/helm-rustical/templates/_helpers.tpl b/k8s/charts/helm-rustical/templates/_helpers.tpl new file mode 100644 index 0000000..10ef2c1 --- /dev/null +++ b/k8s/charts/helm-rustical/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "rustical.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "rustical.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 "rustical.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "rustical.labels" -}} +helm.sh/chart: {{ include "rustical.chart" . }} +{{ include "rustical.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "rustical.selectorLabels" -}} +app.kubernetes.io/name: {{ include "rustical.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Service account name +*/}} +{{- define "rustical.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "rustical.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/k8s/charts/helm-rustical/templates/ingress.yaml b/k8s/charts/helm-rustical/templates/ingress.yaml new file mode 100644 index 0000000..5ee460e --- /dev/null +++ b/k8s/charts/helm-rustical/templates/ingress.yaml @@ -0,0 +1,45 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "rustical.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "rustical.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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 }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/k8s/charts/helm-rustical/templates/service.yaml b/k8s/charts/helm-rustical/templates/service.yaml new file mode 100644 index 0000000..12b588c --- /dev/null +++ b/k8s/charts/helm-rustical/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "rustical.fullname" . }} + labels: + {{- include "rustical.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: TCP + name: http + selector: + {{- include "rustical.selectorLabels" . | nindent 4 }} diff --git a/k8s/charts/helm-rustical/templates/statefulset.yaml b/k8s/charts/helm-rustical/templates/statefulset.yaml new file mode 100644 index 0000000..ffd2302 --- /dev/null +++ b/k8s/charts/helm-rustical/templates/statefulset.yaml @@ -0,0 +1,119 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "rustical.fullname" . }} + labels: + {{- include "rustical.labels" . | nindent 4 }} +spec: + serviceName: {{ include "rustical.fullname" . }}-headless + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "rustical.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "rustical.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.debug.enabled }} + initContainers: + - name: debug + image: alpine:3.19 + command: ["sleep", "infinity"] + envFrom: + - secretRef: + name: {{ .Values.secret.existingSecretName }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + volumeMounts: + - name: data + mountPath: /var/lib/rustical + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: false + capabilities: + drop: + - all + {{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullpolicy }} + envFrom: + - secretRef: + name: {{ .Values.secret.existingSecretName | default (include "rustical.fullname" .) }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: 4000 + protocol: TCP + {{- if not .Values.debug.enabled }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /var/lib/rustical + {{- if .Values.persistence.existingClaim }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + restartPolicy: Always + automountServiceAccountToken: false + {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - {{ .Values.persistence.accessMode }} + {{- if .Values.persistence.storageClass }} + {{- if eq "-" .Values.persistence.storageClass }} + storageClassName: "" + {{- else }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- end }} diff --git a/k8s/charts/helm-rustical/values.yaml b/k8s/charts/helm-rustical/values.yaml new file mode 100644 index 0000000..05bb46f --- /dev/null +++ b/k8s/charts/helm-rustical/values.yaml @@ -0,0 +1,63 @@ +# Configuration is managed in k8s/argo-apps/rustical.yaml +replicaCount: 1 + +image: + repository: ghcr.io/lennart-k/rustical + pullpolicy: Always + tag: "" + +imagePullSecrets: [] +podAnnotations: {} +podSecurityContext: {} +securityContext: {} + +service: + type: ClusterIP + port: 4000 + targetPort: 4000 + +ingress: + enabled: false + +persistence: + enabled: true + storageClass: "truenas-nfs-csi" + accessMode: ReadWriteMany + size: 50Gi + existingClaim: "" + +autoscaling: + enabled: false + +resources: {} + +livenessProbe: + tcpSocket: + port: 4000 + initialDelaySeconds: 30 + timeoutSeconds: 15 + successThreshold: 1 + failureThreshold: 3 + periodSeconds: 10 + +readinessProbe: + tcpSocket: + port: 4000 + initialDelaySeconds: 15 + timeoutSeconds: 2 + successThreshold: 1 + failureThreshold: 3 + periodSeconds: 10 + +nodeSelector: {} +tolerations: [] +affinity: {} + +env: {} + +secret: + enabled: true + existingSecretName: "rustical" + +debug: + enabled: false