Skip to content

Conversation

@abhishek-pandey-1
Copy link

Pull Request

What type of this PR

Examples of user facing changes:

  • Bug fixes

Which issue(s) this PR fixes

Fixes #5752

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 29, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @abhishek-pandey-1, 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 addresses a critical bug in the Kube-OVN Helm charts that caused rendering failures during dry-run or helm template operations. The issue stemmed from the kubeovn.nodeIPs helper attempting to query Kubernetes nodes even when no cluster connection was available. The fix introduces a conditional check to ensure the chart can be templated without errors by bypassing the node lookup if no nodes are returned, thereby improving the chart's robustness and usability in various deployment scenarios.

Highlights

  • Helm Chart Compatibility: Modified the kubeovn.nodeIPs helper in both Kube-OVN Helm charts to gracefully handle scenarios where no Kubernetes nodes are found, specifically addressing issues during helm template or dry-run operations.
  • Bug Fix: Resolved a bug (Fixes [BUG] helm template or client-side dry-run fails on chart #5752) where the Helm chart would fail to render in environments without an active Kubernetes cluster connection, such as when using helm template, by preventing node lookup when no nodes are present.
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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @abhishek-pandey-1, 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 resolves an issue preventing Kube-OVN Helm charts from rendering successfully in dry-run or helm template scenarios. The fix involves enhancing the kubeovn.nodeIPs helper function to gracefully handle situations where no Kubernetes nodes are present, ensuring that the templating process completes without errors and allowing for offline chart validation.

Highlights

  • Helm Chart Compatibility: Modified the kubeovn.nodeIPs helper function in both kube-ovn and kube-ovn-v2 Helm charts to correctly handle scenarios where no Kubernetes nodes are available, such as during helm template or dry-run operations.
  • Bug Fix: Addresses a bug where the Helm chart rendering would fail in environments without active Kubernetes nodes, specifically when attempting to retrieve master node IP addresses, by introducing a conditional check.
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.

@dosubot dosubot bot added the bug Something isn't working label Sep 29, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @abhishek-pandey-1, 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 resolves a critical bug in the Kube-OVN Helm charts that prevented them from being rendered successfully in dry-run or helm template modes. The issue stemmed from the kubeovn.nodeIPs helper function attempting to process an empty list of nodes when no active Kubernetes cluster was present. The fix introduces a conditional check to gracefully bypass this operation when no nodes are found, ensuring the charts can be templated and validated without requiring a live cluster.

Highlights

  • Helm Chart Compatibility: Modified the kubeovn.nodeIPs helper function in both kube-ovn and kube-ovn-v2 Helm charts to correctly handle scenarios where no Kubernetes nodes are available, such as during helm template or dry-run operations.
  • Bug Fix: Addresses a bug where the Helm chart rendering would fail in dry-run environments due to the lookup function returning an empty list of nodes, which was not properly handled previously, leading to rendering errors.
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.

Copy link
Contributor

@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 correctly fixes an issue where helm template would fail due to the lookup function not being available during a dry run. The approach of checking the result of lookup before proceeding is sound. I've added a couple of suggestions to improve the readability of the new conditional logic by simplifying the if/else structure into a single if block. Overall, the changes are good and address the problem effectively.

Copy link
Contributor

@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 correctly fixes an issue with Helm chart rendering during dry-runs by checking if the lookup function returns any nodes. The changes in _helpers.tpl for both kube-ovn and kube-ovn-v2 charts will prevent failures when a Kubernetes cluster is not available.

I've added a couple of suggestions to make the template logic more concise and idiomatic by simplifying the conditional checks. The proposed changes improve readability but the current implementation is also functionally correct.

Comment on lines +63 to +64
{{- if eq (len $nodes) 0 -}}
{{- else -}}
Copy link
Contributor

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/Go template practices, this conditional can be simplified. Instead of checking eq (len $nodes) 0 and having an empty if block, you can directly check if $nodes contains any items. An empty dictionary (which lookup returns on failure or when no items are found) is treated as false in conditionals.

The current if-else-end structure can be simplified to a more concise if-end block:

{{- if $nodes -}}
  // ... existing logic to find IPs
{{- end -}}

Comment on lines +7 to +8
{{- if eq (len $nodes) 0 -}}
{{- else -}}
Copy link
Contributor

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/Go template practices, this conditional can be simplified. Instead of checking eq (len $nodes) 0 and having an empty if block, you can directly check if $nodes contains any items. An empty dictionary (which lookup returns on failure or when no items are found) is treated as false in conditionals.

The current if-else-end structure can be simplified to a more concise if-end block:

{{- if $nodes -}}
  // ... existing logic to find IPs
{{- end -}}

Copy link
Contributor

@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 with Helm chart rendering during dry-runs (helm template) by adding a check to the kubeovn.nodeIPs helper. When no nodes are found via lookup, which is typical in a dry-run, the helper now correctly returns an empty value instead of erroring out. The changes in both charts/kube-ovn-v2 and charts/kube-ovn are correct. I've added a couple of suggestions to improve the readability and follow a more idiomatic approach for the conditional logic in the Helm templates.

@oilbeater
Copy link
Collaborator

@abhishek-pandey-1 the DCO check failed, please sign off the commit.

@abhishek-pandey-1
Copy link
Author

abhishek-pandey-1 commented Sep 29, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] helm template or client-side dry-run fails on chart

2 participants