Commit Graph

26 Commits

Author SHA1 Message Date
Ivan Ka
1b77c19d3c
chore(codebase): reuse functions (#5607)
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-07-06 01:17:25 -07:00
Ivan Ka
6e2fc4aa31
chore(codebase): enable linter nonamedreturns (#5594)
* chore(codebase): enable linter nonamedreturns

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(codebase): enable linter nonamedreturns

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

---------

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-07-01 22:13:25 -07:00
ivan katliarchuk
2b7d236734
chore(source): move cache informer to dedicated folder
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-05-25 13:47:16 +01:00
ivan katliarchuk
fe83c0d2d0
chore(source): code cleanup 2025-05-12 14:21:28 +01:00
ivan katliarchuk
9f8f30882b
chore(source): code cleanup
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-05-09 08:21:31 +01:00
Ivan Ka
ba64e8bb01
chore(deps): code cleanup, do not use pkg/errors (#5335)
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-04-29 01:17:57 -07:00
ivan katliarchuk
9f427e5622
chore(source): code cleanup 2025-04-16 13:50:04 +01:00
Kyle
38178940a3
feat: add annotation and label filters to Ambassador Host Source (#2633)
* Add annotation filter to Ambassador Host Source

This change makes the Ambassador Host source respect the External-DNS annotationFilter allowing for an Ambassador Host resource to specify what External-DNS deployment to use when there are multiple External-DNS deployments within the same cluster. Before this change if you had two External-DNS deployments within the cluster and used the Ambassador Host source the first External-DNS to process the resource will create the record and not the one that was specified in the filter annotation.

I added the `filterByAnnotations` function so that it matched the same way the other sources have implemented annotation filtering. I didn't add the controller check only because I wanted to keep this change to implementing the annotationFilter.

Example: Create two External-DNS deployments 1 public and 1 private and set the Ambassador Host to use the public External-DNS using the annotation filter.

```
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns-private
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns-private
  template:
    metadata:
      labels:
        app: external-dns-private
      annotations:
        iam.amazonaws.com/role: {ARN} # AWS ARN role
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: k8s.gcr.io/external-dns/external-dns:latest
        args:
        - --source=ambassador-host
        - --domain-filter=example.net # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
        - --provider=aws
        - --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
        - --aws-zone-type=private # only look at public hosted zones (valid values are public, private or no value for both)
        - --registry=txt
        - --txt-owner-id= {Hosted Zone ID} # Insert Route53 Hosted Zone ID here
        - --annotation-filter=kubernetes.io/ingress.class in (private)
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns-public
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns-public
  template:
    metadata:
      labels:
        app: external-dns-public
      annotations:
        iam.amazonaws.com/role: {ARN} # AWS ARN role
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: k8s.gcr.io/external-dns/external-dns:latest
        args:
        - --source=ambassador-host
        - --domain-filter=example.net # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
        - --provider=aws
        - --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
        - --aws-zone-type= # only look at public hosted zones (valid values are public, private or no value for both)
        - --registry=txt
        - --txt-owner-id= {Hosted Zone ID} # Insert Route53 Hosted Zone ID here
        - --annotation-filter=kubernetes.io/ingress.class in (public)
---
apiVersion: getambassador.io/v3alpha1
  kind: Host
  metadata:
    name: your-hostname
    annotations:
      external-dns.ambassador-service: emissary-ingress/emissary
      kubernetes.io/ingress.class: public
  spec:
		acmeProvider:
      authority: none
		hostname: your-hostname.example.com
```

Fixes kubernetes-sigs/external-dns#2632

* Add Label filltering for Ambassador Host source

Currently the `--label-filter` flag can only be used to filter CRDs, Ingress, Service and Openshift Route objects which match the label selector passed through that flag. This change extends the functionality to the Ambassador Host type object.

When the flag is not specified the default value is `labels.Everything()` which is an empty string, the same as before. An annotation based filter is inefficient because the filtering has to be done in the controller instead of the API server like with label filtering. The Annotation based filtering has been left in for legacy reasons so the Ambassador Host source can be used inconjunction with the other sources that don't yet support label filltering.

It is possible to use label based filltering with annotation based filltering so you can initially filter by label then filter the returned hosts by annotation. This is not recomended

* Update Ambassador Host source docs

Add that the Ambassador Host source now supports both annotation and label filltering.
2024-08-28 18:02:57 +01:00
Michel Loiseleur
971c91d2cf review with Raffo 2024-05-16 10:51:13 +02:00
Michel Loiseleur
9597d257a7 fix: linter on unused parameter 2024-05-16 08:44:06 +02:00
Frederic Mereu
6cec5dd7df
feat(ambassador): add support for provider specific annotations 2024-02-12 11:40:28 +01:00
Frederic Mereu
fecd4273af
fix(ambassador): don't resolve LB hostname
Signed-off-by: Frederic Mereu <frederic.mereu@gaming1.com>
2023-12-05 09:56:32 +01:00
Kubernetes Prow Robot
d8f408b8a5
Merge pull request #3734 from fad3t/ambassador-external-ip
feat: add support for external IP in ambassador host source
2023-10-27 13:22:02 +02:00
John Gardiner Myers
17e9637f11
Refactor getTTLFromAnnotations() to not return error (#3939)
* Refactor getTTLFromAnnotations() to not return error

* Improve log messages
2023-10-02 03:56:45 -07:00
John Gardiner Myers
4a32aaec01 Implement target annotation for more sources 2023-09-27 23:16:14 -07:00
John Gardiner Myers
50e456997f Create the "resource" label for Ambassador Host 2023-08-29 11:36:30 -07:00
John Gardiner Myers
39955e556e Refactor setting the "resource" label into endpointsForHostname 2023-08-29 11:36:27 -07:00
Frederic Mereu
73862a802b
chore: reuse existing extractLoadBalancerTargets function 2023-08-12 13:49:17 +02:00
Frederic Mereu
f9099b8bfc
feat: add support for external IP in ambassador host source 2023-06-26 13:40:41 +02:00
Andy Bursavich
74ffff6c26 gofumpt 2022-09-20 20:48:57 -07:00
Ole Markus With
a1a9091cdf Ignore ambassador-hosts with invalid annotations
If e.g the ambassador service annotation points to an nonexisting service, external-dns will not update any DNS records. This PR makes external-dns ignore the host and carry on instead.
2022-09-07 19:38:36 +02:00
Andrey Lebedev
4f41229820 Pass stop channel to informer factory instances 2022-01-22 21:31:29 +01:00
Raffaele Di Fazio
d82bee2b53 Merge branch 'master' into raffo/bump-modules
Signed-off-by: Raffaele Di Fazio <raffo@github.com>
2021-08-12 16:28:30 +02:00
Raffaele Di Fazio
376d4653d8 remove kubernetes dependency
Signed-off-by: GitHub <noreply@github.com>
2021-08-10 13:48:11 +00:00
Andy Bursavich
60c649bf5c source: dedupe wait for cache sync
wait
2021-07-28 13:37:17 -07:00
Alvaro Saurin
6eeef96b14 Support Ambassador Host resources as sources
Ambassador can be configured with `Host` resources (based on the
`Host` CRD) for defining the external DNS host name.

This code adds a new source, `ambassador-host`, that looks for the
`ambassador/ambassador` Service and and uses the `hostname` from the
`Host` resource.

Signed-off-by: Alvaro Saurin <alvaro.saurin@gmail.com>
Signed-off-by: Flynn <flynn@datawire.io>
2021-01-27 12:47:10 -05:00