From 32b2dc0acb68a89c2297682a7a7fc6f96f80c754 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Sun, 7 Dec 2025 04:28:21 +0200 Subject: [PATCH] Add wallos app --- argocd-apps/wallos.yaml | 21 +++ charts/wallos/.helmignore | 23 +++ charts/wallos/Chart.yaml | 11 ++ charts/wallos/README.md | 79 ++++++++++ charts/wallos/templates/NOTES.txt | 22 +++ charts/wallos/templates/_helpers.tpl | 82 ++++++++++ charts/wallos/templates/backup.secret.yaml | 14 ++ charts/wallos/templates/cronjob.yaml | 107 +++++++++++++ charts/wallos/templates/deployment.yaml | 132 ++++++++++++++++ charts/wallos/templates/hpa.yaml | 32 ++++ charts/wallos/templates/ingress.yaml | 61 ++++++++ .../templates/persistentvolumeclaims.yaml | 8 + charts/wallos/templates/service.yaml | 15 ++ charts/wallos/templates/serviceaccount.yaml | 12 ++ .../templates/tests/test-connection.yaml | 15 ++ charts/wallos/values.yaml | 143 ++++++++++++++++++ manifests/wallos.yaml/cname.yaml | 2 + manifests/wallos.yaml/values.yaml | 45 ++++++ 18 files changed, 824 insertions(+) create mode 100644 argocd-apps/wallos.yaml create mode 100644 charts/wallos/.helmignore create mode 100644 charts/wallos/Chart.yaml create mode 100644 charts/wallos/README.md create mode 100644 charts/wallos/templates/NOTES.txt create mode 100644 charts/wallos/templates/_helpers.tpl create mode 100644 charts/wallos/templates/backup.secret.yaml create mode 100644 charts/wallos/templates/cronjob.yaml create mode 100644 charts/wallos/templates/deployment.yaml create mode 100644 charts/wallos/templates/hpa.yaml create mode 100644 charts/wallos/templates/ingress.yaml create mode 100644 charts/wallos/templates/persistentvolumeclaims.yaml create mode 100644 charts/wallos/templates/service.yaml create mode 100644 charts/wallos/templates/serviceaccount.yaml create mode 100644 charts/wallos/templates/tests/test-connection.yaml create mode 100644 charts/wallos/values.yaml create mode 100644 manifests/wallos.yaml/cname.yaml create mode 100644 manifests/wallos.yaml/values.yaml diff --git a/argocd-apps/wallos.yaml b/argocd-apps/wallos.yaml new file mode 100644 index 0000000..4c8d508 --- /dev/null +++ b/argocd-apps/wallos.yaml @@ -0,0 +1,21 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: wallos + namespace: argocd +spec: + project: my-apps + source: + repoURL: https://git.dvirlabs.com/dvirlabs/my-apps.git + targetRevision: HEAD + path: charts/wallos-chart + helm: + valueFiles: + - ../../manifests/wallos/values.yaml + destination: + server: https://kubernetes.default.svc + namespace: my-apps + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/charts/wallos/.helmignore b/charts/wallos/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/wallos/.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/charts/wallos/Chart.yaml b/charts/wallos/Chart.yaml new file mode 100644 index 0000000..036dde1 --- /dev/null +++ b/charts/wallos/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +appVersion: 2.46.0 +description: 'Unofficial Chart for Wallos, the Open-Source Personal Subscription Tracker. + This Chart also provides automated backups of Wallos to services like AWS S3. https://github.com/ellite/Wallos ' +maintainers: +- email: armel@rm3l.org + name: rm3l + url: https://rm3l.org +name: wallos +type: application +version: 0.1.0 diff --git a/charts/wallos/README.md b/charts/wallos/README.md new file mode 100644 index 0000000..f6e52cf --- /dev/null +++ b/charts/wallos/README.md @@ -0,0 +1,79 @@ +# wallos + +Unofficial Chart for Wallos, the Open-Source Personal Subscription Tracker. +This Chart also provides automated backups of Wallos to services like AWS S3. +https://github.com/ellite/Wallos + +[![Latest version](https://img.shields.io/badge/latest_version-0.1.0-blue)](https://artifacthub.io/packages/helm/rm3l/wallos) + +## Installation + +```bash +$ helm repo add rm3l https://helm-charts.rm3l.org +$ helm install my-wallos rm3l/wallos --version 0.1.0 +``` + +See https://artifacthub.io/packages/helm/rm3l/wallos?modal=install + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| backup.activeDeadlineSeconds | int | `1800` | | +| backup.aws.accessKeyId | string | `"my-aws-access-key-id"` | AWS Access Key. Must have the permissions to write to the target bucket. | +| backup.aws.enabled | bool | `true` | For now, only AWS is supported. Setting this to `false` (while `backup.enabled` is `true`) will cause a deployment error. | +| backup.aws.s3 | object | `{"destination":"s3://path/to/my/wallos-backup-bucket"}` | Target destination bucket (absolute) in AWS S3, where the backup resources should be written | +| backup.aws.secretKey | string | `"my-aws-secret-key"` | AWS Secret Key. Must have the permissions to write to the target bucket. | +| backup.backoffLimit | int | `1` | | +| backup.concurrencyPolicy | string | `"Forbid"` | | +| backup.enabled | bool | `false` | since the volume will be accessible only to the sole Wallos pod. | +| backup.imagePullPolicy | string | `"IfNotPresent"` | | +| backup.parallelism | int | `1` | | +| backup.resources | object | `{}` | | +| backup.restartPolicy | string | `"OnFailure"` | | +| backup.schedule | string | `"@daily"` | How frequently the Backup job should run. Cron Syntax, as supported by Kubernetes CronJobs | +| backup.ttlSecondsAfterFinished | int | `300` | | +| bootstrapEnabled | bool | `true` | Whether to enable bootstrapping the volume | +| defaultVolumesEnabled | bool | `true` | | +| env.TZ | string | `"Europe/Paris"` | | +| extraVolumeMounts | list | `[]` | Additional Volume mounts | +| extraVolumes | list | `[]` | Additional volumes | +| fullnameOverride | string | `""` | | +| hostNetwork | bool | `false` | Host networking requested for the pod. Beware that setting this to true requires all container ports declared in the pod to be free on the node. This can be useful for example to expose AdGuard Home as a DHCP Server. | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ghcr.io/ellite/wallos"` | | +| image.tag | string | `""` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| persistence.existingClaim | string | `nil` | | +| persistence.volumeClaimSpec.accessModes[0] | string | `"ReadWriteOnce"` | | +| persistence.volumeClaimSpec.resources.requests.storage | string | `"5Gi"` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| priorityClassName | string | `""` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| strategy | object | `{}` | Strategy used to replace old Pods by new ones | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) \ No newline at end of file diff --git a/charts/wallos/templates/NOTES.txt b/charts/wallos/templates/NOTES.txt new file mode 100644 index 0000000..1f3f895 --- /dev/null +++ b/charts/wallos/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "wallos.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "wallos.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "wallos.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "wallos.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/wallos/templates/_helpers.tpl b/charts/wallos/templates/_helpers.tpl new file mode 100644 index 0000000..88e1e04 --- /dev/null +++ b/charts/wallos/templates/_helpers.tpl @@ -0,0 +1,82 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "wallos.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 "wallos.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 "wallos.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "wallos.labels" -}} +helm.sh/chart: {{ include "wallos.chart" . }} +{{ include "wallos.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "wallos.selectorLabels" -}} +app.kubernetes.io/name: {{ include "wallos.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "wallos.backupLabels" -}} +helm.sh/chart: {{ include "wallos.chart" . }} +{{ include "wallos.backupSelectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "wallos.backupSelectorLabels" -}} +app.kubernetes.io/name: {{ include "wallos.name" . }}-backup +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "wallos.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "wallos.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/wallos/templates/backup.secret.yaml b/charts/wallos/templates/backup.secret.yaml new file mode 100644 index 0000000..e90aa4e --- /dev/null +++ b/charts/wallos/templates/backup.secret.yaml @@ -0,0 +1,14 @@ +{{- if .Values.backup.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "wallos.fullname" . }}-backup + labels: + {{- include "wallos.labels" . | nindent 4 }} +data: +{{- if .Values.backup.aws.enabled }} + AWS_ACCESS_KEY_ID: {{ .Values.backup.aws.accessKeyId | b64enc | quote }} + AWS_SECRET_ACCESS_KEY: {{ .Values.backup.aws.secretKey | b64enc | quote }} + S3_DESTINATION: {{ .Values.backup.aws.s3.destination | b64enc | quote }} +{{- end }} +{{- end }} diff --git a/charts/wallos/templates/cronjob.yaml b/charts/wallos/templates/cronjob.yaml new file mode 100644 index 0000000..a0179a8 --- /dev/null +++ b/charts/wallos/templates/cronjob.yaml @@ -0,0 +1,107 @@ +{{- if .Values.backup.enabled -}} +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: batch/v1 +{{- else -}} +apiVersion: batch/v1beta1 +{{- end }} +kind: CronJob +metadata: + name: {{ include "wallos.fullname" . }}-backup + labels: + {{- include "wallos.backupLabels" . | nindent 4 }} +spec: + schedule: "{{ .Values.backup.schedule }}" + concurrencyPolicy: {{ .Values.backup.concurrencyPolicy }} + jobTemplate: + spec: + ttlSecondsAfterFinished: {{ .Values.backup.ttlSecondsAfterFinished }} + backoffLimit: {{ .Values.backup.backoffLimit }} + parallelism: {{ .Values.backup.parallelism }} + activeDeadlineSeconds: {{ .Values.backup.activeDeadlineSeconds }} + template: + metadata: + annotations: + checksum/secret: {{ include (print $.Template.BasePath "/backup.secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 12 }} + {{- end }} + spec: + restartPolicy: {{ .Values.backup.restartPolicy }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 10 }} + {{- end }} + serviceAccountName: {{ include "wallos.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + volumes: + - name: data + persistentVolumeClaim: + {{- if not .Values.persistence.existingClaim }} + claimName: {{ include "wallos.fullname" . }} + {{- else }} + claimName: {{ .Values.persistence.existingClaim }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- if has "ReadWriteOnce" (((.Values.persistence).volumeClaimSpec).accessModes) }} + {{- /* + Force-scheduling the job on the node running the AdguardHome pod. + # Otherwise, the job may never run if scheduled on a different node. + */}} + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + {{- include "wallos.selectorLabels" . | nindent 20 }} + topologyKey: "kubernetes.io/hostname" + {{- else }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 10 }} + {{- end }} + + containers: + - name: backup + imagePullPolicy: {{ .Values.backup.imagePullPolicy }} + {{- if .Values.defaultVolumesEnabled }} + volumeMounts: + - name: data + mountPath: /var/www/html + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 14 }} + {{- if .Values.backup.aws.enabled }} + image: amazon/aws-cli:2.4.9 + args: + - s3 + - cp + - "/var/www/html" + - "$(S3_DESTINATION)" + - "--recursive" + env: + - name: AWS_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "wallos.fullname" . }}-backup + key: AWS_ACCESS_KEY_ID + - name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "wallos.fullname" . }}-backup + key: AWS_SECRET_ACCESS_KEY + - name: S3_DESTINATION + valueFrom: + secretKeyRef: + name: {{ include "wallos.fullname" . }}-backup + key: S3_DESTINATION + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/wallos/templates/deployment.yaml b/charts/wallos/templates/deployment.yaml new file mode 100644 index 0000000..be60709 --- /dev/null +++ b/charts/wallos/templates/deployment.yaml @@ -0,0 +1,132 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "wallos.fullname" . }} + labels: + {{- include "wallos.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "wallos.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "wallos.selectorLabels" . | nindent 8 }} + spec: + priorityClassName: {{ .Values.priorityClassName }} + hostNetwork: {{ .Values.hostNetwork }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "wallos.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.defaultVolumesEnabled }} + volumes: + - name: data + persistentVolumeClaim: + {{- if not .Values.persistence.existingClaim }} + claimName: {{ include "wallos.fullname" . }} + {{- else }} + claimName: {{ .Values.persistence.existingClaim }} + {{- end }} + {{- else }} + {{- with .Values.extraVolumes }} + volumes: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- end }} + + {{- if .Values.bootstrapEnabled }} + initContainers: + - name: bootstrapper + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: + limits: + cpu: 100m + memory: "128Mi" + requests: + cpu: 100m + memory: "64Mi" + volumeMounts: + - name: data + mountPath: /mnt/data + command: + - /bin/sh + - "-c" + - | + ls -lhrta /mnt/data + if ! ls /mnt/data/.initialized ; then + echo "Populating data volume..." + rm -rf /var/www/html/wallos.db || true + cp -vrf /var/www/html/* /mnt/data/ + touch /mnt/data/.initialized + echo "...done." + fi + {{- 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 }} + {{- if .Values.env }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + startupProbe: + exec: + command: + - ls + - /var/www/html/db/wallos.db + initialDelaySeconds: 30 + periodSeconds: 5 + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.defaultVolumesEnabled }} + volumeMounts: + - name: data + mountPath: /var/www/html + {{- else }} + {{- with .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- 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 }} diff --git a/charts/wallos/templates/hpa.yaml b/charts/wallos/templates/hpa.yaml new file mode 100644 index 0000000..eee1081 --- /dev/null +++ b/charts/wallos/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "wallos.fullname" . }} + labels: + {{- include "wallos.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "wallos.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/wallos/templates/ingress.yaml b/charts/wallos/templates/ingress.yaml new file mode 100644 index 0000000..17ab7bc --- /dev/null +++ b/charts/wallos/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "wallos.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "wallos.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + 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 and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/wallos/templates/persistentvolumeclaims.yaml b/charts/wallos/templates/persistentvolumeclaims.yaml new file mode 100644 index 0000000..b19b355 --- /dev/null +++ b/charts/wallos/templates/persistentvolumeclaims.yaml @@ -0,0 +1,8 @@ +{{- if not .Values.persistence.existingClaim -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "wallos.fullname" . }} +spec: + {{- toYaml .Values.persistence.volumeClaimSpec | nindent 2 }} +{{- end }} diff --git a/charts/wallos/templates/service.yaml b/charts/wallos/templates/service.yaml new file mode 100644 index 0000000..463f84f --- /dev/null +++ b/charts/wallos/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "wallos.fullname" . }} + labels: + {{- include "wallos.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "wallos.selectorLabels" . | nindent 4 }} diff --git a/charts/wallos/templates/serviceaccount.yaml b/charts/wallos/templates/serviceaccount.yaml new file mode 100644 index 0000000..3b8cebc --- /dev/null +++ b/charts/wallos/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "wallos.serviceAccountName" . }} + labels: + {{- include "wallos.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/wallos/templates/tests/test-connection.yaml b/charts/wallos/templates/tests/test-connection.yaml new file mode 100644 index 0000000..5e67b6f --- /dev/null +++ b/charts/wallos/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "wallos.fullname" . }}-test-connection" + labels: + {{- include "wallos.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test-pod + image: quay.io/curl/curl + command: ['curl'] + args: ['-L', '{{ include "wallos.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/wallos/values.yaml b/charts/wallos/values.yaml new file mode 100644 index 0000000..780284f --- /dev/null +++ b/charts/wallos/values.yaml @@ -0,0 +1,143 @@ +# Default values for wallos. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: ghcr.io/ellite/wallos + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +# -- Strategy used to replace old Pods by new ones +strategy: {} + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 1 + # maxUnavailable: 33% + +# -- Host networking requested for the pod. Beware that setting this to true requires all container ports declared in the pod to be free on the node. This can be useful for example to expose AdGuard Home as a DHCP Server. +hostNetwork: false + +priorityClassName: "" + +defaultVolumesEnabled: true + +# -- Whether to enable bootstrapping the volume +bootstrapEnabled: true + +persistence: + existingClaim: null + volumeClaimSpec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi + +# -- Additional Volume mounts +extraVolumeMounts: [] + +# -- Additional volumes +extraVolumes: [] + +env: + TZ: 'Europe/Paris' + +backup: + # -- Note that this depends on the Access Mode set for the persistent volume claim (PVC) specified. + # -- As a consequence, backups will not be possible if the PVC access mode is set to ReadWriteOncePod (Kubernetes 1.22+), + # -- since the volume will be accessible only to the sole Wallos pod. + enabled: false + # -- How frequently the Backup job should run. Cron Syntax, as supported by Kubernetes CronJobs + schedule: "@daily" + concurrencyPolicy: Forbid + restartPolicy: OnFailure + ttlSecondsAfterFinished: 300 + activeDeadlineSeconds: 1800 + backoffLimit: 1 + parallelism: 1 + imagePullPolicy: IfNotPresent + resources: {} + aws: + # -- For now, only AWS is supported. Setting this to `false` (while `backup.enabled` is `true`) will cause a deployment error. + enabled: true + # -- AWS Access Key. Must have the permissions to write to the target bucket. + accessKeyId: "my-aws-access-key-id" + # -- AWS Secret Key. Must have the permissions to write to the target bucket. + secretKey: "my-aws-secret-key" + # -- Target destination bucket (absolute) in AWS S3, where the backup resources should be written + s3: + destination: "s3://path/to/my/wallos-backup-bucket" diff --git a/manifests/wallos.yaml/cname.yaml b/manifests/wallos.yaml/cname.yaml new file mode 100644 index 0000000..281cc6f --- /dev/null +++ b/manifests/wallos.yaml/cname.yaml @@ -0,0 +1,2 @@ +enabled: true +hostname: wallos.dvirlabs.com \ No newline at end of file diff --git a/manifests/wallos.yaml/values.yaml b/manifests/wallos.yaml/values.yaml new file mode 100644 index 0000000..c969f8c --- /dev/null +++ b/manifests/wallos.yaml/values.yaml @@ -0,0 +1,45 @@ +# Basic Wallos config – rely mostly on chart defaults + +image: + # use upstream image from the chart (don’t override unless you mirror it) + # repository: harbor.dvirlabs.com/my-apps/wallos + # tag: "latest" + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: true + className: traefik + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + hosts: + - host: wallos.dvirlabs.com + paths: + - path: / + pathType: Prefix + tls: [] + # If you use cert-manager and a DNS name, you can configure something like: + # - secretName: wallos-tls + # hosts: + # - wallos.dvirlabs.com + +persistence: + enabled: true + size: 1Gi + # storageClassName: "" # set if you use a custom StorageClass + +# Example environment overrides if needed by the chart (depends on defaults) +env: + TZ: "Asia/Jerusalem" + # Add more env vars if you want to tweak Wallos behaviour + +resources: {} +# requests: +# cpu: 100m +# memory: 128Mi +# limits: +# cpu: 500m +# memory: 512Mi