Merge branch 'kubernetes-sigs:master' into hetzner-readme-link

This commit is contained in:
Marco Confalonieri 2023-11-16 01:21:52 +01:00 committed by GitHub
commit 45a1ee7f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 713 additions and 204 deletions

View File

@ -17,7 +17,7 @@ jobs:
actions: write
steps:
- name: Update PR
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
uses: actions/github-script@e69ef5462fd455e02edcaf4dd7708eda96b9eda0 # v7.0.0
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -16,13 +16,13 @@ The following table documents which sources support which annotations:
| Gloo | | | | Yes | Yes[^5] | Yes[^5] |
| Ingress | Yes | Yes[^1] | | Yes | Yes | Yes |
| Istio | Yes | Yes[^1] | | Yes | Yes | Yes |
| Kong | | Yes | | Yes | Yes | Yes |
| Kong | | Yes[^1] | | Yes | Yes | Yes |
| Node | Yes | | | Yes | Yes | |
| OpenShift | Yes | Yes[^1] | | Yes | Yes | Yes |
| Pod | | Yes | Yes | Yes | | |
| Service | Yes | Yes[^1] | Yes[^1][^2] | Yes[^3] | Yes | Yes |
| Skipper | Yes | Yes[^1] | | Yes | Yes | Yes |
| Traefik | | Yes | | Yes | Yes | Yes |
| Traefik | | Yes[^1] | | Yes | Yes | Yes |
[^1]: Unless the `--ignore-hostname-annotation` flag is specified.
[^2]: Only behaves differently than `hostname` for `Service`s of type `ClusterIP` or `LoadBalancer`.

View File

@ -209,7 +209,7 @@ $ docker run \
-e EXTERNAL_DNS_SOURCE=$'service\ningress' \
-e EXTERNAL_DNS_PROVIDER=google \
-e EXTERNAL_DNS_DOMAIN_FILTER=$'foo.com\nbar.com' \
registry.k8s.io/external-dns/external-dns:v0.13.5
registry.k8s.io/external-dns/external-dns:v0.14.0
time="2017-08-08T14:10:26Z" level=info msg="config: &{APIServerURL: KubeConfig: Sources:[service ingress] Namespace: ...
```

View File

@ -31,7 +31,7 @@ You must be an official maintainer of the project to be able to do a release.
- Branch out from the default branch and run `scripts/kustomize-version-updater.sh` to update the image tag used in the kustomization.yaml.
- Create an issue to release the corresponding Helm chart via the chart release process (below) assigned to a chart maintainer
- Create a PR with the kustomize change.
- Create a PR to replace all versions for docker images in the tutorials. A possible script to use is `sd registry.k8s.io/external-dns/external-dns:.* registry.k8s.io/external-dns/external-dns:v0.13.2 $(fd --type file)` which uses the `fd` and `sd` utilities.
- Create a PR to replace all versions for docker images in the tutorials. A possible script to use is `sd registry.k8s.io/external-dns/external-dns:v0.14.0
- Once the PR is merged, all is done :-)
## How to release a new chart version

View File

@ -106,5 +106,6 @@ as one of the values.
### ExternalName
Creates a target with the value of the Service's `externalName` field.
1. If the Service has one or more `spec.externalIPs`, uses the values in that field.
2. Otherwise, creates a target with the value of the Service's `externalName` field.

View File

@ -48,7 +48,7 @@ spec:
- name: external-dns
# You will need to check what the latest version is yourself:
# https://github.com/kubernetes-sigs/external-dns/releases
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
# (optional) limit to only example.com domains; change to match the
@ -114,7 +114,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
# (optional) limit to only example.com domains; change to match the

View File

@ -57,7 +57,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # or ingress or both
- --provider=akamai
@ -143,7 +143,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # or ingress or both
- --provider=akamai

View File

@ -113,7 +113,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -187,7 +187,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -81,7 +81,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
env:
- name: AWS_REGION
value: us-east-1 # put your CloudMap NameSpace region
@ -148,7 +148,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
env:
- name: AWS_REGION
value: us-east-1 # put your CloudMap NameSpace region

View File

@ -414,7 +414,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -509,7 +509,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -962,7 +962,7 @@ A simple way to implement randomised startup is with an init container:
spec:
initContainers:
- name: init-jitter
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
command:
- /bin/sh
- -c

View File

@ -130,7 +130,7 @@ spec:
spec:
containers:
- name: externaldns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -201,7 +201,7 @@ spec:
serviceAccountName: externaldns
containers:
- name: externaldns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -272,7 +272,7 @@ spec:
serviceAccountName: externaldns
containers:
- name: externaldns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -489,7 +489,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -557,7 +557,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -628,7 +628,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -46,7 +46,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=service
@ -136,7 +136,7 @@ spec:
secretName: bluecatconfig
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
volumeMounts:
- name: bluecatconfig
mountPath: "/etc/external-dns/"

View File

@ -40,7 +40,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -104,7 +104,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -56,7 +56,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -125,7 +125,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -93,7 +93,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -108,7 +108,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --provider=coredns
@ -175,7 +175,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --provider=coredns

View File

@ -59,7 +59,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -136,7 +136,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -43,7 +43,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -107,7 +107,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -35,7 +35,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone you create in DNSimple.
@ -100,7 +100,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone you create in DNSimple.

View File

