diff --git a/charts/base-cluster/templates/global/helmRepositories.yaml b/charts/base-cluster/templates/global/helmRepositories.yaml index 1a070bdef6..3379f47032 100644 --- a/charts/base-cluster/templates/global/helmRepositories.yaml +++ b/charts/base-cluster/templates/global/helmRepositories.yaml @@ -1,47 +1 @@ -{{- range $name, $config := .Values.global.helmRepositories }} - {{- $create := true -}} - {{- if $config.condition -}} - {{- $create = eq (include "common.tplvalues.render" (dict "value" $config.condition "context" (deepCopy $))) "true" -}} - {{- end -}} - {{- if $create -}} - {{- if eq ($config.type | default "helm") "helm" }} -apiVersion: source.toolkit.fluxcd.io/v1 -kind: HelmRepository -metadata: - name: {{ $name | quote }} - namespace: {{ $.Release.Namespace }} - labels: {{- include "common.labels.standard" $ | nindent 4 }} -spec: - interval: {{ $config.interval | default "5m" }} - url: {{ $config.url }} - {{- if $config.url | hasPrefix "oci://" }} - type: oci - {{- end }} ---- - {{ else -}} - {{- range $chartName, $chartConfig := $config.charts -}} -apiVersion: source.toolkit.fluxcd.io/v1 -kind: GitRepository -metadata: - name: {{ printf "%s-%s" $name $chartName | quote }} - namespace: {{ $.Release.Namespace }} - labels: {{- include "common.labels.standard" $ | nindent 4 }} -spec: - interval: {{ $chartConfig.interval | default "5m" }} - url: {{ $config.url }} - {{- $refOptions := (list "branch" "commit" "semver" "tag") -}} - {{- $ref := (list nil) | first -}} - {{- range $refName := $refOptions -}} - {{- $value := dig $refName nil $chartConfig -}} - {{- if $value -}} - {{- $ref = dict $refName $value -}} - {{- end -}} - {{- end }} - {{- if $ref }} - ref: {{- toYaml $ref | nindent 4 }} - {{- end }} ---- - {{ end -}} - {{- end -}} - {{- end -}} -{{- end -}} +{{- include "common.helm.repositories" (dict "context" .) -}} diff --git a/charts/base-cluster/values.schema.json b/charts/base-cluster/values.schema.json index 6ae5d46ad8..c1d4a30f70 100644 --- a/charts/base-cluster/values.schema.json +++ b/charts/base-cluster/values.schema.json @@ -178,178 +178,7 @@ "additionalProperties": false }, "helmRepositories": { - "type": "object", - "description": "A map of helmRepositories to create, the key is the name", - "additionalProperties": { - "type": "object", - "properties": { - "url": { - "type": "string", - "pattern": "(https|oci)://.+" - }, - "interval": { - "type": "string", - "description": "The interval in which to update the repository", - "pattern": "[0-9]+[mhd]" - }, - "condition": { - "$ref": "#/$defs/condition" - }, - "charts": { - "type": "object", - "description": "Which charts are deployed in which version using this repo, used internally", - "additionalProperties": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "branch": { - "type": "string" - }, - "commit": { - "type": "string" - }, - "semver": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "path": { - "type": "string", - "description": "Path of the chart in the repository" - }, - "interval": { - "type": "string", - "description": "The interval in which to update the repository", - "pattern": "[0-9]+[mhd]" - } - }, - "oneOf": [ - { - "required": [ - "branch" - ] - }, - { - "required": [ - "commit" - ] - }, - { - "required": [ - "semver" - ] - }, - { - "required": [ - "tag" - ] - }, - { - "not": { - "anyOf": [ - { - "required": [ - "branch" - ] - }, - { - "required": [ - "commit" - ] - }, - { - "required": [ - "semver" - ] - }, - { - "required": [ - "tag" - ] - } - ] - } - } - ], - "additionalProperties": false - } - ] - } - }, - "type": { - "type": "string", - "enum": [ - "git", - "helm" - ], - "default": "helm" - } - }, - "oneOf": [ - { - "properties": { - "url": { - "type": "string", - "pattern": "(https|oci)://.+" - }, - "charts": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "oneOf": [ - { - "not": { - "required": [ - "type" - ] - } - }, - { - "properties": { - "type": { - "const": "helm" - } - }, - "required": [ - "type" - ] - } - ] - }, - { - "properties": { - "url": { - "type": "string", - "pattern": "https://.+" - }, - "type": { - "const": "git" - } - }, - "not": { - "required": [ - "interval" - ] - }, - "required": [ - "charts", - "type" - ] - } - ], - "additionalProperties": false, - "required": [ - "url" - ] - } + "$ref": "https://raw.githubusercontent.com/teutonet/teutonet-helm-charts/main/charts/common/values.schema.json#/$defs/helmRepositories" }, "certificates": { "type": "object", @@ -1800,12 +1629,7 @@ "pattern": "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])" }, "condition": { - "type": "string", - "description": "A condition with which to decide to include the resource. This will be templated. Must return the literal `true`, truthy values don't work.", - "examples": [ - "{{ true }}", - "{{ eq .Values.global.baseDomain \"teuto.net\" }}" - ] + "$ref": "https://raw.githubusercontent.com/teutonet/teutonet-helm-charts/main/charts/common/values.schema.json#/$defs/condition" }, "targetNamespaces": { "description": "The namespaces to sync the secret into, or `ALL` for all namespaces",