Skip to content

feat(dns,cni): cluster-domain derivation (241/242) + topology-aware peer latency (245) - #27

Merged
mattmattox merged 1 commit into
mainfrom
feat/prod-hardening-1283-v2
Jul 4, 2026
Merged

feat(dns,cni): cluster-domain derivation (241/242) + topology-aware peer latency (245)#27
mattmattox merged 1 commit into
mainfrom
feat/prod-hardening-1283-v2

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Summary

Remaining feature-1283 tasks, code + tests only — no prod roll of the DNS cluster-DNS re-enable (it's a gated decision; see below).

241/242 — derive cluster domain from resolv.conf

The DNS monitor now derives the in-cluster probe target from /etc/resolv.conf search domains → kubernetes.default.svc.<derived>, instead of hardcoding cluster.local. Hardcoding cluster.local produces a fleet-wide false ClusterDNSResolutionFailed on custom-cluster-domain clusters — the root cause of the original incident.
Safety: derivation is the default only when clusterDomains is nil. An explicit empty slice (clusterDomains: [], the current live mitigation) is left untouched, so this does not re-enable the check on the fleet. 242's pod-network intent is met by probing the derived domain through the cluster resolver (node-doctor runs ClusterFirstWithHostNet).

245 — topology-aware peer latency

Peer discovery tags each peer with its node's topology.kubernetes.io/zone and computes SameZone. Cross-zone peers use crossZoneWarningLatency/crossZoneCriticalLatency when set, so normal inter-site WAN latency doesn't raise a false NetworkDegraded. Inert by default (no zone labels or no cross-zone thresholds → unchanged behaviour). Chart RBAC already grants nodes: list.

Tests

  • Cluster-domain: standard/custom/fallback + explicit-empty-stays-disabled, resolv.conf parsing.
  • Topology: threshold selection, config parsing, discovery zone population (cross/same-zone + unlabeled inert path).

⚠️ Gated deploy

Re-enabling the cluster-DNS check (setting clusterDomains non-empty to use the new derivation) re-introduces the exact check whose false-positive caused the incident. Merge the code freely; the config change to re-enable must be a watched-window decision. 245 and the derivation code are safe/inert and can ship in a normal v1.8.3 roll.

Tasks: #19560/#19561 (241/242), #19564 (245)

…ology-aware peer latency (245)

241/242 — DNS monitor now derives the in-cluster probe target from /etc/resolv.conf
'search' domains (kubernetes.default.svc.<derived>) instead of hardcoding cluster.local.
A hardcoded cluster.local produces a fleet-wide false ClusterDNSResolutionFailed on
clusters with a CUSTOM cluster domain (the target does not resolve) — the root cause of
the original incident. Derivation is the DEFAULT only when clusterDomains is nil; an
explicit empty slice (cluster DNS disabled, the current live mitigation) is left untouched,
so this change does NOT re-enable the check on the fleet — re-enabling stays a config
decision. 242's pod-network intent is satisfied by probing the derived domain through the
cluster resolver (node-doctor uses ClusterFirstWithHostNet).

245 — peer latency is now topology-aware. Discovery tags each peer with its node's
topology.kubernetes.io/zone label and computes SameZone relative to this node; cross-zone
peers use CrossZoneWarningLatency/CrossZoneCriticalLatency when configured, so normal
inter-site WAN latency does not raise a false NetworkDegraded. Inert by default: with no
zone labels OR no cross-zone thresholds set, behaviour is unchanged.

Tests: cluster-domain derivation (standard/custom/fallback/disabled-stays-disabled),
resolv.conf parsing, topology threshold selection + config parsing, discovery zone
population (labeled cross/same-zone and unlabeled inert path). Chart RBAC already grants
nodes list.

Tasks: #19560/#19561 (241/242), #19564 (245). NOTE: DNS cluster-DNS re-enable is a GATED
deploy decision (re-enables the incident check) — code shipped, roll deferred.
// cluster domain from its `search` line. Returns ("", false) if the file can't be read
// or no cluster domain can be identified.
func deriveClusterDomainFromResolver(resolverPath string) (string, bool) {
file, err := os.Open(resolverPath)
@mattmattox
mattmattox merged commit 517338e into main Jul 4, 2026
9 of 10 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d14472d400

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 1250 to +1251
if c.ClusterDomains == nil {
c.ClusterDomains = []string{"kubernetes.default.svc.cluster.local"}
c.ClusterDomains = defaultClusterDomains(c.ResolverPath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive domains for auto-applied DNS defaults

For deployments that omit network-dns-check and let ApplyDefaultMonitors add dns-health, this nil-only default path is never reached: MonitorInfo.DefaultConfig in this file still supplies a non-nil clusterDomains slice containing kubernetes.default.svc.cluster.local, and ApplyDefaultMonitors copies it before parseDNSConfig/applyDefaults. On custom-cluster-domain clusters, that auto-enabled default continues to probe cluster.local and emits the same false ClusterDNSResolutionFailed this change is meant to avoid; make the registered default omit clusterDomains or derive there too.

Useful? React with 👍 / 👎.

// Check for high latency (collect but don't emit individual events).
// Cross-zone peers use the looser cross-zone warning threshold when configured,
// so normal inter-site WAN latency does not raise a false NetworkDegraded.
if peerStatus.AvgLatency > m.warningLatencyFor(result.peer) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the configured critical latency thresholds

When crossZoneCriticalLatency is set without crossZoneWarningLatency (or when criticalLatency is intentionally the effective lower same-zone threshold), this new check only compares average latency to warningLatencyFor(), which never reads CriticalLatency or CrossZoneCriticalLatency. Those configured critical thresholds therefore have no effect, so cross-zone WAN peers can still be marked degraded at the same-zone warning threshold unless operators also set the new warning threshold.

Useful? React with 👍 / 👎.

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.

2 participants