@ -43,7 +43,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --txt-prefix=_d

View File

@ -40,7 +40,7 @@ spec:
# serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress # or service or both
- --provider=exoscale

View File

@ -27,7 +27,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=service

View File

@ -39,7 +39,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -103,7 +103,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -72,7 +72,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
# Add desired Gateway API Route sources.
- --source=gateway-httproute

View File

@ -319,7 +319,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -22,7 +22,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=gloo-proxy
- --gloo-namespace=custom-gloo-system # gloo system namespace. Specify multiple times for multiple namespaces. Omit to use the default (gloo-system)
@ -90,7 +90,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=gloo-proxy
- --gloo-namespace=custom-gloo-system # gloo system namespace. Specify multiple times for multiple namespaces. Omit to use the default (gloo-system)

View File

@ -44,7 +44,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -115,7 +115,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -31,7 +31,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=service
@ -96,7 +96,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=service

View File

@ -69,7 +69,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -142,7 +142,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -69,7 +69,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --domain-filter=example.com # (optional) limit to only example.com domains.
@ -150,7 +150,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --domain-filter=example.com # (optional) limit to only example.com domains.

View File

@ -28,7 +28,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -98,7 +98,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress

View File

@ -22,7 +22,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=kong-tcpingress
- --provider=aws
@ -86,7 +86,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=kong-tcpingress
- --provider=aws

View File

@ -41,7 +41,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -105,7 +105,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -273,7 +273,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --domain-filter=external-dns-test.gcp.zalan.do
@ -568,7 +568,7 @@ spec:
- --google-project=zalando-external-dns-test
- --registry=txt
- --txt-owner-id=my-identifier
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
name: external-dns
securityContext:
fsGroup: 65534

View File

@ -29,7 +29,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=node # will use nodes as source
- --provider=aws
@ -100,7 +100,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=node # will use nodes as source
- --provider=aws

View File

@ -61,7 +61,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -125,7 +125,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -66,7 +66,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=openshift-route
- --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
@ -133,7 +133,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=openshift-route
- --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones

View File

@ -170,7 +170,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -180,6 +180,9 @@ spec:
# Specifies the OCI DNS Zone scope, defaults to GLOBAL.
# May be GLOBAL, PRIVATE, or an empty value to specify both GLOBAL and PRIVATE OCI DNS Zones
# - --oci-zone-scope=GLOBAL
# Specifies the zone cache duration, defaults to 0s. If set to 0s, the zone cache is disabled.
# Use of zone caching is recommended to reduce the amount of requests sent to OCI DNS.
# - --oci-zones-cache-duration=0s
volumeMounts:
- name: config
mountPath: /etc/kubernetes/

View File

@ -91,7 +91,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -165,7 +165,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -42,7 +42,7 @@ spec:
# serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # or ingress or both
- --provider=pdns

View File

@ -81,7 +81,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
# If authentication is disabled and/or you didn't create
# a secret, you can remove this block.
envFrom:

View File

@ -35,7 +35,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -105,7 +105,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -243,7 +243,7 @@ spec:
- --txt-owner-id=external-dns
- --ingress-class=external-ingress
- --aws-zone-type=public
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
name: external-dns-public
```
@ -281,7 +281,7 @@ spec:
- --txt-owner-id=dev.k8s.nexus
- --ingress-class=internal-ingress
- --aws-zone-type=private
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
name: external-dns-private
```

View File

@ -53,7 +53,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -120,7 +120,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -54,7 +54,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --provider=rdns
@ -123,7 +123,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=ingress
- --provider=rdns

View File

@ -218,7 +218,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --registry=txt
- --txt-prefix=external-dns-
@ -261,7 +261,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --registry=txt
- --txt-prefix=external-dns-

View File

@ -60,7 +60,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -140,7 +140,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

View File

@ -20,7 +20,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- ... # your arguments here
securityContext:

View File

@ -129,7 +129,7 @@ spec:
- --policy=sync # set `upsert-only` would prevent ExternalDNS from deleting any records
- --tencent-cloud-zone-type=private # only look at private hosted zones. set `public` to use the public dns service.
- --tencent-cloud-config-file=/etc/kubernetes/tencent-cloud.json
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
imagePullPolicy: Always
name: external-dns
resources: {}

View File

@ -24,7 +24,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.3
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=traefik-proxy
- --provider=aws
@ -87,7 +87,7 @@ spec:
containers:
- name: external-dns
# update this to the desired external-dns version
image: registry.k8s.io/external-dns/external-dns:v0.13.3
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=traefik-proxy
- --provider=aws

View File

@ -36,7 +36,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains
@ -107,7 +107,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains

View File

