Repository: kubernetes-sigs/external-dns (language: go)

Issue:
chore: update templating to support extra containers and optional service creation
**What would you like to be added**:

For helmchart, could the following fields be added?

- In `values.yaml`:   `extraContainers: {}`
- In `values.yaml`:  `service.create: true`

- Then in `charts/external-dns/templates/deployment.yaml`:
```YAML
      containers:
      {{- with .Values.extraContainers }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
```
- Then in `charts/external-dns/templates/service.yaml`, add the following if statement around the service:
```YAML
{{- if .Values.service.create -}}
.
.
.
{{- end }}
```

**Why is this needed**:
- I would like to be able to add a proxy container to the deployment and not create the service. 



Discussion / hints:
/assign

Fix patch:
diff --git a/charts/external-dns/CHANGELOG.md b/charts/external-dns/CHANGELOG.md
index ad0a8f136a..3a5b2de3c2 100644
--- a/charts/external-dns/CHANGELOG.md
+++ b/charts/external-dns/CHANGELOG.md
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## Added
 
+- Added support for `extraContainers` argument. ([#4432](https://github.com/kubernetes-sigs/external-dns/pull/4432))[@omerap12](https://github.com/omerap12)
 - Added support for setting `excludeDomains` argument.  ([#4380](https://github.com/kubernetes-sigs/external-dns/pull/4380))[@bford-evs](https://github.com/bford-evs)
 
 ## [v1.14.4] - 2023-04-03
diff --git a/charts/external-dns/README.md b/charts/external-dns/README.md
index f4680f3d67..ca041d274d 100644
--- a/charts/external-dns/README.md
+++ b/charts/external-dns/README.md
@@ -101,6 +101,7 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains
 | env | list | `[]` | [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `external-dns` container. |
 | excludeDomains | list | `[]` |  |
 | extraArgs | list | `[]` | Extra arguments to provide to _ExternalDNS_. |
+| extraContainers | object | `{}` | Extra containers to add to the `Deployment`. |
 | extraVolumeMounts | list | `[]` | Extra [volume mounts](https://kubernetes.io/docs/concepts/storage/volumes/) for the `external-dns` container. |
 | extraVolumes | list | `[]` | Extra [volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the `Pod`. |
 | fullnameOverride | string | `nil` | Override the full name of the chart. |
diff --git a/charts/external-dns/templates/deployment.yaml b/charts/external-dns/templates/deployment.yaml
index 84fc991ff1..3c01a11f6d 100644
--- a/charts/external-dns/templates/deployment.yaml
+++ b/charts/external-dns/templates/deployment.yaml
@@ -70,6 +70,9 @@ spec:
         {{- toYaml . | nindent 8 }}
       {{- end }}
       containers:
+      {{- with .Values.extraContainers }}
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
         - name: external-dns
           {{- with .Values.securityContext }}
           securityContext:
diff --git a/charts/external-dns/values.yaml b/charts/external-dns/values.yaml
index e82645daeb..060dd1ffe1 100644
--- a/charts/external-dns/values.yaml
+++ b/charts/external-dns/values.yaml
@@ -53,6 +53,9 @@ rbac:
 # -- Annotations to add to the `Deployment`.
 deploymentAnnotations: {}
 
+# -- Extra containers to add to the `Deployment`.
+extraContainers: {}
+
 # -- [Deployment Strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy).
 deploymentStrategy:
   type: Recreate


Test patch: