Skip to content

Conversation

@Tzvonimir
Copy link
Contributor

@Tzvonimir Tzvonimir commented Dec 17, 2025

Summary by CodeRabbit

  • Chores
    • Enhanced Kubernetes deployment flexibility: Node exporter deployment configuration now supports optional affinity, node selector, and tolerations settings through Helm values, enabling fine-grained control over pod placement. Default behavior remains unchanged when values are not provided.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

The Helm chart's node-exporter DaemonSet template is refactored to externalize hard-coded affinity, nodeSelector, and tolerations configurations. These are now conditionally rendered from corresponding Helm values, enabling users to customize pod scheduling constraints without modifying the template.

Changes

Cohort / File(s) Change Summary
Helm DaemonSet Template Configuration
helm-chart/zxporter/templates/node-exporter-daemonset.yaml
Replaced hard-coded nodeAffinity with conditional rendering of .Values.affinity. Added conditional rendering blocks for .Values.nodeSelector and .Values.tolerations. All blocks render only when values are provided.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file modification with consistent templating patterns
  • Verify YAML indentation and Helm template syntax (toYaml filters, conditional blocks)
  • Confirm no breaking changes to default behavior when values are absent

Poem

🐰 A DaemonSet now flexible and free,
No longer chained to one affinity!
NodeSelector, tolerations, affinity too—
Configurable values for what you choose,
The chart dances softly in helm's gentle breeze! 🌬️

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for affinities, tolerations, and node selectors in the Helm chart template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tzvonimir/affinities-tolerations-etc

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e2d792 and bc4fffc.

📒 Files selected for processing (1)
  • helm-chart/zxporter/templates/node-exporter-daemonset.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Docker Image
  • GitHub Check: Run make test
  • GitHub Check: Build Docker Image
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
helm-chart/zxporter/templates/node-exporter-daemonset.yaml (2)

124-129: LGTM!

The tolerations implementation correctly preserves the hard-coded NoSchedule/Exists toleration (line 125-126) while allowing users to append additional tolerations. Since tolerations are list items, there's no risk of conflicts when merging user-provided values.


115-118: No breaking change—conditional affinity rendering is correct.

The default values file provides affinity: {}, so the conditional rendering at lines 115-118 works as intended. Users can override this by providing custom affinity rules via .Values.affinity.

Comment on lines 119 to +123
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard against duplicate nodeSelector keys.

The hard-coded kubernetes.io/os: linux selector at line 120 will conflict if users provide the same key in .Values.nodeSelector. While most YAML parsers will accept duplicate keys and use the last value, this creates confusion and is technically invalid YAML.

Consider one of these approaches:

Option 1: Remove the hard-coded selector and include it in default values

      nodeSelector:
-        kubernetes.io/os: linux
         {{- with .Values.nodeSelector }}
         {{- toYaml . | nindent 8 }}
         {{- end }}

Then ensure values.yaml contains:

nodeSelector:
  kubernetes.io/os: linux

Option 2: Keep hard-coded and document the restriction

Add a comment above line 119:

+      # Note: kubernetes.io/os is hard-coded to "linux". Do not override in .Values.nodeSelector
       nodeSelector:
         kubernetes.io/os: linux
🤖 Prompt for AI Agents
In helm-chart/zxporter/templates/node-exporter-daemonset.yaml around lines
119-123 there is a hard-coded nodeSelector key kubernetes.io/os: linux that may
duplicate a user-provided key in .Values.nodeSelector; either remove the
hard-coded entry and add kubernetes.io/os: linux to the chart's values.yaml
default nodeSelector, or keep the hard-coded entry and add a clear comment above
these lines documenting that users must not set kubernetes.io/os in
.Values.nodeSelector (and optionally validate/merge values in _helpers.tpl to
avoid duplicates).

@Tzvonimir Tzvonimir merged commit 8ea9185 into main Dec 17, 2025
25 checks passed
@Tzvonimir Tzvonimir deleted the tzvonimir/affinities-tolerations-etc branch December 17, 2025 14:15
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.

4 participants