Skip to content

Commit

Permalink
[bitnami/external-dns] feat: add support to namespaceOverride and sim…
Browse files Browse the repository at this point in the history
…plify name helpers (#30515)
  • Loading branch information
juan131 authored Nov 19, 2024
1 parent 4aad2bb commit 09a4572
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 124 deletions.
8 changes: 6 additions & 2 deletions bitnami/external-dns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 8.5.1 (2024-11-07)
## 8.6.0 (2024-11-19)

* [bitnami/external-dns] Release 8.5.1 ([#30262](https://github.com/bitnami/charts/pull/30262))
* [bitnami/external-dns] feat: add support to namespaceOverride and simplify name helpers ([#30515](https://github.com/bitnami/charts/pull/30515))

## <small>8.5.1 (2024-11-07)</small>

* [bitnami/external-dns] Release 8.5.1 (#30262) ([d21d425](https://github.com/bitnami/charts/commit/d21d425d121adeb175e925898bc9342f296dbd3f)), closes [#30262](https://github.com/bitnami/charts/issues/30262)

## 8.5.0 (2024-11-05)

Expand Down
2 changes: 1 addition & 1 deletion bitnami/external-dns/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ maintainers:
name: external-dns
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/external-dns
version: 8.5.1
version: 8.6.0
23 changes: 12 additions & 11 deletions bitnami/external-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ helm install my-release \

### Common parameters

| Name | Description | Value |
| ----------------------- | -------------------------------------------------------------------------------------------- | --------------- |
| `nameOverride` | String to partially override external-dns.fullname template (will maintain the release name) | `""` |
| `fullnameOverride` | String to fully override external-dns.fullname template | `""` |
| `clusterDomain` | Kubernetes Cluster Domain | `cluster.local` |
| `commonLabels` | Labels to add to all deployed objects | `{}` |
| `commonAnnotations` | Annotations to add to all deployed objects | `{}` |
| `extraDeploy` | Array of extra objects to deploy with the release (evaluated as a template). | `[]` |
| `kubeVersion` | Force target Kubernetes version (using Helm capabilities if not set) | `""` |
| `watchReleaseNamespace` | Watch only namepsace used for the release | `false` |
| Name | Description | Value |
| ------------------- | -------------------------------------------------------------------------------------------- | --------------- |
| `nameOverride` | String to partially override common.names.fullname template (will maintain the release name) | `""` |
| `fullnameOverride` | String to fully override common.names.fullname template | `""` |
| `namespaceOverride` | String to fully override common.names.namespace | `""` |
| `clusterDomain` | Kubernetes Cluster Domain | `cluster.local` |
| `commonLabels` | Labels to add to all deployed objects | `{}` |
| `commonAnnotations` | Annotations to add to all deployed objects | `{}` |
| `extraDeploy` | Array of extra objects to deploy with the release (evaluated as a template). | `[]` |
| `kubeVersion` | Force target Kubernetes version (using Helm capabilities if not set) | `""` |

### external-dns parameters

Expand All @@ -140,6 +140,7 @@ helm install my-release \
| `dnsConfig` | allows users more control on the DNS settings for a Pod. Required if `dnsPolicy` is set to `None` | `{}` |
| `sidecars` | Attach additional containers to the pod (evaluated as a template) | `[]` |
| `namespace` | Limit sources of endpoints to a specific namespace (default: all namespaces) | `""` |
| `watchReleaseNamespace` | Watch only namespace used for the release | `false` |
| `fqdnTemplates` | Templated strings that are used to generate DNS names from sources that don't define a hostname themselves | `[]` |
| `containerPorts.http` | HTTP Container port | `7979` |
| `combineFQDNAnnotation` | Combine FQDN template and annotations instead of overwriting | `false` |
Expand Down Expand Up @@ -370,7 +371,7 @@ helm install my-release \
| `networkPolicy.ingressNSMatchLabels` | Labels to match to allow traffic from other namespaces | `{}` |
| `networkPolicy.ingressNSPodMatchLabels` | Pod labels to match to allow traffic from other namespaces | `{}` |
| `serviceAccount.create` | Determine whether a Service Account should be created or it should reuse a exiting one. | `true` |
| `serviceAccount.name` | ServiceAccount to use. A name is generated using the external-dns.fullname template if it is not set | `""` |
| `serviceAccount.name` | ServiceAccount to use. A name is generated using the common.names.fullname template if it is not set | `""` |
| `serviceAccount.annotations` | Additional Service Account annotations | `{}` |
| `serviceAccount.automountServiceAccountToken` | Automount API credentials for a service account. | `false` |
| `serviceAccount.labels` | Additional labels to be included on the service account | `{}` |
Expand Down
4 changes: 2 additions & 2 deletions bitnami/external-dns/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ APP VERSION: {{ .Chart.AppVersion }}

To verify that external-dns has started, run:

kubectl --namespace={{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ template "external-dns.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
kubectl --namespace={{ include "common.names.namespace" . }} get pods -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ include "common.names.namespace" . }}"

{{ include "external-dns.validateValues" . }}
{{ include "external-dns.checkRollingTags" . }}
{{- include "common.warnings.resources" (dict "sections" (list "") "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image) "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image) "context" $) }}
77 changes: 7 additions & 70 deletions bitnami/external-dns/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,6 @@ SPDX-License-Identifier: APACHE-2.0
*/}}

{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "external-dns.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "external-dns.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "external-dns.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/* podAnnotations */}}
{{- define "external-dns.podAnnotations" -}}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations }}
{{- end }}
{{- end -}}

{{/*
Return the proper External DNS image name
Expand All @@ -57,29 +16,7 @@ Return the proper External DNS image name
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "external-dns.imagePullSecrets" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
Also, we can not use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Expand Down Expand Up @@ -192,7 +129,7 @@ Return the name of the Secret used to store the passwords
{{- else if and (eq .Values.provider "scaleway") .Values.scaleway.secretName }}
{{- .Values.scaleway.secretName }}
{{- else -}}
{{- template "external-dns.fullname" . }}
{{- template "common.names.fullname" . }}
{{- end -}}
{{- end -}}

Expand Down Expand Up @@ -833,20 +770,20 @@ Return the ExternalDNS service account name
*/}}
{{- define "external-dns.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "external-dns.fullname" .) .Values.serviceAccount.name }}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the ExternalDNS namespace to be used
Return the namespace to be monitored by ExternalDNS
*/}}
{{- define "external-dns.namespace" -}}
{{- if and .Values.rbac.create (not .Values.rbac.clusterRole) -}}
{{ default .Release.Namespace .Values.namespace }}
{{ default (include "common.names.namespace" .) .Values.namespace }}
{{- else if .Values.watchReleaseNamespace -}}
{{ .Release.namespace }}
{{ include "common.names.namespace" . }}
{{- else -}}
{{ .Values.namespace }}
{{- end -}}
Expand All @@ -857,7 +794,7 @@ Return the secret containing external-dns TLS certificates
*/}}
{{- define "external-dns.tlsSecretName" -}}
{{- if .Values.coredns.etcdTLS.autoGenerated -}}
{{- printf "%s-crt" (include "external-dns.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- printf "%s-crt" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $secretName := .Values.coredns.etcdTLS.secretName -}}
{{- printf "%s" (tpl $secretName $) | trunc 63 | trimSuffix "-" -}}
Expand Down
2 changes: 1 addition & 1 deletion bitnami/external-dns/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "external-dns.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- end }}
4 changes: 2 additions & 2 deletions bitnami/external-dns/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "external-dns.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
name: {{ template "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
15 changes: 8 additions & 7 deletions bitnami/external-dns/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "external-dns.fullname" . }}
name: {{ template "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
Expand All @@ -27,7 +27,8 @@ spec:
{{- if or .Values.podAnnotations (and .Values.metrics.enabled .Values.metrics.podAnnotations) (include "external-dns.createSecret" .) (and (eq .Values.provider "designate") .Values.designate.customCA.enabled) }}
annotations:
{{- if or .Values.podAnnotations (and .Values.metrics.enabled .Values.metrics.podAnnotations) }}
{{- include "external-dns.podAnnotations" . | trim | nindent 8 }}
{{- $podAnnotations := include "common.tplvalues.merge" (dict "values" (list .Values.podAnnotations .Values.metrics.podAnnotations) "context" .) }}
{{- include "common.tplvalues.render" (dict "value" $podAnnotations "context" $) | nindent 8 }}
{{- end }}
{{- if (include "external-dns.createSecret" .) }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
Expand Down Expand Up @@ -868,10 +869,10 @@ spec:
secretName: {{ template "external-dns.secretName" . }}
{{- else if .Values.azure.useWorkloadIdentityExtension }}
secret:
secretName: {{ template "external-dns.fullname" . }}
secretName: {{ template "common.names.fullname" . }}
{{- else if .Values.azure.useManagedIdentityExtension }}
secret:
secretName: {{ template "external-dns.fullname" . }}
secretName: {{ template "common.names.fullname" . }}
{{- else }}
hostPath:
path: /etc/kubernetes/azure.json
Expand Down Expand Up @@ -906,7 +907,7 @@ spec:
{{- if .Values.designate.customCA.enabled }}
- name: designate-custom-ca
configMap:
name: {{ template "external-dns.fullname" . }}
name: {{ template "common.names.fullname" . }}
items:
- key: {{ .Values.designate.customCA.filename }}
path: {{ .Values.designate.customCA.filename }}
Expand All @@ -920,7 +921,7 @@ spec:
# Kerberos config volume
- name: krb5config
configMap:
name: {{ template "external-dns.fullname" . }}
name: {{ template "common.names.fullname" . }}
items:
- key: "krb5.conf"
path: "krb5.conf"
Expand All @@ -929,7 +930,7 @@ spec:
# TransIP volume(s)
- name: transip-api-key
secret:
secretName: {{ template "external-dns.fullname" . }}
secretName: {{ template "common.names.fullname" . }}
{{- end }}
{{- if .Values.extraVolumes }}
# Extra volume(s)
Expand Down
4 changes: 2 additions & 2 deletions bitnami/external-dns/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "external-dns.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
name: {{ template "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions bitnami/external-dns/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: {{ template "external-dns.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.googlePodMonitor.namespace | quote }}
name: {{ template "common.names.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.googlePodMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
spec:
endpoints:
Expand Down
2 changes: 1 addition & 1 deletion bitnami/external-dns/templates/psp-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "external-dns.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- end }}
2 changes: 1 addition & 1 deletion bitnami/external-dns/templates/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "common.names.fullname.namespace" . }}
namespace: {{ .Release.Namespace | quote }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion bitnami/external-dns/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: rbac.authorization.k8s.io/{{ .Values.rbac.apiVersion }}
kind: Role
metadata:
name: {{ template "external-dns.fullname" . }}
name: {{ template "common.names.fullname" . }}
namespace: {{ template "external-dns.namespace" . }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
Expand Down
Loading

0 comments on commit 09a4572

Please sign in to comment.