Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only create PTR records for endpoints with hostname defined #6623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisohaver
Copy link
Member

@chrisohaver chrisohaver commented Apr 20, 2024

1. Why is this pull request needed and what does it do?

Per discussion in https://kubernetes.slack.com/archives/C09QYUH5W/p1713088975540039,

We should only be creating PTR records for Endpoints that have a hostname defined in the endpoint address object.
This should normally result in producing one PTR record for each IP, even if multiple Services select the same Pod. K8s enforces that only one endpoints has a hostname defined at any time. If for some reason more than one have hostname defined, we will return both rather than select one arbitrarily - but IIUC, this would only happen if something is awry in k8s.

2. Which issues (if any) are related?

https://kubernetes.slack.com/archives/C09QYUH5W/p1713088975540039

3. Which documentation changes (if any) need to be made?

4. Does this introduce a backward incompatible change or deprecation?

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
@chrisohaver
Copy link
Member Author

Circleci k8s PTR tests need adjusted.

Copy link
Collaborator

@bradbeam bradbeam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from fixing tests it seems reasonable

@chrisohaver
Copy link
Member Author

State of the tests...

--- FAIL: TestKubernetesPTR (3.53s)
    --- PASS: TestKubernetesPTR/100.0.96.10.in-addr.arpa._PTR (0.13s)
    --- FAIL: TestKubernetesPTR/253.0.17.172.in-addr.arpa._PTR (0.24s)
    --- FAIL: TestKubernetesPTR/1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.c.b.a.4.3.2.1.ip6.arpa._PTR (0.19s)
    --- PASS: TestKubernetesPTR/120.0.96.10.in-addr.arpa._PTR (0.10s)
    --- PASS: TestKubernetesPTR/252.0.17.172.in-addr.arpa._PTR (0.10s)
    --- PASS: TestKubernetesPTR/200.0.17.172.in-addr.arpa._PTR (0.10s)

The latter 3 tests (4th-6th) pass because they are negative tests expecting NXDOMAINs.

The 2nd and 3rd fail because they are explicitly defined Endpoints without hostname defined. The test uses explicitly defined Endpoints so that IPs for headless services are static. Hopefully we can explicitly define hostnames for these endpoints. I'll have to play with it.

The test object creation yaml ...

https://github.com/coredns/ci/blob/master/build/kubernetes/dns-test.yaml

@chrisohaver
Copy link
Member Author

Adjusted tests: coredns/ci#153

@chrisohaver
Copy link
Member Author

Since with this change we will no longer produce PTR records that we did previously, I think we may want to defer this change to the next minor release - or make the next release a minor release (per coredns backward compatibility change policy).

@chrisohaver
Copy link
Member Author

I've reverted the adjusted tests, since they don't work as expected.

I suspect we may need to re-write all A/AAAA, SRV, and PTR tests for Headless Services to work with dynamically assigned Pod IP instead of relying on manually defined Endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants