Skip to content

fix(dns): don't emit ClusterDNSDown when clusterDomains empty (unmasks pod probe) - #29

Merged
mattmattox merged 1 commit into
mainfrom
fix/dns-clusterdown-conflict-when-disabled
Jul 4, 2026
Merged

fix(dns): don't emit ClusterDNSDown when clusterDomains empty (unmasks pod probe)#29
mattmattox merged 1 commit into
mainfrom
fix/dns-clusterdown-conflict-when-disabled

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Summary

Found live during the task-242 cluster-DNS re-enable roll. Two monitors were writing ClusterDNSDown: the new cluster-dns-pod monitor (pod-network truth) and the dns-health monitor. With clusterDomains: [] (the hostNetwork default), checkDNSDomains over zero domains trivially returns true, so dns-health emitted an unconditional ClusterDNSDown=False — which would mask the pod monitor's True on a real cluster-DNS outage. Live symptom: the condition's reason was ClusterDNSResolved (dns-health) instead of ClusterDNSResolvedViaPods (pod monitor).

Fix

Guard the ClusterDNSDown emission in updateFailureTracking on len(ClusterDomains) > 0. The DNS monitor owns the condition only when it is actually checking cluster domains; otherwise the cluster-dns-pod monitor owns it exclusively. ExternalDNSDown and all other behavior unchanged.

Tests

  • clusterDomains empty → no ClusterDNSDown emitted (healthy OR after repeated failures); ExternalDNSDown still emitted.
  • clusterDomains set → normal False (healthy) / True (past threshold) emission preserved.

Required for the 242 re-enable to reliably detect cluster-DNS failures (currently deployed at v1.8.3 rev 16). Ships in v1.8.4.

…flict with pod probe)

When clusterDomains: [] (the hostNetwork default — the agent can't resolve ClusterIP
cluster records via Cilium, so the in-agent cluster check is disabled), checkDNSDomains
trivially returns true, making the DNS monitor emit an unconditional ClusterDNSDown=False.
That masks the pod-network cluster-dns-pod monitor's real ClusterDNSDown=True: two monitors
were writing the same condition and the disabled dns-health check would win with a false
'healthy'. Guard the ClusterDNSDown emission on len(ClusterDomains) > 0 so the DNS monitor
only owns the condition when it is actually checking cluster domains; otherwise the
cluster-dns-pod monitor owns it exclusively. ExternalDNSDown is unaffected.

Found live during the 242 re-enable roll: ClusterDNSDown showed reason 'ClusterDNSResolved'
(dns-health) instead of 'ClusterDNSResolvedViaPods' (pod monitor). Tests: no ClusterDNSDown
when clusterDomains empty (healthy or failing); normal True/False emission when set.
@mattmattox
mattmattox merged commit ac09aa1 into main Jul 4, 2026
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: 8d3f77c1e1

ℹ️ 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".

// unconditional ClusterDNSDown=False and MASK a real ClusterDNSDown=True reported by
// the pod-network cluster-dns-pod monitor (which owns this condition when the in-agent
// check is disabled). So skip the emission entirely when no cluster domains are set.
if len(m.config.ClusterDomains) > 0 {

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 Clear stale ClusterDNSDown when cluster checks are disabled

When clusterDomains: [] and the pod monitor is not enabled/running, this guard stops the DNS monitor from writing ClusterDNSDown at all. Existing NodeDoctorClusterDNSDown=True values are preserved on startup because retiredDNSConditionTypes does not include it (pkg/exporters/kubernetes/condition_manager.go:237), and the Kubernetes exporter only updates conditions present in each status, so an upgrade or config reload from a failing cluster-domain check to disabled cluster checks leaves the old True condition latched indefinitely instead of clearing/removing it. Please either remove/clear the condition when disabling the in-agent check or ensure another owner is configured before suppressing both True and False writes.

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.

1 participant