Add support for PowerDNS to external-dns chart (#14793)

- Add pdns-specific parameters to stable/external-dns/values.yaml

- Modify stable/external-dns/templates/secret.yaml to support pdns API
  key as kubernetes secret

- Modify stable/external-dns/templates/deployment.yaml to support args
  and environment variables for pdns

Signed-off-by: Craig Etienne <craig.etienne@gmail.com>
This commit is contained in:
boarder981
2019-07-12 08:29:06 -07:00
committed by Kubernetes Prow Robot
parent 7b19761fcb
commit 6aee54cdaf
7 changed files with 61 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: external-dns
version: 2.2.3
version: 2.3.0
appVersion: 0.5.15
description: ExternalDNS is a Kubernetes addon that configures public DNS servers with information about exposed Kubernetes services to make them discoverable.
keywords:
+3
View File
@@ -95,6 +95,9 @@ The following table lists the configurable parameters of the external-dns chart
| `rfc2136.tsigKeyname` | When using the rfc2136 provider, specify the tsig keyname to enable security (optional) | `"externaldns-key"` |
| `rfc2136.tsigSecretAlg` | When using the rfc2136 provider, specify the tsig secret to enable security (optional) | `"hmac-sha256"` |
| `rfc2136.tsigAxfr` | When using the rfc2136 provider, enable AFXR to enable security (optional) | `true` |
| `pdns.apiUrl` | When using the PowerDNS provider, specify the API URL of the server. | `""` |
| `pdns.apiPort` | When using the PowerDNS provider, specify the API port of the server. | `8081` |
| `pdns.apiKey` | When using the PowerDNS provider, specify the API key of the server. | `""` |
| `annotationFilter` | Filter sources managed by external-dns via annotation using label selector (optional) | `""` |
| `domainFilters` | Limit possible target zones by domain suffixes (optional) | `[]` |
| `zoneIdFilters` | Limit possible target zones by zone id (optional) | `[]` |
@@ -130,6 +130,8 @@ Compile all warnings into a single message, and call fail.
{{- $messages := append $messages (include "external-dns.validateValues.aws" .) -}}
{{- $messages := append $messages (include "external-dns.validateValues.infoblox.gridHost" .) -}}
{{- $messages := append $messages (include "external-dns.validateValues.infoblox.wapiPassword" .) -}}
{{- $messages := append $messages (include "external-dns.validateValues.pdns.apiUrl" .) -}}
{{- $messages := append $messages (include "external-dns.validateValues.pdns.apiKey" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
@@ -201,6 +203,30 @@ external-dns: infoblox.wapiPassword
{{- end -}}
{{- end -}}
{{/*
Validate values of External DNS:
- must provide the PowerDNS API URL when provider is "pdns"
*/}}
{{- define "external-dns.validateValues.pdns.apiUrl" -}}
{{- if and (eq .Values.provider "pdns") (not .Values.pdns.apiUrl) -}}
external-dns: pdns.apiUrl
You must provide the the PowerDNS API URL when provider="pdns".
Please set the apiUrl parameter (--set pdns.apiUrl="xxxx")
{{- end -}}
{{- end -}}
{{/*
Validate values of External DNS:
- must provide the PowerDNS API key when provider is "pdns"
*/}}
{{- define "external-dns.validateValues.pdns.apiKey" -}}
{{- if and (eq .Values.provider "pdns") (not .Values.pdns.apiKey) -}}
external-dns: pdns.apiKey
You must provide the the PowerDNS API key when provider="pdns".
Please set the apiKey parameter (--set pdns.apiKey="xxxx")
{{- end -}}
{{- end -}}
{{/* Check if there are rolling tags in the images */}}
{{- define "external-dns.checkRollingTags" -}}
{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }}
@@ -152,6 +152,11 @@ spec:
- --rfc2136-insecure
{{- end }}
{{- end }}
# PowerDNS arguments
{{- if eq .Values.provider "pdns" }}
- --pdns-server={{ .Values.pdns.apiUrl }}:{{ .Values.pdns.apiPort }}
- --pdns-api-key=$(PDNS_API_KEY)
{{- end }}
# Extra arguments
{{- range $key, $value := .Values.extraArgs }}
{{- if $value }}
@@ -236,6 +241,14 @@ spec:
- name: OPENSTACK_CA_FILE
value: {{ .Values.designate.customCA.mountPath }}/{{ .Values.designate.customCA.filename }}
{{- end }}
# PowerDNS environment variables
{{- if and (eq .Values.provider "pdns") .Values.pdns.apiKey }}
- name: PDNS_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: pdns_api_key
{{- end }}
# Extra environment variables
{{- $root := . -}}
{{- range .Values.extraEnv }}
+4 -1
View File
@@ -1,4 +1,4 @@
{{- if or .Values.aws.assumeRoleArn (and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey) .Values.cloudflare.apiKey .Values.digitalocean.apiToken .Values.google.serviceAccountKey (and .Values.infoblox.wapiUsername .Values.infoblox.wapiPassword) .Values.rfc2136.tsigSecret .Values.extraEnv }}
{{- if or .Values.aws.assumeRoleArn (and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey) .Values.cloudflare.apiKey .Values.digitalocean.apiToken .Values.google.serviceAccountKey (and .Values.infoblox.wapiUsername .Values.infoblox.wapiPassword) .Values.rfc2136.tsigSecret .Values.pdns.apiKey .Values.extraEnv }}
apiVersion: v1
kind: Secret
metadata:
@@ -30,6 +30,9 @@ data:
{{- if .Values.rfc2136.tsigSecret }}
rfc2136_tsig_secret: {{ .Values.rfc2136.tsigSecret | b64enc | quote }}
{{- end }}
{{- if .Values.pdns.apiKey }}
pdns_api_key: {{ .Values.pdns.apiKey | b64enc | quote }}
{{- end }}
{{- range $key, $value := .Values.extraEnv }}
{{ $key }}: {{ $value | b64enc | quote }}
{{- end }}
@@ -159,6 +159,13 @@ rfc2136:
tsigKeyname: externaldns-key
tsigAxfr: true
## PowerDNS configuration to be set via arguments/env. variables
##
pdns:
apiUrl: ""
apiPort: "8081"
apiKey: ""
## Limit possible target zones by domain suffixes (optional)
##
domainFilters: []
+7
View File
@@ -159,6 +159,13 @@ rfc2136:
tsigKeyname: externaldns-key
tsigAxfr: true
## PowerDNS configuration to be set via arguments/env. variables
##
pdns:
apiUrl: ""
apiPort: "8081"
apiKey: ""
## Limit possible target zones by domain suffixes (optional)
##
domainFilters: []