Skip to content

Conversation

@lb0o
Copy link

@lb0o lb0o commented Jul 22, 2025

[feature] kubespan support and conditional scheduling options in values.yaml

Corrected attempt from #69 to add kubespan templating values and allowschedulingoncontrolplanes options

I noticed that discovery is set to false by default in talm template, but I confuse that talos documentation mention to set it to true by default: https://www.talos.dev/v1.10/talos-guides/network/kubespan/

"In order to enable KubeSpan on an existing cluster, enable kubespan and discovery settings in the machine config for each machine in the cluster (discovery is enabled by default):"

Summary by CodeRabbit

  • New Features
    • Added configuration options to enable the "kubespan" feature and control scheduling on control plane nodes in CozyStack and Generic charts.
  • Chores
    • Updated default configuration files to include new settings for enhanced customization.

@coderabbitai
Copy link

coderabbitai bot commented Jul 22, 2025

Walkthrough

Conditional logic was added to Helm chart templates to enable the "kubespan" feature and control scheduling on control planes based on new configuration keys. The values.yaml files for both the cozystack and generic charts were updated to introduce kubespan and allowSchedulingOnControlPlanes options with default values.

Changes

File(s) Change Summary
charts/cozystack/templates/_helpers.tpl,
charts/generic/templates/_helpers.tpl
Added conditional logic to enable "kubespan" in the network configuration and make scheduling on control planes configurable.
charts/cozystack/values.yaml,
charts/generic/values.yaml
Added kubespan (default: false) and allowSchedulingOnControlPlanes (default: true) configuration keys.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HelmChart
    participant Template
    participant Kubernetes

    User->>HelmChart: Set values (kubespan, allowSchedulingOnControlPlanes)
    HelmChart->>Template: Render templates with values
    Template-->>Kubernetes: Generate manifests with conditional sections
    Kubernetes-->>User: Deploy resources with/without kubespan and scheduling enabled
Loading

Estimated code review effort

2 (~15 minutes)

Poem

In YAML fields and templates deep,
New flags awake from restful sleep.
Kubespan toggles, control planes choose,
With values set, you cannot lose.
Helm charts now dance with greater might—
Configurable magic, pure delight!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 592f292 and 2a0e3e6.

