Skip to content

feat(helm): support dnsConfig on the forwarder deployment#2124

Open
DrFaust92 wants to merge 2 commits into
robusta-dev:masterfrom
DrFaust92:dnsconfig-forwarder
Open

feat(helm): support dnsConfig on the forwarder deployment#2124
DrFaust92 wants to merge 2 commits into
robusta-dev:masterfrom
DrFaust92:dnsconfig-forwarder

Conversation

@DrFaust92

Copy link
Copy Markdown
Contributor

What

The runner Deployment already supports a configurable dnsPolicy / dnsConfig (runner.dnsConfig.*), but the forwarder (kubewatch) does not — it's stuck on the implicit ClusterFirst policy.

This PR extracts the runner's inline dnsConfig logic into a shared robusta.dnsConfig helper and uses it from both the runner and the forwarder, and adds a matching kubewatch.dnsConfig block to values.yaml.

Why

Users who need custom DNS (e.g. dnsPolicy: None with explicit nameservers/searches, or custom ndots options) can already configure it for the runner but had no way to do the same for the forwarder pod.

Details

  • New robusta.dnsConfig helper in _helpers.tpl — centralizes the dnsPolicy, the optional dnsConfig block, the "None requires at least one of nameservers/searches/options" guard, and the ClusterFirst fallback.
  • runner.yaml now calls the helper (removes ~26 lines of inline logic).
  • forwarder.yaml calls the same helper before containers:.
  • values.yaml gains a kubewatch.dnsConfig block mirroring runner.dnsConfig.

Backwards compatibility

Defaults are unchanged (dnsConfig.enabled: false), so both deployments still render dnsPolicy: ClusterFirst. The runner's rendered output is byte-for-byte identical.

Verified with helm template:

  • default → dnsPolicy: ClusterFirst on both deployments
  • enabled: true + policy: None + nameservers → correct dnsConfig nesting
  • policy: None with no config → still hard-fails via the guard

🤖 Generated with Claude Code

The runner Deployment already supported a configurable dnsPolicy /
dnsConfig, but the forwarder (kubewatch) did not and was stuck on the
implicit ClusterFirst policy.

Extract the runner's inline dnsConfig logic into a shared
`robusta.dnsConfig` helper (including the "None requires config" guard
and the ClusterFirst fallback) and use it from both the runner and the
forwarder. Add a matching `kubewatch.dnsConfig` block to values.yaml.

Defaults are unchanged: dnsConfig.enabled is false, so both deployments
still render `dnsPolicy: ClusterFirst`. The runner's rendered output is
byte-for-byte identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 193cfb31-f913-4a73-a822-19fd24db0f5f

📥 Commits

Reviewing files that changed from the base of the PR and between dd2c56b and 04e30f0.

📒 Files selected for processing (1)
  • helm/robusta/templates/_helpers.tpl
🚧 Files skipped from review as they are similar to previous changes (1)
  • helm/robusta/templates/_helpers.tpl

Walkthrough

A reusable Helm helper now renders validated DNS settings with a ClusterFirst fallback. The runner and forwarder pod templates use the helper, and Kubewatch receives disabled DNS configuration defaults.

Changes

Helm DNS configuration

Layer / File(s) Summary
DNS helper validation and rendering
helm/robusta/templates/_helpers.tpl
Adds robusta.dnsConfig, validates dnsPolicy: None, renders optional DNS fields, and defaults to ClusterFirst.
Deployment wiring and defaults
helm/robusta/templates/runner.yaml, helm/robusta/templates/forwarder.yaml, helm/robusta/values.yaml
Replaces runner inline logic, adds forwarder DNS rendering, and defines disabled Kubewatch DNS defaults.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change by highlighting DNS config support for the forwarder deployment.
Description check ✅ Passed The description directly matches the DNS config refactor and forwarder support in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@helm/robusta/templates/_helpers.tpl`:
- Around line 21-26: Update the dnsConfig validation around .enabled to tolerate
a null or missing configuration object and use the established default for
.policy when it is absent. For an effective policy of None, require .nameservers
to exist and be non-empty; do not accept only .searches or .options. Render
dnsPolicy using the resolved fallback policy so the template never emits an
empty value or panics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 835affbb-f52f-4a67-b9f7-6d7b1939b35b

📥 Commits

Reviewing files that changed from the base of the PR and between eb350a4 and dd2c56b.

📒 Files selected for processing (4)
  • helm/robusta/templates/_helpers.tpl
  • helm/robusta/templates/forwarder.yaml
  • helm/robusta/templates/runner.yaml
  • helm/robusta/values.yaml

Comment thread helm/robusta/templates/_helpers.tpl Outdated
Address CodeRabbit feedback on the dnsConfig helper:

- When dnsPolicy is "None", Kubernetes requires at least one nameserver
  (searches/options alone are rejected by the API server). Tighten the
  guard to require .nameservers specifically instead of any config field.
- Tolerate a null/missing dnsConfig object (`and . .enabled`) and default
  .policy to "ClusterFirst" when unset, so the template never panics or
  emits an empty `dnsPolicy: ""`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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