@ -6,7 +6,7 @@ For this tutorial, please make sure that you are using a version **> 0.7.2** of
## Managing DNS with UltraDNS
If you would like to read-up on the UltraDNS service, you can find additional details here: [Introduction to UltraDNS](https://docs.ultradns.neustar)
If you would like to read-up on the UltraDNS service, you can find additional details here: [Introduction to UltraDNS](https://docs.ultradns.com/)
Before proceeding, please create a new DNS Zone that you will create your records in for this tutorial process. For the examples in this tutorial, we will be using `example.com` as our Zone.
@ -44,7 +44,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress # ingress is also possible
@ -116,7 +116,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service
- --source=ingress
@ -191,9 +191,9 @@ Once the service has an external IP assigned, ExternalDNS will notice the new se
## Verifying UltraDNS Records
Please verify on the [UltraDNS UI](https://portal.ultradns.neustar) that the records are created under the zone "example.com".
Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records are created under the zone "example.com".
For more information on UltraDNS UI, refer to (https://docs.ultradns.neustar/mspuserguide.html).
For more information on UltraDNS UI, refer to (https://docs.ultradns.com/Content/MSP_User_Guide/Content/User%20Guides/MSP_User_Guide/Navigation/Moving%20Around%20the%20UI.htm#_Toc2780722).
Select the zone that was created above (or select the appropriate zone if a different zone was used.)
@ -265,7 +265,7 @@ $ kubectl create -f expose-apple-banana-app.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar) that the records have been created under the zone "example.com".
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml
@ -358,7 +358,7 @@ $ kubectl create -f apple-banana-echo.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar), that the records have been created under the zone "example.com".
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml
@ -629,7 +629,7 @@ $ kubectl create -f apple-banana-echo.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar), that the records have been created under the zone "example.com".
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml

View File

@ -66,7 +66,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --provider=vinyldns
- --source=service
@ -137,7 +137,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --provider=vinyldns
- --source=service

View File

@ -42,7 +42,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
@ -106,7 +106,7 @@ spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.13.5
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.

4
go.mod
View File

@ -13,7 +13,7 @@ require (
github.com/IBM/go-sdk-core/v5 v5.13.4
github.com/IBM/networking-go-sdk v0.42.2
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/alecthomas/kingpin/v2 v2.3.2
github.com/aliyun/alibaba-cloud-sdk-go v1.62.483
github.com/ans-group/sdk-go v1.16.6
github.com/aws/aws-sdk-go v1.44.311
@ -87,7 +87,6 @@ require (
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/Masterminds/semver v1.4.2 // indirect
github.com/Yamashou/gqlgenc v0.14.0 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/alexbrainman/sspi v0.0.0-20180613141037-e580b900e9f5 // indirect
github.com/ans-group/go-durationstring v1.2.0 // indirect
@ -181,6 +180,7 @@ require (
github.com/subosito/gotenv v1.4.2 // indirect
github.com/terra-farm/udnssdk v1.3.5 // indirect
github.com/vektah/gqlparser/v2 v2.5.1 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.opencensus.io v0.24.0 // indirect

7
go.sum
View File

@ -112,10 +112,9 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 h1:F1j7z+/DKEsYqZNoxC6wvfmaiDneLsQOFQmuq9NADSY=
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2/go.mod h1:QlXr/TrICfQ/ANa76sLeQyhAJyNR9sEcfNuZBkY9jgY=
github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI=
github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE=
github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWrKI6ocU=
github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@ -1162,6 +1161,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=

View File

@ -360,7 +360,7 @@ func main() {
} else {
config, err = oci.LoadOCIConfig(cfg.OCIConfigFile)
}
config.ZoneCacheDuration = cfg.OCIZoneCacheDuration
if err == nil {
p, err = oci.NewOCIProvider(*config, domainFilter, zoneIDFilter, cfg.OCIZoneScope, cfg.DryRun)
}

View File

@ -28,7 +28,7 @@ import (
"sigs.k8s.io/external-dns/endpoint"
"github.com/alecthomas/kingpin"
"github.com/alecthomas/kingpin/v2"
"github.com/sirupsen/logrus"
"sigs.k8s.io/external-dns/source"
@ -136,6 +136,7 @@ type Config struct {
OCICompartmentOCID string
OCIAuthInstancePrincipal bool
OCIZoneScope string
OCIZoneCacheDuration time.Duration
InMemoryZones []string
OVHEndpoint string
OVHApiRateLimit int
@ -293,6 +294,7 @@ var defaultConfig = &Config{
InfobloxCacheDuration: 0,
OCIConfigFile: "/etc/kubernetes/oci.yaml",
OCIZoneScope: "GLOBAL",
OCIZoneCacheDuration: 0 * time.Second,
InMemoryZones: []string{},
OVHEndpoint: "ovh-eu",
OVHApiRateLimit: 20,
@ -527,6 +529,7 @@ func (cfg *Config) ParseFlags(args []string) error {
app.Flag("oci-compartment-ocid", "When using the OCI provider, specify the OCID of the OCI compartment containing all managed zones and records. Required when using OCI IAM instance principal authentication.").StringVar(&cfg.OCICompartmentOCID)
app.Flag("oci-zone-scope", "When using OCI provider, filter for zones with this scope (optional, options: GLOBAL, PRIVATE). Defaults to GLOBAL, setting to empty value will target both.").Default(defaultConfig.OCIZoneScope).EnumVar(&cfg.OCIZoneScope, "", "GLOBAL", "PRIVATE")
app.Flag("oci-auth-instance-principal", "When using the OCI provider, specify whether OCI IAM instance principal authentication should be used (instead of key-based auth via the OCI config file).").Default(strconv.FormatBool(defaultConfig.OCIAuthInstancePrincipal)).BoolVar(&cfg.OCIAuthInstancePrincipal)
app.Flag("oci-zones-cache-duration", "When using the OCI provider, set the zones list cache TTL (0s to disable).").Default(defaultConfig.OCIZoneCacheDuration.String()).DurationVar(&cfg.OCIZoneCacheDuration)
app.Flag("rcodezero-txt-encrypt", "When using the Rcodezero provider with txt registry option, set if TXT rrs are encrypted (default: false)").Default(strconv.FormatBool(defaultConfig.RcodezeroTXTEncrypt)).BoolVar(&cfg.RcodezeroTXTEncrypt)
app.Flag("inmemory-zone", "Provide a list of pre-configured zones for the inmemory provider; specify multiple times for multiple zones (optional)").Default("").StringsVar(&cfg.InMemoryZones)
app.Flag("ovh-endpoint", "When using the OVH provider, specify the endpoint (default: ovh-eu)").Default(defaultConfig.OVHEndpoint).StringVar(&cfg.OVHEndpoint)

View File

@ -95,6 +95,7 @@ var (
InfobloxMaxResults: 0,
OCIConfigFile: "/etc/kubernetes/oci.yaml",
OCIZoneScope: "GLOBAL",
OCIZoneCacheDuration: 0 * time.Second,
InMemoryZones: []string{""},
OVHEndpoint: "ovh-eu",
OVHApiRateLimit: 20,
@ -205,6 +206,7 @@ var (
InfobloxMaxResults: 2000,
OCIConfigFile: "oci.yaml",
OCIZoneScope: "PRIVATE",
OCIZoneCacheDuration: 30 * time.Second,
InMemoryZones: []string{"example.org", "company.com"},
OVHEndpoint: "ovh-ca",
OVHApiRateLimit: 42,
@ -328,6 +330,7 @@ func TestParseFlags(t *testing.T) {
"--pdns-skip-tls-verify",
"--oci-config-file=oci.yaml",
"--oci-zone-scope=PRIVATE",
"--oci-zones-cache-duration=30s",
"--tls-ca=/path/to/ca.crt",
"--tls-client-cert=/path/to/cert.pem",
"--tls-client-cert-key=/path/to/key.pem",
@ -449,6 +452,7 @@ func TestParseFlags(t *testing.T) {
"EXTERNAL_DNS_INFOBLOX_MAX_RESULTS": "2000",
"EXTERNAL_DNS_OCI_CONFIG_FILE": "oci.yaml",
"EXTERNAL_DNS_OCI_ZONE_SCOPE": "PRIVATE",
"EXTERNAL_DNS_OCI_ZONES_CACHE_DURATION": "30s",
"EXTERNAL_DNS_INMEMORY_ZONE": "example.org\ncompany.com",
"EXTERNAL_DNS_OVH_ENDPOINT": "ovh-ca",
"EXTERNAL_DNS_OVH_API_RATE_LIMIT": "42",

View File

@ -467,6 +467,12 @@ func newRecord(ep *endpoint.Endpoint) *dns.ResourceRecordSet {
}
}
if ep.RecordType == endpoint.RecordTypeSRV {
for i, srvRecord := range ep.Targets {
targets[i] = provider.EnsureTrailingDot(srvRecord)
}
}
// no annotation results in a Ttl of 0, default to 300 for backwards-compatibility
var ttl int64 = googleRecordTTL
if ep.RecordTTL.IsConfigured() {

44
provider/oci/cache.go Normal file
View File

@ -0,0 +1,44 @@
/*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package oci
import (
"time"
"github.com/oracle/oci-go-sdk/v65/dns"
)
type zoneCache struct {
age time.Time
duration time.Duration
zones map[string]dns.ZoneSummary
}
func (z *zoneCache) Reset(zones map[string]dns.ZoneSummary) {
if z.duration > time.Duration(0) {
z.age = time.Now()
z.zones = zones
}
}
func (z *zoneCache) Get() map[string]dns.ZoneSummary {
return z.zones
}
func (z *zoneCache) Expired() bool {
return len(z.zones) < 1 || time.Since(z.age) > z.duration
}

View File

@ -0,0 +1,75 @@
/*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package oci
import (
"github.com/oracle/oci-go-sdk/v65/dns"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestZoneCache(t *testing.T) {
now := time.Now()
var testCases = map[string]struct {
z *zoneCache
expired bool
}{
"inactive-zone-cache": {
&zoneCache{
duration: 0 * time.Second,
},
true,
},
"empty-active-zone-cache": {
&zoneCache{
duration: 30 * time.Second,
},
true,
},
"expired-zone-cache": {
&zoneCache{
age: now.Add(300 * time.Second),
duration: 30 * time.Second,
},
true,
},
"active-zone-cache": {
&zoneCache{
zones: map[string]dns.ZoneSummary{
zoneIdBaz: testPrivateZoneSummaryBaz,
},
duration: 30 * time.Second,
},
true,
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
assert.Equal(t, testCase.expired, testCase.z.Expired())
var resetZoneLength = 1
if testCase.z.duration == 0 {
resetZoneLength = 0
}
testCase.z.Reset(map[string]dns.ZoneSummary{
zoneIdQux: testPrivateZoneSummaryQux,
})
assert.Len(t, testCase.z.Get(), resetZoneLength)
})
}
}

View File

@ -20,6 +20,7 @@ import (
"context"
"os"
"strings"
"time"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/common/auth"
@ -51,6 +52,7 @@ type OCIAuthConfig struct {
type OCIConfig struct {
Auth OCIAuthConfig `yaml:"auth"`
CompartmentID string `yaml:"compartment"`
ZoneCacheDuration time.Duration
}
// OCIProvider is an implementation of Provider for Oracle Cloud Infrastructure
@ -63,6 +65,7 @@ type OCIProvider struct {
domainFilter endpoint.DomainFilter
zoneIDFilter provider.ZoneIDFilter
zoneScope string
zoneCache *zoneCache
dryRun bool
}
@ -135,11 +138,18 @@ func NewOCIProvider(cfg OCIConfig, domainFilter endpoint.DomainFilter, zoneIDFil
domainFilter: domainFilter,
zoneIDFilter: zoneIDFilter,
zoneScope: zoneScope,
zoneCache: &zoneCache{
duration: cfg.ZoneCacheDuration,
},
dryRun: dryRun,
}, nil
}
func (p *OCIProvider) zones(ctx context.Context) (map[string]dns.ZoneSummary, error) {
if !p.zoneCache.Expired() {
log.Debug("Using cached zones list")
return p.zoneCache.zones, nil
}
zones := make(map[string]dns.ZoneSummary)
scopes := []dns.GetZoneScopeEnum{dns.GetZoneScopeEnum(p.zoneScope)}
// If zone scope is empty, list all zones types.
@ -155,6 +165,7 @@ func (p *OCIProvider) zones(ctx context.Context) (map[string]dns.ZoneSummary, er
if len(zones) == 0 {
log.Warnf("No zones in compartment %q match domain filters %v", p.cfg.CompartmentID, p.domainFilter)
}
p.zoneCache.Reset(zones)
return zones, nil
}

View File

@ -21,6 +21,7 @@ import (
"sort"
"strings"
"testing"
"time"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/dns"
@ -137,6 +138,9 @@ func newOCIProvider(client ociDNSClient, domainFilter endpoint.DomainFilter, zon
domainFilter: domainFilter,
zoneIDFilter: zoneIDFilter,
zoneScope: zoneScope,
zoneCache: &zoneCache{
duration: 0 * time.Second,
},
dryRun: dryRun,
}
}

View File

@ -140,9 +140,6 @@ func (sc *httpProxySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint,
log.Debugf("Skipping HTTPProxy %s/%s because controller value does not match, found: %s, required: %s",
hp.Namespace, hp.Name, controller, controllerAnnotationValue)
continue
} else if hp.Status.CurrentStatus != "valid" {
log.Debugf("Skipping HTTPProxy %s/%s because it is not valid", hp.Namespace, hp.Name)
continue
}
hpEndpoints, err := sc.endpointsFromHTTPProxy(hp)
@ -244,11 +241,6 @@ func (sc *httpProxySource) filterByAnnotations(httpProxies []*projectcontour.HTT
// endpointsFromHTTPProxyConfig extracts the endpoints from a Contour HTTPProxy object
func (sc *httpProxySource) endpointsFromHTTPProxy(httpProxy *projectcontour.HTTPProxy) ([]*endpoint.Endpoint, error) {
if httpProxy.Status.CurrentStatus != "valid" {
log.Warn(errors.Errorf("cannot generate endpoints for HTTPProxy with status %s", httpProxy.Status.CurrentStatus))
return nil, nil
}
resource := fmt.Sprintf("HTTPProxy/%s/%s", httpProxy.Namespace, httpProxy.Name)
ttl := getTTLFromAnnotations(httpProxy.Annotations, resource)

View File

@ -269,14 +269,6 @@ func testEndpointsFromHTTPProxy(t *testing.T) {
httpProxy: fakeHTTPProxy{},
expected: []*endpoint.Endpoint{},
},
{
title: "one rule.host invalid httpproxy",
httpProxy: fakeHTTPProxy{
host: "foo.bar",
invalid: true,
},
expected: []*endpoint.Endpoint{},
},
{
title: "no targets",
httpProxy: fakeHTTPProxy{},
@ -1114,19 +1106,11 @@ type fakeHTTPProxy struct {
annotations map[string]string
host string
invalid bool
delegate bool
loadBalancer fakeLoadBalancerService
}
func (ir fakeHTTPProxy) HTTPProxy() *projectcontour.HTTPProxy {
var status string
if ir.invalid {
status = "invalid"
} else {
status = "valid"
}
var spec projectcontour.HTTPProxySpec
if ir.delegate {
spec = projectcontour.HTTPProxySpec{}
@ -1161,7 +1145,6 @@ func (ir fakeHTTPProxy) HTTPProxy() *projectcontour.HTTPProxy {
},
Spec: spec,
Status: projectcontour.HTTPProxyStatus{
CurrentStatus: status,
LoadBalancer: lb,
},
}

View File

@ -383,6 +383,27 @@ func testCRDSourceEndpoints(t *testing.T) {
expectEndpoints: true,
expectError: false,
},
{
title: "Create SRV record",
registeredAPIVersion: "test.k8s.io/v1alpha1",
apiVersion: "test.k8s.io/v1alpha1",
registeredKind: "DNSEndpoint",
kind: "DNSEndpoint",
namespace: "foo",
registeredNamespace: "foo",
labels: map[string]string{"test": "that"},
labelFilter: "test=that",
endpoints: []*endpoint.Endpoint{
{
DNSName: "_svc._tcp.example.org",
Targets: endpoint.Targets{"0 0 80 abc.example.org", "0 0 80 def.example.org"},
RecordType: endpoint.RecordTypeSRV,
RecordTTL: 180,
},
},
expectEndpoints: true,
expectError: false,
},
} {
ti := ti
t.Run(ti.title, func(t *testing.T) {

View File

@ -48,6 +48,7 @@ var kongGroupdVersionResource = schema.GroupVersionResource{
// kongTCPIngressSource is an implementation of Source for Kong TCPIngress objects.
type kongTCPIngressSource struct {
annotationFilter string
ignoreHostnameAnnotation bool
dynamicKubeClient dynamic.Interface
kongTCPIngressInformer informers.GenericInformer
kubeClient kubernetes.Interface
@ -56,7 +57,7 @@ type kongTCPIngressSource struct {
}
// NewKongTCPIngressSource creates a new kongTCPIngressSource with the given config.
func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string) (Source, error) {
func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string, ignoreHostnameAnnotation bool) (Source, error) {
var err error
// Use shared informer to listen for add/update/delete of Host in the specified namespace.
@ -86,6 +87,7 @@ func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Inte
return &kongTCPIngressSource{
annotationFilter: annotationFilter,
ignoreHostnameAnnotation: ignoreHostnameAnnotation,
dynamicKubeClient: dynamicKubeClient,
kongTCPIngressInformer: kongTCPIngressInformer,
kubeClient: kubeClient,
@ -210,10 +212,12 @@ func (sc *kongTCPIngressSource) endpointsFromTCPIngress(tcpIngress *TCPIngress,
providerSpecific, setIdentifier := getProviderSpecificAnnotations(tcpIngress.Annotations)
if !sc.ignoreHostnameAnnotation {
hostnameList := getHostnamesFromAnnotations(tcpIngress.Annotations)
for _, hostname := range hostnameList {
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
}
}
if tcpIngress.Spec.Rules != nil {
for _, rule := range tcpIngress.Spec.Rules {

View File

@ -42,6 +42,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
tcpProxy TCPIngress
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -220,6 +221,67 @@ func TestKongTCPIngressEndpoints(t *testing.T) {
},
},
},
{
title: "TCPIngress ignoring hostname annotation",
tcpProxy: TCPIngress{
TypeMeta: metav1.TypeMeta{
APIVersion: kongGroupdVersionResource.GroupVersion().String(),
Kind: "TCPIngress",
},
ObjectMeta: metav1.ObjectMeta{
Name: "tcp-ingress-both",
Namespace: defaultKongNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "d.example.com",
"kubernetes.io/ingress.class": "kong",
},
},
Spec: tcpIngressSpec{
Rules: []tcpIngressRule{
{
Port: 30004,
Host: "e.example.com",
},
{
Port: 30005,
Host: "f.example.com",
},
},
},
Status: tcpIngressStatus{
LoadBalancer: corev1.LoadBalancerStatus{
Ingress: []corev1.LoadBalancerIngress{
{
Hostname: "a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com",
},
},
},
},
},
ignoreHostnameAnnotation: true,
expected: []*endpoint.Endpoint{
{
DNSName: "e.example.com",
Targets: []string{"a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "tcpingress/kong/tcp-ingress-both",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
{
DNSName: "f.example.com",
Targets: []string{"a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "tcpingress/kong/tcp-ingress-both",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
},
},
{
title: "TCPIngress with target annotation",
tcpProxy: TCPIngress{
@ -300,7 +362,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(kongGroupdVersionResource).Namespace(defaultKongNamespace).Create(context.Background(), &tcpi, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewKongTCPIngressSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultKongNamespace, "kubernetes.io/ingress.class=kong")
source, err := NewKongTCPIngressSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultKongNamespace, "kubernetes.io/ingress.class=kong", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -312,7 +374,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}

View File

@ -555,6 +555,9 @@ func extractServiceIps(svc *v1.Service) endpoint.Targets {
}
func extractServiceExternalName(svc *v1.Service) endpoint.Targets {
if len(svc.Spec.ExternalIPs) > 0 {
return svc.Spec.ExternalIPs
}
return endpoint.Targets{svc.Spec.ExternalName}
}

View File

@ -3545,6 +3545,7 @@ func TestExternalServices(t *testing.T) {
labels map[string]string
annotations map[string]string
externalName string
externalIPs []string
expected []*endpoint.Endpoint
expectError bool
}{
@ -3562,6 +3563,7 @@ func TestExternalServices(t *testing.T) {
hostnameAnnotationKey: "service.example.org",
},
"111.111.111.111",
[]string{},
[]*endpoint.Endpoint{
{DNSName: "service.example.org", Targets: endpoint.Targets{"111.111.111.111"}, RecordType: endpoint.RecordTypeA},
},
@ -3581,6 +3583,7 @@ func TestExternalServices(t *testing.T) {
hostnameAnnotationKey: "service.example.org",
},
"2001:db8::111",
[]string{},
[]*endpoint.Endpoint{
{DNSName: "service.example.org", Targets: endpoint.Targets{"2001:db8::111"}, RecordType: endpoint.RecordTypeAAAA},
},
@ -3600,11 +3603,53 @@ func TestExternalServices(t *testing.T) {
hostnameAnnotationKey: "service.example.org",
},
"remote.example.com",
[]string{},
[]*endpoint.Endpoint{
{DNSName: "service.example.org", Targets: endpoint.Targets{"remote.example.com"}, RecordType: endpoint.RecordTypeCNAME},
},
false,
},
{
"annotated ExternalName service with externalIPs returns a single endpoint with multiple targets",
"",
"testing",
"foo",
v1.ServiceTypeExternalName,
"",
"",
false,
map[string]string{"component": "foo"},
map[string]string{
hostnameAnnotationKey: "service.example.org",
},
"service.example.org",
[]string{"10.2.3.4", "11.2.3.4"},
[]*endpoint.Endpoint{
{DNSName: "service.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{"10.2.3.4", "11.2.3.4"}},
},
false,
},
{
"annotated ExternalName service with externalIPs of dualstack addresses returns 2 endpoints with multiple targets",
"",
"testing",
"foo",
v1.ServiceTypeExternalName,
"",
"",
false,
map[string]string{"component": "foo"},
map[string]string{
hostnameAnnotationKey: "service.example.org",
},
"service.example.org",
[]string{"10.2.3.4", "11.2.3.4", "2001:db8::1", "2001:db8::2"},
[]*endpoint.Endpoint{
{DNSName: "service.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{"10.2.3.4", "11.2.3.4"}},
{DNSName: "service.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: endpoint.Targets{"2001:db8::1", "2001:db8::2"}},
},
false,
},
} {
tc := tc
t.Run(tc.title, func(t *testing.T) {
@ -3617,6 +3662,7 @@ func TestExternalServices(t *testing.T) {
Spec: v1.ServiceSpec{
Type: tc.svcType,
ExternalName: tc.externalName,
ExternalIPs: tc.externalIPs,
},
ObjectMeta: metav1.ObjectMeta{
Namespace: tc.svcNamespace,

View File

@ -300,7 +300,7 @@ func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg
if err != nil {
return nil, err
}
return NewTraefikSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter)
return NewTraefikSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter, cfg.IgnoreHostnameAnnotation)
case "openshift-route":
ocpClient, err := p.OpenShiftClient()
if err != nil {
@ -341,7 +341,7 @@ func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg
if err != nil {
return nil, err
}
return NewKongTCPIngressSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter)
return NewKongTCPIngressSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter, cfg.IgnoreHostnameAnnotation)
case "f5-virtualserver":
kubernetesClient, err := p.KubeClient()
if err != nil {

View File

@ -80,6 +80,7 @@ var (
type traefikSource struct {
annotationFilter string
ignoreHostnameAnnotation bool
dynamicKubeClient dynamic.Interface
ingressRouteInformer informers.GenericInformer
ingressRouteTcpInformer informers.GenericInformer
@ -92,7 +93,7 @@ type traefikSource struct {
unstructuredConverter *unstructuredConverter
}
func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string) (Source, error) {
func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string, ignoreHostnameAnnotation bool) (Source, error) {
// Use shared informer to listen for add/update/delete of Host in the specified namespace.
// Set resync period to 0, to prevent processing when nothing has changed.
informerFactory := dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicKubeClient, 0, namespace, nil)
@ -149,6 +150,7 @@ func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface,
return &traefikSource{
annotationFilter: annotationFilter,
ignoreHostnameAnnotation: ignoreHostnameAnnotation,
dynamicKubeClient: dynamicKubeClient,
ingressRouteInformer: ingressRouteInformer,
ingressRouteTcpInformer: ingressRouteTcpInformer,
@ -653,10 +655,12 @@ func (ts *traefikSource) endpointsFromIngressRoute(ingressRoute *IngressRoute, t
providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations)
if !ts.ignoreHostnameAnnotation {
hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations)
for _, hostname := range hostnameList {
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
}
}
for _, route := range ingressRoute.Spec.Routes {
match := route.Match
@ -687,10 +691,12 @@ func (ts *traefikSource) endpointsFromIngressRouteTCP(ingressRoute *IngressRoute
providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations)
if !ts.ignoreHostnameAnnotation {
hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations)
for _, hostname := range hostnameList {
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
}
}
for _, route := range ingressRoute.Spec.Routes {
match := route.Match
@ -722,10 +728,12 @@ func (ts *traefikSource) endpointsFromIngressRouteUDP(ingressRoute *IngressRoute
providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations)
if !ts.ignoreHostnameAnnotation {
hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations)
for _, hostname := range hostnameList {
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
}
}
return endpoints, nil
}

View File

@ -41,6 +41,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRoute IngressRoute
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -248,6 +249,54 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRoute ignoring annotation",
ingressRoute: IngressRoute{
TypeMeta: metav1.TypeMeta{
APIVersion: ingressrouteGVR.GroupVersion().String(),
Kind: "IngressRoute",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressroute-multi-host-annotations-match",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "f.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
Spec: traefikIngressRouteSpec{
Routes: []traefikRoute{
{
Match: "Host(`g.example.com`, `h.example.com`)",
},
},
},
},
ignoreHostnameAnnotation: true,
expected: []*endpoint.Endpoint{
{
DNSName: "g.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
{
DNSName: "h.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
},
},
{
title: "IngressRoute omit wildcard",
ingressRoute: IngressRoute{
@ -299,7 +348,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(ingressrouteGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -311,7 +360,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}
@ -322,6 +371,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRouteTCP IngressRouteTCP
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -493,6 +543,54 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRouteTCP ignoring annotation",
ingressRouteTCP: IngressRouteTCP{
TypeMeta: metav1.TypeMeta{
APIVersion: ingressrouteTCPGVR.GroupVersion().String(),
Kind: "IngressRouteTCP",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressroutetcp-multi-host-annotations-match",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "f.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
Spec: traefikIngressRouteTCPSpec{
Routes: []traefikRouteTCP{
{
Match: "HostSNI(`g.example.com`, `h.example.com`)",
},
},
},
},
ignoreHostnameAnnotation: true,
expected: []*endpoint.Endpoint{
{
DNSName: "g.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
{
DNSName: "h.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
},
},
{
title: "IngressRouteTCP omit wildcard host sni",
ingressRouteTCP: IngressRouteTCP{
@ -544,7 +642,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(ingressrouteTCPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -556,7 +654,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}
@ -567,6 +665,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRouteUDP IngressRouteUDP
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -639,6 +738,26 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRouteTCP ignoring hostname annotation",
ingressRouteUDP: IngressRouteUDP{
TypeMeta: metav1.TypeMeta{
APIVersion: ingressrouteUDPGVR.GroupVersion().String(),
Kind: "IngressRouteUDP",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressrouteudp-annotation",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "a.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
},
ignoreHostnameAnnotation: true,
expected: nil,
},
} {
ti := ti
t.Run(ti.title, func(t *testing.T) {
@ -665,7 +784,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(ingressrouteUDPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -677,7 +796,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}
@ -688,6 +807,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRoute IngressRoute
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -895,6 +1015,54 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRoute ignoring annotation",
ingressRoute: IngressRoute{
TypeMeta: metav1.TypeMeta{
APIVersion: oldIngressrouteGVR.GroupVersion().String(),
Kind: "IngressRoute",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressroute-multi-host-annotations-match",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "f.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
Spec: traefikIngressRouteSpec{
Routes: []traefikRoute{
{
Match: "Host(`g.example.com`, `h.example.com`)",
},
},
},
},
ignoreHostnameAnnotation: true,
expected: []*endpoint.Endpoint{
{
DNSName: "g.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
{
DNSName: "h.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
},
},
{
title: "IngressRoute omit wildcard",
ingressRoute: IngressRoute{
@ -946,7 +1114,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(oldIngressrouteGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -958,7 +1126,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}
@ -969,6 +1137,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRouteTCP IngressRouteTCP
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -1140,6 +1309,54 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRouteTCP ignoring annotation",
ingressRouteTCP: IngressRouteTCP{
TypeMeta: metav1.TypeMeta{
APIVersion: oldIngressrouteTCPGVR.GroupVersion().String(),
Kind: "IngressRouteTCP",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressroutetcp-multi-host-annotations-match",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "f.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
Spec: traefikIngressRouteTCPSpec{
Routes: []traefikRouteTCP{
{
Match: "HostSNI(`g.example.com`, `h.example.com`)",
},
},
},
},
ignoreHostnameAnnotation: true,
expected: []*endpoint.Endpoint{
{
DNSName: "g.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
{
DNSName: "h.example.com",
Targets: []string{"target.domain.tld"},
RecordType: endpoint.RecordTypeCNAME,
RecordTTL: 0,
Labels: endpoint.Labels{
"resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match",
},
ProviderSpecific: endpoint.ProviderSpecific{},
},
},
},
{
title: "IngressRouteTCP omit wildcard host sni",
ingressRouteTCP: IngressRouteTCP{
@ -1191,7 +1408,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(oldIngressrouteTCPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -1203,7 +1420,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}
@ -1214,6 +1431,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) {
for _, ti := range []struct {
title string
ingressRouteUDP IngressRouteUDP
ignoreHostnameAnnotation bool
expected []*endpoint.Endpoint
}{
{
@ -1286,6 +1504,26 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) {
},
},
},
{
title: "IngressRouteTCP ignoring hostname annotation",
ingressRouteUDP: IngressRouteUDP{
TypeMeta: metav1.TypeMeta{
APIVersion: oldIngressrouteUDPGVR.GroupVersion().String(),
Kind: "IngressRouteUDP",
},
ObjectMeta: metav1.ObjectMeta{
Name: "ingressrouteudp-annotation",
Namespace: defaultTraefikNamespace,
Annotations: map[string]string{
"external-dns.alpha.kubernetes.io/hostname": "a.example.com",
"external-dns.alpha.kubernetes.io/target": "target.domain.tld",
"kubernetes.io/ingress.class": "traefik",
},
},
},
ignoreHostnameAnnotation: true,
expected: nil,
},
} {
ti := ti
t.Run(ti.title, func(t *testing.T) {
@ -1312,7 +1550,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) {
_, err = fakeDynamicClient.Resource(oldIngressrouteUDPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{})
assert.NoError(t, err)
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik")
source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation)
assert.NoError(t, err)
assert.NotNil(t, source)
@ -1324,7 +1562,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) {
endpoints, err := source.Endpoints(context.Background())
assert.NoError(t, err)
assert.Len(t, endpoints, len(ti.expected))
assert.Equal(t, endpoints, ti.expected)
assert.Equal(t, ti.expected, endpoints)
})
}
}