diff --git a/library/ix-dev/community/homer/Chart.lock b/library/ix-dev/community/homer/Chart.lock new file mode 100644 index 0000000000..77a2078c35 --- /dev/null +++ b/library/ix-dev/community/homer/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-10-10T16:12:08.426497312+03:00" diff --git a/library/ix-dev/community/homer/Chart.yaml b/library/ix-dev/community/homer/Chart.yaml new file mode 100644 index 0000000000..2b77ab186c --- /dev/null +++ b/library/ix-dev/community/homer/Chart.yaml @@ -0,0 +1,26 @@ +name: homer +description: Homer is a dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. +annotations: + title: Homer +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: v23.09.1 +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.1.1 +home: https://github.com/bastienwirtz/homer +icon: https://raw.githubusercontent.com//bastienwirtz/homer/main/public/logo.png +sources: + - https://hub.docker.com/r/b4bz/homer + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/homer + - https://github.com/bastienwirtz/homer +keywords: + - dashboard + - homepage diff --git a/library/ix-dev/community/homer/README.md b/library/ix-dev/community/homer/README.md new file mode 100644 index 0000000000..d22483d47d --- /dev/null +++ b/library/ix-dev/community/homer/README.md @@ -0,0 +1,8 @@ +# Homer + +[Homer](https://github.com/bastienwirtz/homer) is a dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Homer` directories. +> Afterward, the `Homer` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. diff --git a/library/ix-dev/community/homer/app-readme.md b/library/ix-dev/community/homer/app-readme.md new file mode 100644 index 0000000000..d22483d47d --- /dev/null +++ b/library/ix-dev/community/homer/app-readme.md @@ -0,0 +1,8 @@ +# Homer + +[Homer](https://github.com/bastienwirtz/homer) is a dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Homer` directories. +> Afterward, the `Homer` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. diff --git a/library/ix-dev/community/homer/charts/common-1.1.1.tgz b/library/ix-dev/community/homer/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..438e2b6380 Binary files /dev/null and b/library/ix-dev/community/homer/charts/common-1.1.1.tgz differ diff --git a/library/ix-dev/community/homer/ci/basic-values.yaml b/library/ix-dev/community/homer/ci/basic-values.yaml new file mode 100644 index 0000000000..9ab90c0d98 --- /dev/null +++ b/library/ix-dev/community/homer/ci/basic-values.yaml @@ -0,0 +1,10 @@ +homerNetwork: + webPort: 31000 + +homerRunAs: + user: 1000 + group: 1000 + +homerStorage: + assets: + type: pvc diff --git a/library/ix-dev/community/homer/ci/extra-values.yaml b/library/ix-dev/community/homer/ci/extra-values.yaml new file mode 100644 index 0000000000..a84b9c60be --- /dev/null +++ b/library/ix-dev/community/homer/ci/extra-values.yaml @@ -0,0 +1,14 @@ +homerConfig: + initAssets: true + +homerNetwork: + webPort: 31000 + +homerStorage: + assets: + type: pvc + additionalStorages: + - type: pvc + mountPath: /data1 + - type: pvc + mountPath: /data2 diff --git a/library/ix-dev/community/homer/ci/hostNet-values.yaml b/library/ix-dev/community/homer/ci/hostNet-values.yaml new file mode 100644 index 0000000000..25bc9bf1ae --- /dev/null +++ b/library/ix-dev/community/homer/ci/hostNet-values.yaml @@ -0,0 +1,7 @@ +homerNetwork: + webPort: 30000 + hostNetwork: true + +homerStorage: + assets: + type: pvc diff --git a/library/ix-dev/community/homer/item.yaml b/library/ix-dev/community/homer/item.yaml new file mode 100644 index 0000000000..a3f6fbab88 --- /dev/null +++ b/library/ix-dev/community/homer/item.yaml @@ -0,0 +1,8 @@ +icon_url: https://raw.githubusercontent.com//bastienwirtz/homer/main/public/logo.png +categories: + - productivity +screenshots: + - https://camo.githubusercontent.com/22f0b90b2c9ec4f1c9ec9ed920bb7b794bc1f1ac93bf61099ef298369b8850e5/68747470733a2f2f7261772e6769746875622e636f6d2f6261737469656e776972747a2f686f6d65722f6d61696e2f646f63732f73637265656e73686f742e706e67 +tags: + - dashboard + - homepage diff --git a/library/ix-dev/community/homer/metadata.yaml b/library/ix-dev/community/homer/metadata.yaml new file mode 100644 index 0000000000..530df5cd8a --- /dev/null +++ b/library/ix-dev/community/homer/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: homer + groupName: homer + gid: 568 + uid: 568 + description: Homer can run as any non-root user. +capabilities: [] +hostMounts: [] diff --git a/library/ix-dev/community/homer/questions.yaml b/library/ix-dev/community/homer/questions.yaml new file mode 100644 index 0000000000..16f685072d --- /dev/null +++ b/library/ix-dev/community/homer/questions.yaml @@ -0,0 +1,239 @@ +groups: + - name: Homer Configuration + description: Configure Homer + - name: User and Group Configuration + description: Configure User and Group for Homer + - name: Network Configuration + description: Configure Network for Homer + - name: Storage Configuration + description: Configure Storage for Homer + - name: Resources Configuration + description: Configure Resources for Homer + +portals: + web_portal: + protocols: + - "$kubernetes-resource_configmap_portal_protocol" + host: + - "$kubernetes-resource_configmap_portal_host" + ports: + - "$kubernetes-resource_configmap_portal_port" + path: "$kubernetes-resource_configmap_portal_path" + +questions: + - variable: homerConfig + label: "" + group: Homer Configuration + schema: + type: dict + attrs: + - variable: initAssets + label: Init Assets + description: Install example configuration file & assets to help you get started. + schema: + type: boolean + default: false + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Homer. + schema: + type: list + default: [] + items: + - variable: env + label: Environment Variable + schema: + type: dict + attrs: + - variable: name + label: Name + schema: + type: string + required: true + - variable: value + label: Value + schema: + type: string + required: true + + - variable: homerRunAs + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that Homer will run as. + schema: + type: int + min: 2 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Homer will run as. + schema: + type: int + min: 2 + default: 568 + required: true + + - variable: homerNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Homer Web UI. + schema: + type: int + default: 30092 + min: 9000 + max: 65535 + required: true + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network. It's recommended to keep this disabled.
+ schema: + type: boolean + default: false + + - variable: homerStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: assets + label: Homer Assets Storage + description: The path to store Homer Assets. + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system. + schema: + type: string + required: true + default: "ixVolume" + enum: + - value: "hostPath" + description: Host Path (Path that already exists on the system) + - value: "ixVolume" + description: ixVolume (Dataset created automatically by the system) + - variable: datasetName + label: Dataset Name + schema: + type: string + show_if: [["type", "=", "ixVolume"]] + required: true + hidden: true + immutable: true + default: "assets" + $ref: + - "normalize/ixVolume" + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + immutable: true + required: true + - variable: additionalStorages + label: Additional Storage + description: Additional storage for Homer. + schema: + type: list + default: [] + items: + - variable: storageEntry + label: Storage Entry + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system. + schema: + type: string + required: true + default: "ixVolume" + enum: + - value: "hostPath" + description: Host Path (Path that already exists on the system) + - value: "ixVolume" + description: ixVolume (Dataset created automatically by the system) + - variable: mountPath + label: Mount Path + description: The path inside the container to mount the storage. + schema: + type: path + required: true + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + required: true + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + show_if: [["type", "=", "ixVolume"]] + required: true + immutable: true + default: "storage_entry" + $ref: + - "normalize/ixVolume" + + - variable: resources + group: Resources Configuration + label: "" + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for Homer. + schema: + type: string + max_length: 6 + valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$' + valid_chars_error: | + Valid CPU limit formats are
+ - Plain Integer - eg. 1
+ - Float - eg. 0.5
+ - Milicpu - eg. 500m + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Homer. + schema: + type: string + max_length: 12 + valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$' + valid_chars_error: | + Valid Memory limit formats are
+ - Suffixed with E/P/T/G/M/K - eg. 1G
+ - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi
+ - Plain Integer in bytes - eg. 1024
+ - Exponent - eg. 134e6 + default: "8Gi" + required: true diff --git a/library/ix-dev/community/homer/templates/NOTES.txt b/library/ix-dev/community/homer/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/homer/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/homer/templates/_homer.tpl b/library/ix-dev/community/homer/templates/_homer.tpl new file mode 100644 index 0000000000..71f350da2a --- /dev/null +++ b/library/ix-dev/community/homer/templates/_homer.tpl @@ -0,0 +1,49 @@ +{{- define "homer.workload" -}} +workload: + homer: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.homerNetwork.hostNetwork }} + containers: + homer: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: {{ .Values.homerRunAs.user }} + runAsGroup: {{ .Values.homerRunAs.group }} + env: + PORT: {{ .Values.homerNetwork.webPort }} + INIT_ASSETS: {{ ternary "1" "0" .Values.homerConfig.initAssets }} + {{ with .Values.homerConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: {{ .Values.homerNetwork.webPort }} + path: / + readiness: + enabled: true + type: http + port: {{ .Values.homerNetwork.webPort }} + path: / + startup: + enabled: true + type: http + port: {{ .Values.homerNetwork.webPort }} + path: / + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" .Values.homerRunAs.user + "GID" .Values.homerRunAs.group + "mode" "check" + "type" "init") | nindent 8 }} +{{- end -}} diff --git a/library/ix-dev/community/homer/templates/_persistence.tpl b/library/ix-dev/community/homer/templates/_persistence.tpl new file mode 100644 index 0000000000..b5a81a08cf --- /dev/null +++ b/library/ix-dev/community/homer/templates/_persistence.tpl @@ -0,0 +1,34 @@ +{{- define "homer.persistence" -}} +persistence: + assets: + enabled: true + type: {{ .Values.homerStorage.assets.type }} + datasetName: {{ .Values.homerStorage.assets.datasetName | default "" }} + hostPath: {{ .Values.homerStorage.assets.hostPath | default "" }} + targetSelector: + homer: + homer: + mountPath: /www/assets + 01-permissions: + mountPath: /mnt/directories/assets + tmp: + enabled: true + type: emptyDir + targetSelector: + homer: + homer: + mountPath: /tmp + {{- range $idx, $storage := .Values.homerStorage.additionalStorages }} + {{ printf "homer-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + homer: + homer: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/homer/templates/_portal.tpl b/library/ix-dev/community/homer/templates/_portal.tpl new file mode 100644 index 0000000000..004ead7846 --- /dev/null +++ b/library/ix-dev/community/homer/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "homer.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.homerNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/homer/templates/_service.tpl b/library/ix-dev/community/homer/templates/_service.tpl new file mode 100644 index 0000000000..d8f275fbdb --- /dev/null +++ b/library/ix-dev/community/homer/templates/_service.tpl @@ -0,0 +1,15 @@ +{{- define "homer.service" -}} +service: + homer: + enabled: true + primary: true + type: NodePort + targetSelector: homer + ports: + webui: + enabled: true + primary: true + port: {{ .Values.homerNetwork.webPort }} + nodePort: {{ .Values.homerNetwork.webPort }} + targetSelector: homer +{{- end -}} diff --git a/library/ix-dev/community/homer/templates/common.yaml b/library/ix-dev/community/homer/templates/common.yaml new file mode 100644 index 0000000000..fbec244e12 --- /dev/null +++ b/library/ix-dev/community/homer/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "homer.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "homer.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "homer.persistence" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "homer.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/homer/upgrade_info.json b/library/ix-dev/community/homer/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/homer/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/homer/upgrade_strategy b/library/ix-dev/community/homer/upgrade_strategy new file mode 100755 index 0000000000..5718e19a44 --- /dev/null +++ b/library/ix-dev/community/homer/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))) diff --git a/library/ix-dev/community/homer/values.yaml b/library/ix-dev/community/homer/values.yaml new file mode 100644 index 0000000000..b4be927a40 --- /dev/null +++ b/library/ix-dev/community/homer/values.yaml @@ -0,0 +1,27 @@ +image: + repository: b4bz/homer + pullPolicy: IfNotPresent + tag: v23.09.1 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +homerConfig: + initAssets: false + additionalEnvs: [] + +homerNetwork: + webPort: 30092 + hostNetwork: false + +homerRunAs: + user: 568 + group: 568 + +homerStorage: + assets: + type: ixVolume + datasetName: assets + additionalStorages: []