feat(cloudflareddns): BREAKING CHANGE - Rewrite GUI (#5995)

* fix(cloudflareddns) validate cf hosts and zones

* add _secrets.tpl and major gui overhaul

* fix _secret.tpl variables

* remove variable from zone variable

* fix zones variable

* fix variable

* make some cchanges

* update regex

* update doc

* whoops

* fix CF_HOSTS variable

* Update charts/stable/cloudflareddns/Chart.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97
2023-01-06 11:39:09 +02:00
committed by GitHub
co-authored by Stavros Kois
parent 996a97e7ad
commit a48faf35a4
6 changed files with 224 additions and 124 deletions
@@ -0,0 +1,40 @@
{{/* Define the secret */}}
{{- define "cloudflareddns.secret" -}}
{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) }}
{{- $cfddns := .Values.cloudflareddns -}}
{{- $domains := list }}
{{- $records := list }}
{{- $zones := list }}
{{- range $item := $cfddns.host_and_record }}
{{- $domains = mustAppend $domains $item.domain }}
{{- $records = mustAppend $records $item.record }}
{{- $zones = mustAppend $zones $item.zone }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
stringData:
{{- with $cfddns.user }}
CF_USER: {{ . | quote }}
{{- end }}
{{- with $cfddns.api_key }}
CF_APIKEY: {{ . | quote }}
{{- end }}
{{- with $cfddns.api_token }}
CF_APITOKEN: {{ . | quote }}
{{- end }}
{{- with $cfddns.api_token_zone }}
CF_APITOKEN_ZONE: {{ . | quote }}
{{- end }}
INTERVAL: {{ $cfddns.interval | quote }}
LOG_LEVEL: {{ $cfddns.log_level | quote }}
DETECTION_MODE: {{ $cfddns.detect_override | default $cfddns.detect_mode | quote }}
CF_ZONES: {{ join ";" $zones | quote }}
CF_HOSTS: {{ join ";" $domains | quote }}
CF_RECORDTYPES: {{ join ";" $records | quote }}
{{- end -}}
@@ -1 +1,8 @@
{{ include "tc.common.loader.all" . }}
{{/* Make sure all variables are set properly */}}
{{- include "tc.common.loader.init" . }}
{{/* Render secret */}}
{{- include "cloudflareddns.secret" . }}
{{/* Render the templates */}}
{{ include "tc.common.loader.apply" . }}