-
Notifications
You must be signed in to change notification settings - Fork 19
[feature] kubespan support and conditional scheduling options in values.yaml #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughConditional logic was added to Helm chart templates to enable the "kubespan" feature and control scheduling on control planes based on new configuration keys. The Changes
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
Estimated code review effort2 (~15 minutes) Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🪛 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)
🧰 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)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
kubespanoption in thevalues.yamlfiles for both thecozystackandgenericHelm charts. This allows users to easily enable KubeSpan functionality by settingkubespan: true. - Conditional Scheduling on Control Planes: The
allowSchedulingOnControlPlanesoption is now configurable viavalues.yaml. This provides granular control over whether workloads can be scheduled on Kubernetes control plane nodes, defaulting totrue. - Talos Discovery Setting Alignment: I've updated the
discovery.enabledsetting in the Talos machine configuration templates (_helpers.tpl) to directly reflect thekubespanvalue. This addresses a discrepancy noted in the PR description regarding the defaultdiscoverysetting 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
-
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. ↩
There was a problem hiding this 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.
| {{- if eq .Values.kubespan true }} | ||
| kubespan: | ||
| enabled: true | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| oidcIssuerUrl: "" | ||
| certSANs: [] | ||
| kubespan: false | ||
| allowSchedulingOnControlPlanes: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{- if eq .Values.kubespan true }} | ||
| kubespan: | ||
| enabled: true | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - 192.168.100.0/24 | ||
| certSANs: [] | ||
| kubespan: false | ||
| allowSchedulingOnControlPlanes: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{- if eq .Values.kubespan true }} | ||
| kubespan: | ||
| enabled: true | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }}.
| {{- if eq .Values.kubespan true }} | |
| kubespan: | |
| enabled: true | |
| {{- end }} | |
| {{- if .Values.kubespan }}\n kubespan:\n enabled: true\n {{- end }} |
pkg/generated/presets.go
Outdated
| endpoint: "{{ .Values.endpoint }}" | ||
| {{- if eq .MachineType "controlplane" }} | ||
| allowSchedulingOnControlPlanes: true | ||
| allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes true }}true{{ else }}false{{ end }} | |
| allowSchedulingOnControlPlanes: {{ .Values.allowSchedulingOnControlPlanes }} |
| {{- if eq .Values.kubespan true }} | ||
| kubespan: | ||
| enabled: true | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }}.
| {{- if eq .Values.kubespan true }} | |
| kubespan: | |
| enabled: true | |
| {{- end }} | |
| {{- if .Values.kubespan }}\n kubespan:\n enabled: true\n {{- end }} |
There was a problem hiding this 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: truecharts/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: truecharts/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
⛔ Files ignored due to path filters (1)
pkg/generated/presets.gois 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
kubespanandallowSchedulingOnControlPlanesconfiguration keys provide appropriate defaults for the generic chart. The conservativekubespan: falsedefault 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: falsedefault 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: falsedefault 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.networksection afternameserversis 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.enabledto thekubespanvalue 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.
…iguration Signed-off-by: lb0o <[email protected]>
[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