diff --git a/community/distribution/1.0.0/Chart.lock b/community/distribution/1.0.0/Chart.lock new file mode 100644 index 0000000000..cba621714b --- /dev/null +++ b/community/distribution/1.0.0/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-10-13T16:50:15.984718282+03:00" diff --git a/community/distribution/1.0.0/Chart.yaml b/community/distribution/1.0.0/Chart.yaml new file mode 100644 index 0000000000..a1fa3ff9f0 --- /dev/null +++ b/community/distribution/1.0.0/Chart.yaml @@ -0,0 +1,27 @@ +name: distribution +description: Distribution is a toolkit to pack, ship, store, and deliver container content +annotations: + title: Distribution +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 2.8.3 +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/distribution/distribution +icon: https://media.sys.truenas.net/apps/distribution/icons/icon.svg +sources: + - https://hub.docker.com/_/registry + - https://distribution.github.io/distribution/ + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/distribution + - https://github.com/distribution/distribution +keywords: + - container + - registry diff --git a/community/distribution/1.0.0/README.md b/community/distribution/1.0.0/README.md new file mode 100644 index 0000000000..036e752d9d --- /dev/null +++ b/community/distribution/1.0.0/README.md @@ -0,0 +1,8 @@ +# Distribution + +[Distribution](https://github.com/distribution/distribution) is a toolkit to pack, ship, store, and deliver container content + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Distribution` directories. +> Afterward, the `Distribution` 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/community/distribution/1.0.0/app-readme.md b/community/distribution/1.0.0/app-readme.md new file mode 100644 index 0000000000..036e752d9d --- /dev/null +++ b/community/distribution/1.0.0/app-readme.md @@ -0,0 +1,8 @@ +# Distribution + +[Distribution](https://github.com/distribution/distribution) is a toolkit to pack, ship, store, and deliver container content + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Distribution` directories. +> Afterward, the `Distribution` 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/community/distribution/1.0.0/charts/common-1.1.1.tgz b/community/distribution/1.0.0/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..6816ec11f4 Binary files /dev/null and b/community/distribution/1.0.0/charts/common-1.1.1.tgz differ diff --git a/community/distribution/1.0.0/ci/basic-values.yaml b/community/distribution/1.0.0/ci/basic-values.yaml new file mode 100644 index 0000000000..0f70830153 --- /dev/null +++ b/community/distribution/1.0.0/ci/basic-values.yaml @@ -0,0 +1,10 @@ +distributionNetwork: + apiPort: 31000 + +distributionRunAs: + user: 1000 + group: 1000 + +distributionStorage: + data: + type: pvc diff --git a/community/distribution/1.0.0/ci/extra-values.yaml b/community/distribution/1.0.0/ci/extra-values.yaml new file mode 100644 index 0000000000..7b00441f49 --- /dev/null +++ b/community/distribution/1.0.0/ci/extra-values.yaml @@ -0,0 +1,18 @@ +distributionNetwork: + apiPort: 31000 + +distributionConfig: + basicAuthUsers: + - user: admin + pass: admin + - user: user + pass: user + +distributionStorage: + data: + type: pvc + additionalStorages: + - type: pvc + mountPath: /data1 + - type: pvc + mountPath: /data2 diff --git a/community/distribution/1.0.0/ci/hostNet-values.yaml b/community/distribution/1.0.0/ci/hostNet-values.yaml new file mode 100644 index 0000000000..257680868b --- /dev/null +++ b/community/distribution/1.0.0/ci/hostNet-values.yaml @@ -0,0 +1,7 @@ +distributionNetwork: + apiPort: 30000 + hostNetwork: true + +distributionStorage: + data: + type: pvc diff --git a/community/distribution/1.0.0/ci/https-values.yaml b/community/distribution/1.0.0/ci/https-values.yaml new file mode 100644 index 0000000000..11e128b28d --- /dev/null +++ b/community/distribution/1.0.0/ci/https-values.yaml @@ -0,0 +1,93 @@ +distributionNetwork: + apiPort: 31000 + certificateID: 1 + +distributionStorage: + data: + type: pvc + +ixCertificates: + "1": + certificate: | + -----BEGIN CERTIFICATE----- + MIIEdjCCA16gAwIBAgIDYFMYMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz + ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD + VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w + HhcNMjEwODMwMjMyMzU0WhcNMjMxMjAzMjMyMzU0WjBuMQswCQYDVQQDDAJhZDEL + MAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxDTALBgNVBAcMBGFzZGYxDTALBgNV + BAoMBGFkc2YxDTALBgNVBAsMBGFzZGYxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w + ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7+1xOHRQyOnQTHFcrdasX + Zl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/AbkH7oVFWC1 + P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI4vQCdYgW + 2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2dNgsxKU0H + PGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB+Zie331t + AzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7A/FuDVg3 + AgMBAAGjggEdMIIBGTAnBgNVHREEIDAehwTAqAADhwTAqAAFhwTAqAC2hwTAqACB + hwTAqACSMB0GA1UdDgQWBBQ4G2ff4tgZl4vmo4xCfqmJhdqShzAMBgNVHRMBAf8E + AjAAMIGYBgNVHSMEgZAwgY2AFLlYf9L99nxJDcpCM/LT3V5h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Fq0uqcZLu4Mdo0CPs4e5sHRyldEnRSKh0DVLprq9zr/GMipmPLJUsT5Jed3sj0w + M7Y3vwxshpo= + -----END CERTIFICATE----- + privatekey: | + -----BEGIN PRIVATE KEY----- + MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC7+1xOHRQyOnQT + HFcrdasXZl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/Abk + H7oVFWC1P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI + 4vQCdYgW2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2d + NgsxKU0HPGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB + +Zie331tAzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7 + A/FuDVg3AgMBAAECggEAapt30rj9DitGTtxAt13pJMEhyYxvvD3WkvmJwguF/Bbu + eW0Ba1c668fMeRCA54FWi1sMqusPS4HUqqUvk+tmyAOsAF4qgD/A4MMSC7uJSVI5 + N/JWhJWyhCY94/FPakiO1nbPbVw41bcqtzU2qvparpME2CtxSCbDiqm7aaag3Kqe + EF0fGSUdZ+TYl9JM05+eIyiX+UY19Fg0OjTHMn8nGpxcNTfDBdQ68TKvdo/dtIKL + PLKzJUNNdM8odC4CvQtfGMqaslwZwXkiOl5VJcW21ncj/Y0ngEMKeD/i65ZoqGdR + 0FKCQYEAGtM2FvJcZQ92Wsw7yj2bK2MSegVUyLK32QKBgQDe8syVCepPzRsfjfxA + 6TZlWcGuTZLhwIx97Ktw3VcQ1f4rLoEYlv0xC2VWBORpzIsJo4I/OLmgp8a+Ga8z + FkVRnq90dV3t4NP9uJlHgcODHnOardC2UUka4olBSCG6zmK4Jxi34lOxhGRkshOo + L4IBeOIB5g+ZrEEXkzfYJHESRQKBgQDX2YhFhGIrT8BAnC5BbXbhm8h6Bhjz8DYL + d+qhVJjef7L/aJxViU0hX9Ba2O8CLK3FZeREFE3hJPiJ4TZSlN4evxs5p+bbNDcA + 0mhRI/o3X4ac6IxdRebyYnCOB/Cu94/MzppcZcotlCekKNike7eorCcX4Qavm7Pu + MUuQ+ifmSwKBgEnchoqZzlbBzMqXb4rRuIO7SL9GU/MWp3TQg7vQmJerTZlgvsQ2 + wYsOC3SECmhCq4117iCj2luvOdihCboTFsQDnn0mpQe6BIF6Ns3J38wAuqv0CcFd + DKsrge1uyD3rQilgSoAhKzkUc24o0PpXQurZ8YZPgbuXpbj5vPaOnCdBAoGACYc7 + wb3XS4wos3FxhUfcwJbM4b4VKeeHqzfu7pI6cU/3ydiHVitKcVe2bdw3qMPqI9Wc + nvi6e17Tbdq4OCsEJx1OiVwFD9YdO3cOTc6lw/3+hjypvZBRYo+/4jUthbu96E+S + dtOzehGZMmDvN0uSzupSi3ZOgkAAUFpyuIKickMCgYAId0PCRjonO2thn/R0rZ7P + //L852uyzYhXKw5/fjFGhQ6LbaLgIRFaCZ0L2809u0HFnNvJjHv4AKP6j+vFQYYY + qQ+66XnfsA9G/bu4MDS9AX83iahD9IdLXQAy8I19prAbpVumKegPbMnNYNB/TYEc + 3G15AKCXo7jjOUtHY01DCQ== + -----END PRIVATE KEY----- diff --git a/community/distribution/1.0.0/ix_values.yaml b/community/distribution/1.0.0/ix_values.yaml new file mode 100644 index 0000000000..02e16daf10 --- /dev/null +++ b/community/distribution/1.0.0/ix_values.yaml @@ -0,0 +1,29 @@ +image: + repository: registry + pullPolicy: IfNotPresent + tag: 2.8.3 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +distributionConfig: + basicAuthUsers: [] + additionalEnvs: [] + +distributionNetwork: + apiPort: 30095 + certificateID: + hostNetwork: false + +distributionRunAs: + user: 568 + group: 568 + +distributionStorage: + useFilesystemBackend: true + data: + type: ixVolume + datasetName: data + additionalStorages: [] diff --git a/community/distribution/1.0.0/metadata.yaml b/community/distribution/1.0.0/metadata.yaml new file mode 100644 index 0000000000..d66c056b4b --- /dev/null +++ b/community/distribution/1.0.0/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: distribution + groupName: distribution + gid: 568 + uid: 568 + description: Distribution can run as any non-root user. +capabilities: [] +hostMounts: [] diff --git a/community/distribution/1.0.0/questions.yaml b/community/distribution/1.0.0/questions.yaml new file mode 100644 index 0000000000..5a68db9521 --- /dev/null +++ b/community/distribution/1.0.0/questions.yaml @@ -0,0 +1,267 @@ +groups: + - name: Distribution Configuration + description: Configure Distribution + - name: User and Group Configuration + description: Configure User and Group for Distribution + - name: Network Configuration + description: Configure Network for Distribution + - name: Storage Configuration + description: Configure Storage for Distribution + - name: Resources Configuration + description: Configure Resources for Distribution + +questions: + - variable: distributionConfig + label: "" + group: Distribution Configuration + schema: + type: dict + attrs: + - variable: basicAuthUsers + label: Basic Auth Users + description: | + Configure basic auth users for Distribution.
+ Leave empty to disable basic auth. + schema: + type: list + default: [] + items: + - variable: userEntry + label: User Entry + schema: + type: dict + attrs: + - variable: user + label: Username + schema: + type: string + required: true + - variable: pass + label: Password + schema: + type: string + required: true + private: true + + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Distribution. + 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: distributionRunAs + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that Distribution will run as. + schema: + type: int + min: 2 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Distribution will run as. + schema: + type: int + min: 2 + default: 568 + required: true + + - variable: distributionNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: apiPort + label: API Port + description: The port for the Distribution API. + schema: + type: int + default: 30095 + min: 9000 + max: 65535 + required: true + - variable: certificateID + label: Certificate + description: The certificate to use for Distribution. + schema: + type: int + "null": true + $ref: + - "definitions/certificate" + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network. It's recommended to keep this disabled.
+ schema: + type: boolean + default: false + + - variable: distributionStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: useFilesystemBackend + label: Use Filesystem Backend + description: | + Use filesystem backend for Distribution.
+ If disabled, you will need to configure a backend for Distribution.
+ Either with environment variables or with a configuration file. + schema: + type: boolean + default: true + - variable: data + label: Distribution Data Storage + description: The path to store Distribution data. + schema: + type: dict + show_if: [["useFilesystemBackend", "=", true]] + 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: data + $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 Distribution. + 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 Distribution. + 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 Distribution. + 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/community/distribution/1.0.0/templates/NOTES.txt b/community/distribution/1.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/community/distribution/1.0.0/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/community/distribution/1.0.0/templates/_configuration.tpl b/community/distribution/1.0.0/templates/_configuration.tpl new file mode 100644 index 0000000000..c732c5c5a4 --- /dev/null +++ b/community/distribution/1.0.0/templates/_configuration.tpl @@ -0,0 +1,41 @@ +{{- define "distribution.configuration" -}} +{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}} + +{{- $secretKey := randAlphaNum 32 -}} +{{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-distribution" $fullname)) -}} + {{- $secretKey = ((index .data "REGISTRY_HTTP_SECRET") | b64dec) -}} +{{- end }} + +configmap: + distribution-config: + enabled: true + data: + REGISTRY_HTTP_ADDR: {{ printf "0.0.0.0:%v" .Values.distributionNetwork.apiPort }} + {{- if .Values.distributionStorage.useFilesystemBackend }} + REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /var/lib/registry + {{- end -}} + {{- if .Values.distributionNetwork.certificateID }} + REGISTRY_HTTP_TLS_CERTIFICATE: /certs/tls.crt + REGISTRY_HTTP_TLS_KEY: /certs/tls.key + {{- end -}} + {{- if .Values.distributionConfig.basicAuthUsers }} + REGISTRY_AUTH_HTPASSWD_REALM: basic-realm + REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd + {{- end }} + +secret: + distribution-creds: + enabled: true + data: + REGISTRY_HTTP_SECRET: {{ $secretKey }} + + {{- if .Values.distributionConfig.basicAuthUsers }} + distribution-htpasswd: + enabled: true + data: + htpasswd: | + {{- range $idx, $v := .Values.distributionConfig.basicAuthUsers }} + {{- htpasswd $v.user $v.pass | nindent 8 }} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/community/distribution/1.0.0/templates/_distribution.tpl b/community/distribution/1.0.0/templates/_distribution.tpl new file mode 100644 index 0000000000..38d5d49131 --- /dev/null +++ b/community/distribution/1.0.0/templates/_distribution.tpl @@ -0,0 +1,55 @@ +{{- define "distribution.workload" -}} +workload: + distribution: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.distributionNetwork.hostNetwork }} + containers: + distribution: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: {{ .Values.distributionRunAs.user }} + runAsGroup: {{ .Values.distributionRunAs.group }} + envFrom: + - secretRef: + name: distribution-creds + - configMapRef: + name: distribution-config + {{ with .Values.distributionConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + {{- $protocol := "http" -}} + {{- if .Values.distributionNetwork.certificateID -}} + {{- $protocol = "https" -}} + {{- end }} + liveness: + enabled: true + type: {{ $protocol }} + port: {{ .Values.distributionNetwork.apiPort }} + path: / + readiness: + enabled: true + type: {{ $protocol }} + port: {{ .Values.distributionNetwork.apiPort }} + path: / + startup: + enabled: true + type: {{ $protocol }} + port: {{ .Values.distributionNetwork.apiPort }} + path: / + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" .Values.distributionRunAs.user + "GID" .Values.distributionRunAs.group + "mode" "check" + "type" "init") | nindent 8 }} +{{- end -}} diff --git a/community/distribution/1.0.0/templates/_persistence.tpl b/community/distribution/1.0.0/templates/_persistence.tpl new file mode 100644 index 0000000000..19554c959f --- /dev/null +++ b/community/distribution/1.0.0/templates/_persistence.tpl @@ -0,0 +1,77 @@ +{{- define "distribution.persistence" -}} +persistence: + {{- if .Values.distributionStorage.useFilesystemBackend }} + data: + enabled: true + type: {{ .Values.distributionStorage.data.type }} + datasetName: {{ .Values.distributionStorage.data.datasetName | default "" }} + hostPath: {{ .Values.distributionStorage.data.hostPath | default "" }} + targetSelector: + distribution: + distribution: + mountPath: /var/lib/registry + 01-permissions: + mountPath: /mnt/directories/registry + {{- end }} + + tmp: + enabled: true + type: emptyDir + targetSelector: + distribution: + distribution: + mountPath: /tmp + {{- range $idx, $storage := .Values.distributionStorage.additionalStorages }} + {{ printf "distribution-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + distribution: + distribution: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end -}} + + {{- if .Values.distributionConfig.basicAuthUsers }} + htpasswd: + enabled: true + type: secret + objectName: distribution-htpasswd + defaultMode: "0600" + items: + - key: htpasswd + path: htpasswd + targetSelector: + distribution: + distribution: + mountPath: /auth + readOnly: true + {{- end -}} + + {{- if .Values.distributionNetwork.certificateID }} + cert: + enabled: true + type: secret + objectName: distribution-cert + defaultMode: "0600" + items: + - key: tls.key + path: tls.key + - key: tls.crt + path: tls.crt + targetSelector: + distribution: + distribution: + mountPath: /certs + readOnly: true + +scaleCertificate: + distribution-cert: + enabled: true + id: {{ .Values.distributionNetwork.certificateID }} + {{- end -}} + +{{- end -}} diff --git a/community/distribution/1.0.0/templates/_service.tpl b/community/distribution/1.0.0/templates/_service.tpl new file mode 100644 index 0000000000..ab2998f1b8 --- /dev/null +++ b/community/distribution/1.0.0/templates/_service.tpl @@ -0,0 +1,15 @@ +{{- define "distribution.service" -}} +service: + distribution: + enabled: true + primary: true + type: NodePort + targetSelector: distribution + ports: + api: + enabled: true + primary: true + port: {{ .Values.distributionNetwork.apiPort }} + nodePort: {{ .Values.distributionNetwork.apiPort }} + targetSelector: distribution +{{- end -}} diff --git a/community/distribution/1.0.0/templates/common.yaml b/community/distribution/1.0.0/templates/common.yaml new file mode 100644 index 0000000000..a57a53ab9c --- /dev/null +++ b/community/distribution/1.0.0/templates/common.yaml @@ -0,0 +1,9 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "distribution.configuration" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "distribution.persistence" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "distribution.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "distribution.workload" $ | fromYaml) -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/community/distribution/item.yaml b/community/distribution/item.yaml new file mode 100644 index 0000000000..d218110e0d --- /dev/null +++ b/community/distribution/item.yaml @@ -0,0 +1,7 @@ +icon_url: https://media.sys.truenas.net/apps/distribution/icons/icon.svg +categories: + - productivity +screenshots: [] +tags: + - registry + - container