diff --git a/library/ix-dev/community/mealie/Chart.lock b/library/ix-dev/community/mealie/Chart.lock new file mode 100644 index 0000000000..5e26597b51 --- /dev/null +++ b/library/ix-dev/community/mealie/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.2.1 +digest: sha256:d695592ea5213fe64453171205ca326015d02df3888a7858becc0c733b0de4c7 +generated: "2023-11-03T16:04:06.480608072+02:00" diff --git a/library/ix-dev/community/mealie/Chart.yaml b/library/ix-dev/community/mealie/Chart.yaml new file mode 100644 index 0000000000..ccb172e071 --- /dev/null +++ b/library/ix-dev/community/mealie/Chart.yaml @@ -0,0 +1,26 @@ +name: mealie +description: Mealie is a self-hosted recipe manager and meal planner +annotations: + title: Mealie +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: latest +kubeVersion: '>=1.16.0-0' +maintainers: + - name: truenas + url: https://www.truenas.com/ + email: dev@ixsystems.com +dependencies: + - name: common + repository: file://../../../common + version: 1.2.1 +home: https://mealie.io +icon: https://media.sys.truenas.net/apps/mealie/icons/icon.png +sources: + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/mealie + - https://github.com/ndom91/briefkasten + - https://nightly.mealie.io/ +keywords: + - recipes + - meal planner diff --git a/library/ix-dev/community/mealie/charts/common-1.2.1.tgz b/library/ix-dev/community/mealie/charts/common-1.2.1.tgz new file mode 100644 index 0000000000..bca2e62f51 Binary files /dev/null and b/library/ix-dev/community/mealie/charts/common-1.2.1.tgz differ diff --git a/library/ix-dev/community/mealie/item.yaml b/library/ix-dev/community/mealie/item.yaml new file mode 100644 index 0000000000..aead0ef835 --- /dev/null +++ b/library/ix-dev/community/mealie/item.yaml @@ -0,0 +1,8 @@ +icon_url: https://media.sys.truenas.net/apps/mealie/icons/icon.png +categories: + - productivity +screenshots: + - https://media.sys.truenas.net/apps/mealie/screenshots/screenshot1.png +tags: + - recipes + - meal planner diff --git a/library/ix-dev/community/mealie/templates/NOTES.txt b/library/ix-dev/community/mealie/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/mealie/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/mealie/templates/_mealie.tpl b/library/ix-dev/community/mealie/templates/_mealie.tpl new file mode 100644 index 0000000000..6ede46da90 --- /dev/null +++ b/library/ix-dev/community/mealie/templates/_mealie.tpl @@ -0,0 +1,53 @@ +{{- define "mealie.workload" -}} +workload: + mealie: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.mealieNetwork.hostNetwork }} + containers: + mealie: + enabled: true + primary: true + imageSelector: image + securityContext: + # TODO: Check if we can use arbitrary user IDs + runAsUser: 911 + runAsGroup: 911 + readOnlyRootFilesystem: false + envFrom: + - secretRef: + name: mealie + - configMapRef: + name: mealie + {{ with .Values.mealieConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: exec + command: + - python + - /app/mealie/scripts/healthcheck.py + readiness: + enabled: true + type: exec + command: + - python + - /app/mealie/scripts/healthcheck.py + startup: + enabled: true + type: exec + command: + - python + - /app/mealie/scripts/healthcheck.py + initContainers: + {{- include "ix.v1.common.app.postgresWait" (dict "name" "01-postgres-wait" + "secretName" "postgres-creds") | nindent 8 }} +{{- end -}} diff --git a/library/ix-dev/community/mealie/templates/_postgres.tpl b/library/ix-dev/community/mealie/templates/_postgres.tpl new file mode 100644 index 0000000000..0c050b6ca0 --- /dev/null +++ b/library/ix-dev/community/mealie/templates/_postgres.tpl @@ -0,0 +1,6 @@ +{{- define "postgres.workload" -}} +workload: +{{- include "ix.v1.common.app.postgres" (dict "secretName" "postgres-creds" + "resources" .Values.resources + "ixChartContext" .Values.ixChartContext) | nindent 2 }} +{{- end -}} diff --git a/library/ix-dev/community/mealie/templates/_service.tpl b/library/ix-dev/community/mealie/templates/_service.tpl new file mode 100644 index 0000000000..1000d9318f --- /dev/null +++ b/library/ix-dev/community/mealie/templates/_service.tpl @@ -0,0 +1,17 @@ +{{- define "mealie.service" -}} +service: + mealie: + enabled: true + primary: true + type: NodePort + targetSelector: mealie + ports: + webui: + enabled: true + primary: true + port: {{ .Values.mealieNetwork.webPort }} + nodePort: {{ .Values.mealieNetwork.webPort }} + targetSelector: mealie + {{- include "ix.v1.common.app.postgresService" $ | nindent 2 }} + +{{- end -}} diff --git a/library/ix-dev/community/mealie/templates/common.yaml b/library/ix-dev/community/mealie/templates/common.yaml new file mode 100644 index 0000000000..51ebb65fbf --- /dev/null +++ b/library/ix-dev/community/mealie/templates/common.yaml @@ -0,0 +1,13 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "mealie.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "mealie.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "mealie.persistence" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "mealie.configuration" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "postgres.workload" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "mealie.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/mealie/upgrade_info.json b/library/ix-dev/community/mealie/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/mealie/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/mealie/upgrade_strategy b/library/ix-dev/community/mealie/upgrade_strategy new file mode 100755 index 0000000000..5718e19a44 --- /dev/null +++ b/library/ix-dev/community/mealie/upgrade_strategy @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import json +import re +import sys + +from catalog_update.upgrade_strategy import semantic_versioning + + +RE_STABLE_VERSION = re.compile(r'v\d+\.\d+\.\d+') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t.strip('v'): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)} + version = semantic_versioning(list(tags)) + if not version: + return {} + + return { + 'tags': {key: tags[version]}, + 'app_version': version, + } + + +if __name__ == '__main__': + try: + versions_json = json.loads(sys.stdin.read()) + except ValueError: + raise ValueError('Invalid json specified') + + print(json.dumps(newer_mapping(versions_json)))