Skip to content

Commit

Permalink
keep backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur committed Nov 11, 2023
1 parent c4b71e8 commit e00eb22
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
14 changes: 14 additions & 0 deletions charts/external-dns/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,23 @@ The image to use
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }}
{{- end }}


{{/*
Keep backward compatibility on provider
*/}}
{{- define "external-dns.providername" -}}
{{- if eq (typeOf .Values.provider) "string" }}
{{- .Values.provider }}
{{- else }}
{{- .Values.provider.name }}
{{- end }}
{{- end }}

{{/*
The webhook providers
*/}}
{{- define "external-dns.webhook-providers" -}}
{{- if eq (typeOf .Values.provider) "object" }}
{{- $version := default "latest" .Values.provider.version }}
adguard: ghcr.io/muhlba91/external-dns-provider-adguard:{{ $version }}
ionos: ghcr.io/ionos-cloud/external-dns-ionos-webhook:{{ $version }}
Expand All @@ -83,3 +96,4 @@ stackit: ghcr.io/stackitcloud/external-dns-stackit-webhook:{{ $version }}
custom: {{ .Values.provider.image }}:{{ $version }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 3 additions & 2 deletions charts/external-dns/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
{{- $whp := include "external-dns.webhook-providers" . | fromYaml }}
{{- $provider := (hasKey $whp .Values.provider.name) | ternary "webhook" .Values.provider.name }}
{{- $providername := include "external-dns.providername" . }}
{{- $provider := (hasKey $whp $providername) | ternary "webhook" $providername }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -137,7 +138,7 @@ spec:
{{- end }}
{{- if eq $provider "webhook" }}
{{- with .Values.provider }}
- name: {{ .name }}
- name: {{ $providername }}
image: {{ get $whp .name }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with .env }}
Expand Down
8 changes: 0 additions & 8 deletions charts/external-dns/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"provider": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"extraArgs": {
"type": "array",
"items": {
Expand Down

0 comments on commit e00eb22

Please sign in to comment.