Skip to content

No PTR records generated for headless service if hostname was not set. #117

Description

@stroop23

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions