-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix issue with Helm 4 where KubeVersion is not pulled in #175
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: main
Are you sure you want to change the base?
Fix issue with Helm 4 where KubeVersion is not pulled in #175
Conversation
| "--namespace", | ||
| helm_release.namespace, | ||
| "--install", | ||
| "--dry-run=server", |
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.
Bug: helm diff upgrade with --dry-run=server fails on Helm v3.10.2, causing silent misinterpretation of flag incompatibility as "no diff".
Severity: CRITICAL | Confidence: 0.95
🔍 Detailed Analysis
The helm diff upgrade command, when executed with the --dry-run=server flag, will fail on systems using Helm v3.10.2, as specified in the project's Dockerfile. This flag was introduced in Helm v3.13. The _run_helm() function will raise a HelmException, which is then caught in diff() (lines 641-643). The error is silently swallowed, and an empty string is returned, leading to incorrect behavior where flag incompatibility errors are misinterpreted as "no diff detected".
💡 Suggested Fix
Update the Dockerfile to Helm v3.13+ or remove the --dry-run=server flag. Alternatively, add Helm version validation or refine error handling in diff() to distinguish between "no diff" and flag incompatibility.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: libsentrykube/helm.py#L624
Potential issue: The `helm diff upgrade` command, when executed with the
`--dry-run=server` flag, will fail on systems using Helm v3.10.2, as specified in the
project's Dockerfile. This flag was introduced in Helm v3.13. The `_run_helm()` function
will raise a `HelmException`, which is then caught in `diff()` (lines 641-643). The
error is silently swallowed, and an empty string is returned, leading to incorrect
behavior where flag incompatibility errors are misinterpreted as "no diff detected".
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2772709
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.
@BojanOro should this be addressed,
should this flag be conditioned by helm version?
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.
We might be able to use --dry-run=client instead? Cursor says that's compatible with older helm@3 versions.
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.
Although maybe --validate and --dry-run=server function differently by actually hitting k8s.
With Helm 4, KubeVersion is not being pulled in properly when running
helm diff. This results in Helm using the default value of 1.20.0, which does not meet the minimum version specified in many charts, causing the diff to fail.Hypothetically this PR (databus23/helm-diff#872) should have fixed this, but it doesn't seem to work. Adding this flag makes it work for Helm 3 and Helm 4.