Skip to content
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

Error with Kustomize with --enable-helm option #21449

Open
3 tasks done
Asuforce opened this issue Jan 10, 2025 · 3 comments
Open
3 tasks done

Error with Kustomize with --enable-helm option #21449

Asuforce opened this issue Jan 10, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Asuforce
Copy link
Contributor

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When using ArgoCD v2.13+ with kustomize v5.3.0 or below, configured through Custom kustomize versions, an error occurs during synchronization when the --enable-helm option is used.

Problem Details

This error occurs because the specified version of kustomize in the repository is v5.2.1-helm, which does not implement the --helm-kube-version flag. This is confirmed by the help output of kustomize_5_2_1.

Root Cause Analysis

The root cause of the problem was analyzed as follows:

The parseKustomizeBuildOptions function checks build options.(source)

A specific condition is true when buildOpts is not empty, the kustomize version is v5.3.0 or above, and --enable-helm is set.(source)

There is an issue with the version obtained through the getSemverSafe -> getSemver -> Version functions.*(source)

The desired binary version is /usr/local/bin/kustomize_5_2_1, but the binary is fixed as kustomize, leading to inconsistency.(source)

To Reproduce

Steps to reproduce the issue:

1.Configure ArgoCD with kustomize v5.2.1-helm.

  1. Attempt to sync a project using the --enable-helm option.
  2. Observe the error message.

Expected behavior

Synchronization should proceed without errors, and the --helm-kube-version flag should be handled correctly.

Screenshots

Version

$ argocd version
argocd: v2.13.2+dc43124
  BuildDate: 2024-12-11T19:59:01Z
  GitCommit: dc43124058130db9a747d141d86d7c2f4aac7bf9
  GitTreeState: clean
  GoVersion: go1.23.4
  Compiler: gc
  Platform: darwin/arm64

Logs

Failed to load target state: failed to generate manifest for source 1 of 1:
rpc error: code = Unknown desc =
`/usr/local/bin/kustomize_5_2_1 build <path to cached source>/beta
--enable-helm
--helm-kube-version 1.24
...
failed exit status 1: Error: unknown flag: --helm-kube-version
@Asuforce Asuforce added the bug Something isn't working label Jan 10, 2025
@rikhil-s
Copy link

Hitting the same issue. I believe this is where the bug is:
https://github.com/argoproj/argo-cd/blob/master/util/kustomize/kustomize.go#L357

That should be MoreThan instead of LessThan.

@MrFreezeex
Copy link
Contributor

MrFreezeex commented Jan 11, 2025

Hitting the same issue. I believe this is where the bug is: https://github.com/argoproj/argo-cd/blob/master/util/kustomize/kustomize.go#L357

That should be MoreThan instead of LessThan.

Note that the condition is inverted so it should effectively be a >= 5.3.0. IMO what the OP said in his RCA seems to be what's happening.

If that's truly the bug (which is likely IMO) it means that all the kustomize version comparison in this file doesn't work when installing a custom kustomize version, although the most probable one would be this one as the other version checks seems to be >= 3.8.5 and >= 3,7,0 which are quite old.

@rikhil-s
Copy link

Hitting the same issue. I believe this is where the bug is: https://github.com/argoproj/argo-cd/blob/master/util/kustomize/kustomize.go#L357
That should be MoreThan instead of LessThan.

Note that the condition is inverted so it should effectively be a >= 5.3.0. IMO what the OP said in his RCA seems to be what's happening.

If that's truly the bug (which is likely IMO) it means that all the kustomize version comparison in this file doesn't work when installing a custom kustomize version, although the most probable one would be this one as the other version checks seems to be >= 3.8.5 and >= 3,7,0 which are quite old.

Ah yes you're right. Missed the inverted condition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants