Skip to content

fix(t8s-cluster/management-cluster): leave out protocol if nil#1837

Merged
cwrau merged 1 commit intomainfrom
fix/t8s-cluster/leave-out-protocol
Dec 1, 2025
Merged

fix(t8s-cluster/management-cluster): leave out protocol if nil#1837
cwrau merged 1 commit intomainfrom
fix/t8s-cluster/leave-out-protocol

Conversation

@cwrau
Copy link
Member

@cwrau cwrau commented Nov 28, 2025

I ran the old code, no idea why it fails with flux?

Summary by CodeRabbit

  • Infrastructure
    • Improved security group rule protocol configuration handling to ensure consistent and reliable application of default values in cluster settings.

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

I ran the old code, no idea why it fails with flux?
Copilot AI review requested due to automatic review settings November 28, 2025 10:18
@cwrau cwrau enabled auto-merge November 28, 2025 10:18
@gemini-code-assist
Copy link

Summary of Changes

Hello @cwrau, 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 refines the Helm template logic for OpenStack security group rules to handle the protocol field more robustly. The modification ensures that the protocol field is only included in the generated configuration when it has a defined, non-nil value, or defaults to 'tcp' if completely unspecified. This change is intended to resolve compatibility issues observed with Flux CD, which may not correctly process explicitly set nil protocol values.

Highlights

  • Conditional Protocol Setting: The logic for setting the protocol field in OpenStack security group rules has been updated. The field will now only be explicitly set if it holds a non-nil value, preventing empty or null protocol entries.
  • Flux CD Compatibility Fix: This change addresses an issue where explicitly setting a nil or empty protocol value was causing failures when used with Flux CD, by ensuring the field is omitted in such cases.
  • Default Protocol Behavior: If the protocol key is entirely absent from the security group rule definition, it will continue to default to tcp.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

A Helm template file is refactored to replace an inline ternary operator with an explicit conditional block for OpenStack protocol defaulting logic, improving clarity of the default value assignment when the protocol key is absent.

Changes

Cohort / File(s) Change Summary
OpenStack Cluster Template Configuration
charts/t8s-cluster/templates/management-cluster/clusterClass/openStackClusterTemplate/_openStackClusterTemplateSpec.yaml
Refactored protocol defaulting from inline ternary operator to explicit conditional block; default value of "tcp" now applied via conditional check rather than ternary expression

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

  • Single file modification with straightforward logic restructuring
  • No functional behavior change, only control flow reorganization
  • Low syntactic complexity in templating logic

Poem

🐰 A protocol finds its home,
With clarity now shown—
No ternary tricks to confuse,
Just "tcp" when you need to choose!
hops contentedly 🎩✨

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: modifying protocol defaulting behavior to omit it when nil, which matches the changeset's core objective.
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 fix/t8s-cluster/leave-out-protocol

📜 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 3deff65 and 6bb7072.

📒 Files selected for processing (1)
  • charts/t8s-cluster/templates/management-cluster/clusterClass/openStackClusterTemplate/_openStackClusterTemplateSpec.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). (2)
  • GitHub Check: Agent
  • GitHub Check: lint helm chart (t8s-cluster)
🔇 Additional comments (1)
charts/t8s-cluster/templates/management-cluster/clusterClass/openStackClusterTemplate/_openStackClusterTemplateSpec.yaml (1)

111-115: Correctly omits protocol field when nil.

The refactored conditional logic properly handles three cases: truthy protocol values (lines 111–112), absent protocol keys (lines 113–114), and nil protocol values (implicitly omitted). This aligns with the PR objective and resolves the Flux failure by preventing invalid nil fields in the rendered YAML output.

The logic is consistent with the codebase's hasKey pattern (e.g., lines 88, 91, 95, 120–125).


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

