-
Notifications
You must be signed in to change notification settings - Fork 494
Fix chart rendering in dry-run or "helm template" scenarios #5760
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
base: master
Are you sure you want to change the base?
Fix chart rendering in dry-run or "helm template" scenarios #5760
Conversation
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
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 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.
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 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.
| {{- if eq (len $nodes) 0 -}} | ||
| {{- else -}} |
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/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 -}}
| {{- if eq (len $nodes) 0 -}} | ||
| {{- else -}} |
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/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 -}}
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 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.
|
@abhishek-pandey-1 the DCO check failed, please sign off the commit. |
|
Ah - I didn't realize that was needed. I will resolve this.
…________________________________
From: Mengxin Liu ***@***.***>
Sent: Monday, September 29, 2025 2:35 PM
To: kubeovn/kube-ovn ***@***.***>
Cc: Abhishek Pandey ***@***.***>; Mention ***@***.***>
Subject: Re: [kubeovn/kube-ovn] Fix chart rendering in dry-run or "helm template" scenarios (PR #5760)
[https://avatars.githubusercontent.com/u/1189736?s=20&v=4]oilbeater left a comment (kubeovn/kube-ovn#5760)<#5760 (comment)>
@abhishek-pandey-1<https://github.com/abhishek-pandey-1> the DCO check failed, please sign off the commit.
—
Reply to this email directly, view it on GitHub<#5760 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATSNKM2BTLVNITMDF4VCSFL3VEYRTAVCNFSM6AAAAACHZAYEYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNBWHE4TAOJTGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Pull Request
What type of this PR
Examples of user facing changes:
Which issue(s) this PR fixes
Fixes #5752