No PTR records generated for headless service if hostname was not set.
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 521
- PR merge metrics
- No merged PRs in 30d
Description
If there is no hostname entry on an endpoint of a headless service, a DNS record is created with a hostname part based on some sort of hash, ultimately derived from the pod ip:
https://github.com/kubernetes/dns/blob/master/pkg/dns/dns.go#L486
The PTR record is then explicitly not generated:
https://github.com/kubernetes/dns/blob/master/pkg/dns/dns.go#L503
The spec states:
>Given a _ready_ endpoint with _hostname_ of <hostname> and IP address <a>.<b>.<c>.<d>, a PTR record of the following form must exist.
_hostname_ is defined earlier as the value of the hostname field on the endpoint or a "unique, system-assigned identifier", which in this case is the hash generated on line 486.
I would expect either of the following:
- A PTR records is always generated, dropping the conditional on line 503, satisfying the spec.
- No DNS records are generated in these cases and the spec is updated to reflect this behaviour.
Contributor guide
Research direction
Start in pkg/dns/dns.go at the hostname derivation around line 486 and the PTR-record condition around line 503, then compare that behavior with the endpoint hostname and PTR requirements quoted in the issue. Determine which behavior is intended, update the implementation or specification accordingly, and add or adjust coverage so the headless-service case is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100