@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 fixes an issue where a protocol key with a nil value was being rendered in the output YAML. The new logic correctly omits the protocol key if its value is nil, provides a default of tcp if the key is not present, and uses the specified value otherwise. The change is correct and addresses the problem. I've added one comment with a suggestion to refactor the logic for improved readability.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the OpenStack cluster template to change how the protocol field is handled in security group rules. Previously, the protocol field was always set (even when the value was nil), but now it is conditionally omitted when explicitly set to nil. This change is necessary for Flux compatibility and affects native routing rules where protocol should not be specified.

  • Replaced inline protocol field assignment with conditional logic
  • Protocol field is now omitted when value is nil (instead of being set to nil)
  • Maintains backward compatibility for cases where protocol is not specified (defaults to "tcp") or has an explicit value

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cwrau cwrau added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit f370dac Dec 1, 2025
39 checks passed
@cwrau cwrau deleted the fix/t8s-cluster/leave-out-protocol branch December 1, 2025 14:29
github-merge-queue bot pushed a commit that referenced this pull request Jan 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.5.0](t8s-cluster-v9.4.1...t8s-cluster-v9.5.0)
(2026-01-15)


### Features

* **t8s-cluster/artifacthub:** use centralised helmRepositories template
([#1846](#1846))
([73a41f9](73a41f9))
* **t8s-cluster/cilium:** enable kubeProxy replacement
([#1815](#1815))
([b3c412d](b3c412d))
* **t8s-cluster/management-cluster:** add cluster-autoscaler deployment
([#1756](#1756))
([5b6ead9](5b6ead9))
* **t8s-cluster/management-cluster:** enable ImageVolume feature flag
([#1786](#1786))
([9676ee0](9676ee0))
* **t8s-cluster/management-cluster:** set apiServerLoadBalancer.provider
via TeutonetesCloud
([#1898](#1898))
([6bf8889](6bf8889))
* **t8s-cluster/management-cluster:** switch to hcp
([#1759](#1759))
([303b0b6](303b0b6))
* **t8s-cluster/management-cluster:** use new
KubeletEnsureSecretPulledImages feature gate
([#1858](#1858))
([40d7bef](40d7bef))
* **t8s-cluster:** migrate to CAPI v1beta2
([#1685](#1685))
([dc5f071](dc5f071))


### Bug Fixes

* **t8s-cluster/autoscaler:** these names are inside the workload
cluster
([#1877](#1877))
([f345cea](f345cea))
* **t8s-cluster/management-cluster:** leave out protocol if `nil`
([#1837](#1837))
([f370dac](f370dac))
* **t8s-cluster:** only allow nodePools with valid k8s names
([#1851](#1851))
([b9431c5](b9431c5))


### Miscellaneous Chores

* **t8s-cluster/dependencies:** update common docker tag to v1.6.0
([#1811](#1811))
([b3b4c94](b3b4c94))
* **t8s-cluster/dependencies:** update common docker tag to v1.7.0
([#1873](#1873))
([71e062f](71e062f))
* **t8s-cluster/dependencies:** update helm release cilium to v1.18.6
([#1894](#1894))
([e1adc88](e1adc88))
* **t8s-cluster/dependencies:** update helm release cluster-autoscaler
to v9.53.0
([#1856](#1856))
([dc67fcd](dc67fcd))
* **t8s-cluster/dependencies:** update helm release
openstack-cloud-controller-manager to v2.34.1
([#1553](#1553))
([e984d19](e984d19))
* **t8s-cluster/dependencies:** update registry.k8s.io/etcd docker tag
to v3.5.24
([#1793](#1793))
([a5098e3](a5098e3))
* **t8s-cluster/dependencies:** update registry.k8s.io/etcd docker tag
to v3.6.6
([#1813](#1813))
([e07ffa7](e07ffa7))
* **t8s-cluster/dependencies:** update registry.k8s.io/etcd docker tag
to v3.6.7
([#1895](#1895))
([cf1d3b4](cf1d3b4))
* **t8s-cluster/flux:** use centralised HelmRepositories instead of
per-instance
([#1758](#1758))
([3deff65](3deff65))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants