From f2d71000a03c9cd1ee39d4d4d1a49b7998fd5d9f Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Wed, 21 Aug 2024 18:37:50 +0100 Subject: [PATCH] Deprecate forgejo, add mealie. --- .woodpecker/forgejo.yaml | 12 ---- charts/{ => _deprecated}/forgejo/.helmignore | 0 charts/{ => _deprecated}/forgejo/Chart.yaml | 0 .../forgejo/templates/_helpers.tpl | 0 .../forgejo/templates/ingress.yaml | 0 .../forgejo/templates/pvc.yaml | 0 .../forgejo/templates/secret.yaml | 0 .../forgejo/templates/service.yaml | 0 .../forgejo/templates/serviceaccount.yaml | 0 .../forgejo/templates/statefulset.yaml | 0 charts/{ => _deprecated}/forgejo/values.yaml | 0 charts/mealie/.helmignore | 23 +++++++ charts/mealie/Chart.yaml | 7 ++ charts/mealie/templates/_helpers.tpl | 62 +++++++++++++++++ charts/mealie/templates/deployment.yaml | 66 ++++++++++++++++++ charts/mealie/templates/ingress.yaml | 61 +++++++++++++++++ charts/mealie/templates/pvc.yaml | 16 +++++ charts/mealie/templates/service.yaml | 15 +++++ charts/mealie/values.yaml | 67 +++++++++++++++++++ 19 files changed, 317 insertions(+), 12 deletions(-) delete mode 100644 .woodpecker/forgejo.yaml rename charts/{ => _deprecated}/forgejo/.helmignore (100%) rename charts/{ => _deprecated}/forgejo/Chart.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/_helpers.tpl (100%) rename charts/{ => _deprecated}/forgejo/templates/ingress.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/pvc.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/secret.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/service.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/serviceaccount.yaml (100%) rename charts/{ => _deprecated}/forgejo/templates/statefulset.yaml (100%) rename charts/{ => _deprecated}/forgejo/values.yaml (100%) create mode 100644 charts/mealie/.helmignore create mode 100644 charts/mealie/Chart.yaml create mode 100644 charts/mealie/templates/_helpers.tpl create mode 100644 charts/mealie/templates/deployment.yaml create mode 100644 charts/mealie/templates/ingress.yaml create mode 100644 charts/mealie/templates/pvc.yaml create mode 100644 charts/mealie/templates/service.yaml create mode 100644 charts/mealie/values.yaml diff --git a/.woodpecker/forgejo.yaml b/.woodpecker/forgejo.yaml deleted file mode 100644 index 25302f6..0000000 --- a/.woodpecker/forgejo.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -when: - path: "charts/forgejo/**" - branch: main -steps: - package: - image: "docker.io/alpine/helm:latest" - secrets: [helm_user, helm_password, helm_repo] - commands: - - helm plugin install https://github.com/chartmuseum/helm-push - - helm repo add therepo $HELM_REPO --username $HELM_USER --password $HELM_PASSWORD - - helm cm-push charts/forgejo therepo diff --git a/charts/forgejo/.helmignore b/charts/_deprecated/forgejo/.helmignore similarity index 100% rename from charts/forgejo/.helmignore rename to charts/_deprecated/forgejo/.helmignore diff --git a/charts/forgejo/Chart.yaml b/charts/_deprecated/forgejo/Chart.yaml similarity index 100% rename from charts/forgejo/Chart.yaml rename to charts/_deprecated/forgejo/Chart.yaml diff --git a/charts/forgejo/templates/_helpers.tpl b/charts/_deprecated/forgejo/templates/_helpers.tpl similarity index 100% rename from charts/forgejo/templates/_helpers.tpl rename to charts/_deprecated/forgejo/templates/_helpers.tpl diff --git a/charts/forgejo/templates/ingress.yaml b/charts/_deprecated/forgejo/templates/ingress.yaml similarity index 100% rename from charts/forgejo/templates/ingress.yaml rename to charts/_deprecated/forgejo/templates/ingress.yaml diff --git a/charts/forgejo/templates/pvc.yaml b/charts/_deprecated/forgejo/templates/pvc.yaml similarity index 100% rename from charts/forgejo/templates/pvc.yaml rename to charts/_deprecated/forgejo/templates/pvc.yaml diff --git a/charts/forgejo/templates/secret.yaml b/charts/_deprecated/forgejo/templates/secret.yaml similarity index 100% rename from charts/forgejo/templates/secret.yaml rename to charts/_deprecated/forgejo/templates/secret.yaml diff --git a/charts/forgejo/templates/service.yaml b/charts/_deprecated/forgejo/templates/service.yaml similarity index 100% rename from charts/forgejo/templates/service.yaml rename to charts/_deprecated/forgejo/templates/service.yaml diff --git a/charts/forgejo/templates/serviceaccount.yaml b/charts/_deprecated/forgejo/templates/serviceaccount.yaml similarity index 100% rename from charts/forgejo/templates/serviceaccount.yaml rename to charts/_deprecated/forgejo/templates/serviceaccount.yaml diff --git a/charts/forgejo/templates/statefulset.yaml b/charts/_deprecated/forgejo/templates/statefulset.yaml similarity index 100% rename from charts/forgejo/templates/statefulset.yaml rename to charts/_deprecated/forgejo/templates/statefulset.yaml diff --git a/charts/forgejo/values.yaml b/charts/_deprecated/forgejo/values.yaml similarity index 100% rename from charts/forgejo/values.yaml rename to charts/_deprecated/forgejo/values.yaml diff --git a/charts/mealie/.helmignore b/charts/mealie/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/mealie/.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/mealie/Chart.yaml b/charts/mealie/Chart.yaml new file mode 100644 index 0000000..1fe288c --- /dev/null +++ b/charts/mealie/Chart.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v2 +name: mealie +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "v1.10.1" diff --git a/charts/mealie/templates/_helpers.tpl b/charts/mealie/templates/_helpers.tpl new file mode 100644 index 0000000..2b6cada --- /dev/null +++ b/charts/mealie/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "mealie.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 "mealie.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 "mealie.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "mealie.labels" -}} +helm.sh/chart: {{ include "mealie.chart" . }} +{{ include "mealie.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "mealie.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mealie.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "mealie.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "mealie.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/mealie/templates/deployment.yaml b/charts/mealie/templates/deployment.yaml new file mode 100644 index 0000000..6fb9a21 --- /dev/null +++ b/charts/mealie/templates/deployment.yaml @@ -0,0 +1,66 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "mealie.fullname" . }} + labels: + {{- include "mealie.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "mealie.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "mealie.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 }} + ports: + - name: http + containerPort: 9091 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /app/data/ + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ include "mealie.fullname" . }} diff --git a/charts/mealie/templates/ingress.yaml b/charts/mealie/templates/ingress.yaml new file mode 100644 index 0000000..9555c93 --- /dev/null +++ b/charts/mealie/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "mealie.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 "mealie.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/mealie/templates/pvc.yaml b/charts/mealie/templates/pvc.yaml new file mode 100644 index 0000000..d0b02e0 --- /dev/null +++ b/charts/mealie/templates/pvc.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "mealie.fullname" . }} + labels: + {{- include "mealie.labels" . | nindent 4 }} + annotations: + helm.sh/resource-policy: "keep" +spec: + accessModes: + - ReadWriteOnce + storageClassName: {{ .Values.pvc.storageClassName | quote }} + resources: + requests: + storage: {{ .Values.pvc.storage | quote }} diff --git a/charts/mealie/templates/service.yaml b/charts/mealie/templates/service.yaml new file mode 100644 index 0000000..ec08a20 --- /dev/null +++ b/charts/mealie/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mealie.fullname" . }} + labels: + {{- include "mealie.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "mealie.selectorLabels" . | nindent 4 }} diff --git a/charts/mealie/values.yaml b/charts/mealie/values.yaml new file mode 100644 index 0000000..0f7122f --- /dev/null +++ b/charts/mealie/values.yaml @@ -0,0 +1,67 @@ +--- +replicaCount: 1 + +image: + repository: ghcr.io/mealie-recipes/mealie + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +pvc: + storageClassName: "" + storage: 1Gi