Files
charts/library/ix-dev/community/ddns-updater/templates/_validation.tpl
T
Stavros Kois bfc29a2718 NAS-119346 / 23.10 / Add ddns-updater to community (#1176)
* initial commit

* add common

* add portal

* add readmes

* add initial files

* add some config

* finish providers

* add some custom values

* add first 2 providers

* add some ci tests

* fix typo

* fix generation

* add aliyun

* add allinkl

* add ddnss

* Add digital ocean

* update some tests

* add dnsomatic

* add shoutrrr adresses list

* add dnspod

* add dnsdominio

* add dreamhost

* add duckdns

* add dyndns

* duny

* add dynv6

* fix test

* add freedns

* fix test

* fix another test

* add gandi

* add gcp

* add godaddy

* add google

* add he.net

* update he

* add infomaniak

* add inwx

* fix dyndns

* add linode

* add luadns

* add namecheap

* add njalla

* add noip

* fix godaddy test

* add opendns

* add porkbun

* add selfhosted.de

* add servercow

* hmm

* add strato

* add variomedia

* add spdyn

* remove shourrr

* add ovh

* typo

* update customvalues test

* add a check

* remove test

* fix test

* add extra value to test

* comment for now

* update comment

* comment all

* ci...

* no notifications

* disable all custom for now

* hmm

* fix typo in selfhost.de and move some tests out temporary

* fix some tsts

* add custom back and with few options

* rename file

* tests

* fix envList

* add metadata

* add more validation and fix questions

* test diff user

* latest release should fix this test

* disable strategy

* bump common
2023-05-09 16:49:20 +03:00

57 lines
2.5 KiB
Smarty

{{- define "ddns.validation" -}}
{{- include "ddns.validatePublicIpProviders" (dict "text" "Public IP DNS Providers"
"list" .Values.ddnsConfig.publicIpDnsProviders
"valid" (list "all" "cloudflare" "google")) -}}
{{- include "ddns.validatePublicIpProviders" (dict "text" "Public IP HTTP Providers"
"list" .Values.ddnsConfig.publicIpHttpProviders
"valid" (list "all" "custom" "opendns" "ifconfig" "ipinfo" "ddnss" "google")) -}}
{{- include "ddns.validatePublicIpProviders" (dict "text" "Public IPv4 HTTP Providers"
"list" .Values.ddnsConfig.publicIpv4HttpProviders
"valid" (list "all" "custom" "ipify" "noip")) -}}
{{- include "ddns.validatePublicIpProviders" (dict "text" "Public IPv6 HTTP Providers"
"list" .Values.ddnsConfig.publicIpv6HttpProviders
"valid" (list "all" "custom" "ipify" "noip")) -}}
{{- include "ddns.validatePublicIpProviders" (dict "text" "Public IP Fetchers"
"list" .Values.ddnsConfig.publicIpFetchers
"valid" (list "all" "http" "dns")) -}}
{{- end -}}
{{- define "ddns.validatePublicIpProviders" -}}
{{- $text := .text -}}
{{- $list := .list -}}
{{- $valid := .valid -}}
{{- $type := .type -}}
{{- if not $list -}}
{{- fail (printf "DDNS Updater - Expected non-empty [%v]" $text) -}}
{{- end -}}
{{- $userProviders := list -}}
{{- range $list -}}
{{- if mustHas .provider $userProviders -}}
{{- fail (printf "DDNS Updater - Expected unique values in [%v], but got [%v] more than once" $text .provider) -}}
{{- end -}}
{{- $userProviders = mustAppend $userProviders .provider -}}
{{- if not (mustHas .provider $valid) -}}
{{- fail (printf "DDNS Updater - [%v] valid values are [%v], but got [%v]" $text (join ", " $valid) .provider) -}}
{{- end -}}
{{- if eq .provider "all" -}}
{{- if ne (len $list) 1 -}}
{{- fail (printf "DDNS Updater - [%v] cannot contain other values when [all] is selected" $text) -}}
{{- end -}}
{{- end -}}
{{- if eq .provider "custom" -}}
{{- if not .custom -}}
{{- fail (printf "DDNS Updater - [%v] expected non-empty [Custom Value]" $text) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}