⛔ Files ignored due to path filters (1)
  • pkg/generated/presets.go is excluded by !**/generated/**
📒 Files selected for processing (4)
  • charts/cozystack/templates/_helpers.tpl (3 hunks)
  • charts/cozystack/values.yaml (1 hunks)
  • charts/generic/templates/_helpers.tpl (1 hunks)
  • charts/generic/values.yaml (1 hunks)
🪛 YAMLlint (1.37.1)
charts/cozystack/values.yaml

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

charts/generic/values.yaml

[error] 10-10: no new line character at the end of file

(new-line-at-end-of-file)

🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/cozystack/templates/_helpers.tpl
  • charts/generic/templates/_helpers.tpl
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/cozystack/values.yaml

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

charts/generic/values.yaml

[error] 10-10: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
charts/generic/values.yaml (1)

9-9: Double-check default for kubespan

Talos docs (v1.10) indicate KubeSpan discovery is enabled by default. Shipping this chart with kubespan: false may surprise users and break cross-cluster networking unless they explicitly flip the flag.
Please confirm the intended UX and, if alignment with upstream defaults is desired, switch to true.

charts/cozystack/values.yaml (1)

13-13: Validate kubespan default

As with the generic chart, kubespan is set to false, diverging from Talos’ documented default. Verify this is intentional across both charts to avoid inconsistent behaviour.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @lb0o, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Helm charts by introducing new configuration options for Talos Linux clusters. It specifically adds support for enabling KubeSpan and controlling workload scheduling on control plane nodes directly through the values.yaml file, improving flexibility and ease of deployment. The changes also align the discovery setting with the kubespan option, addressing a noted inconsistency.

Highlights

  • KubeSpan Support: I've introduced a new kubespan option in the values.yaml files for both the cozystack and generic Helm charts. This allows users to easily enable KubeSpan functionality by setting kubespan: true.
  • Conditional Scheduling on Control Planes: The allowSchedulingOnControlPlanes option is now configurable via values.yaml. This provides granular control over whether workloads can be scheduled on Kubernetes control plane nodes, defaulting to true.
  • Talos Discovery Setting Alignment: I've updated the discovery.enabled setting in the Talos machine configuration templates (_helpers.tpl) to directly reflect the kubespan value. This addresses a discrepancy noted in the PR description regarding the default discovery setting in Talos documentation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for KubeSpan and makes scheduling on control planes configurable via values.yaml. The changes are consistently applied across the cozystack and generic charts.

My review focuses on improving the maintainability and readability of the Helm templates. I've suggested simplifying boolean checks and value outputs to be more idiomatic. I also noted a missing newline in the values.yaml files.

Comment on lines +58 to +61
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}

Choose a reason for hiding this comment

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

medium

For better readability and to follow idiomatic Helm templating, you can simplify this boolean check.

Instead of {{- if eq .Values.kubespan true }}, you can directly use {{- if .Values.kubespan }}. This is a more concise way to check if a boolean value is true.

    {{- if .Values.kubespan }}
    kubespan:
      enabled: true
    {{- end }}

endpoint: "{{ .Values.endpoint }}"
{{- if eq .MachineType "controlplane" }}
allowSchedulingOnControlPlanes: true
allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }}

Choose a reason for hiding this comment

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

medium

This logic can be simplified. Since .Values.allowSchedulingOnControlPlanes is a boolean, you can print its value directly instead of using an if/else block. This makes the template cleaner and easier to read.

  allowSchedulingOnControlPlanes: {{ .Values.allowSchedulingOnControlPlanes }}

oidcIssuerUrl: ""
certSANs: []
kubespan: false
allowSchedulingOnControlPlanes: true

Choose a reason for hiding this comment

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

medium

It's a best practice for YAML files (and text files in general) to end with a newline character. Some tools might have issues parsing files that don't end with a newline.

allowSchedulingOnControlPlanes: true

Comment on lines +18 to +21
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}

Choose a reason for hiding this comment

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

medium

To improve readability and adhere to common Helm templating practices, this boolean check can be simplified.

The expression {{- if eq .Values.kubespan true }} can be shortened to {{- if .Values.kubespan }}.

    {{- if .Values.kubespan }}
    kubespan:
      enabled: true
    {{- end }}

- 192.168.100.0/24
certSANs: []
kubespan: false
allowSchedulingOnControlPlanes: true

Choose a reason for hiding this comment

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

medium

It's a best practice for YAML files to end with a newline character. This ensures compatibility with various tools and follows standard conventions.

allowSchedulingOnControlPlanes: true

Comment on lines +88 to +91
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}

Choose a reason for hiding this comment

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

medium

The boolean check within this template string can be simplified for better readability, following idiomatic Go template syntax.

Instead of {{- if eq .Values.kubespan true }}, you can use the more concise {{- if .Values.kubespan }}.

Suggested change
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}
{{- if .Values.kubespan }}\n kubespan:\n enabled: true\n {{- end }}

endpoint: "{{ .Values.endpoint }}"
{{- if eq .MachineType "controlplane" }}
allowSchedulingOnControlPlanes: true
allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }}

Choose a reason for hiding this comment

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

medium

This template logic can be made more concise. Since .Values.allowSchedulingOnControlPlanes is a boolean, you can print its value directly rather than using a verbose if/else structure.

Suggested change
allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }}
allowSchedulingOnControlPlanes: {{ .Values.allowSchedulingOnControlPlanes }}

Comment on lines +216 to +219
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}

Choose a reason for hiding this comment

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

medium

For improved code clarity and conciseness in this template string, the boolean check can be simplified.

The expression {{- if eq .Values.kubespan true }} is equivalent to the more idiomatic {{- if .Values.kubespan }}.

Suggested change
{{- if eq .Values.kubespan true }}
kubespan:
enabled: true
{{- end }}
{{- if .Values.kubespan }}\n kubespan:\n enabled: true\n {{- end }}

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: 0

🧹 Nitpick comments (3)
charts/generic/values.yaml (1)

10-10: Add missing newline at end of file.

Static analysis detected a missing newline character at the end of the file, which should be added for proper YAML formatting.

-allowSchedulingOnControlPlanes: true
+allowSchedulingOnControlPlanes: true
charts/cozystack/values.yaml (1)

14-14: Add missing newline at end of file.

Static analysis detected a missing newline character at the end of the file.

-allowSchedulingOnControlPlanes: true
+allowSchedulingOnControlPlanes: true
charts/cozystack/templates/_helpers.tpl (1)

92-92: Simplify the conditional logic.

The current conditional logic is more complex than necessary and could be simplified for better readability.

-  allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }}
+  allowSchedulingOnControlPlanes: {{ .Values.allowSchedulingOnControlPlanes }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55dd761 and 592f292.

⛔ Files ignored due to path filters (1)
  • pkg/generated/presets.go is excluded by !**/generated/**
📒 Files selected for processing (4)
  • charts/cozystack/templates/_helpers.tpl (3 hunks)
  • charts/cozystack/values.yaml (1 hunks)
  • charts/generic/templates/_helpers.tpl (1 hunks)
  • charts/generic/values.yaml (1 hunks)
🪛 YAMLlint (1.37.1)
charts/cozystack/values.yaml

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

charts/generic/values.yaml

[error] 10-10: no new line character at the end of file

(new-line-at-end-of-file)

🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/cozystack/values.yaml

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

charts/generic/values.yaml

[error] 10-10: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (5)
charts/generic/values.yaml (1)

9-10: Configuration additions look good.

The new kubespan and allowSchedulingOnControlPlanes configuration keys provide appropriate defaults for the generic chart. The conservative kubespan: false default is suitable for generic deployments.

charts/cozystack/values.yaml (1)

13-14: Configuration additions are consistent across charts.

The new configuration keys match those in the generic chart, maintaining consistency. However, consider if the kubespan: false default aligns with the PR objectives, which mention that Talos documentation suggests discovery should be enabled by default for KubeSpan support on existing clusters.

Please verify that the kubespan: false default aligns with your intended behavior, given the PR description mentions Talos documentation recommends enabling discovery by default for KubeSpan on existing clusters.

charts/generic/templates/_helpers.tpl (1)

18-21: Well-implemented conditional kubespan configuration.

The template logic correctly implements conditional kubespan enablement with proper Helm syntax and indentation. The placement within the machine.network section after nameservers is appropriate, and the explicit boolean check ensures kubespan is only enabled when explicitly configured.

charts/cozystack/templates/_helpers.tpl (2)

58-61: Consistent kubespan implementation across charts.

The conditional kubespan configuration matches the implementation in the generic chart, ensuring consistency. The template logic is correct and properly indented.


115-115: Excellent alignment with PR objectives.

Setting discovery.enabled to the kubespan value addresses the PR objective about aligning with Talos documentation, which recommends enabling discovery by default for KubeSpan support on existing clusters. This creates a logical connection between the kubespan feature and discovery enablement.

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