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

feat: Allow per-version kustomize options (#5533) #5967

Merged
merged 1 commit into from Apr 6, 2021

Conversation

chetan-rns
Copy link
Member

@chetan-rns chetan-rns commented Apr 5, 2021

Allow adding build options that are specific to a kustomize version instead of using the same default option for each version.
This PR also changes the conventions for adding kustomize paths from kustomize.version.<version> to kustomize.buildOptions.<version>.

Example:

data:
    kustomize.buildOptions: -o /tmp                # build options for the default kustomize version
    kustomize.path.v4.0.5: /kustomize_4.0.5  # binary path for the kustomize version v4.0.5
    kustomize.buildOptions.v4.0.5: --load_restrictor none  # build options that are specific to v4.0.5

In the above example, the final build command looks like /kustomize_4.0.5 build --load_restrictor none

Closes: #5533

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@chetan-rns chetan-rns changed the title Allow per-version kustomize options (#5533) feat: Allow per-version kustomize options (#5533) Apr 5, 2021
@chetan-rns chetan-rns force-pushed the per-version-kustomize branch 2 times, most recently from de16b75 to 26919ed Compare April 5, 2021 14:34
@codecov
Copy link

codecov bot commented Apr 5, 2021

Codecov Report

Merging #5967 (fb66eaf) into master (a686f12) will increase coverage by 0.04%.
The diff coverage is 93.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5967      +/-   ##
==========================================
+ Coverage   40.91%   40.96%   +0.04%     
==========================================
  Files         147      147              
  Lines       19635    19655      +20     
==========================================
+ Hits         8033     8051      +18     
- Misses      10497    10498       +1     
- Partials     1105     1106       +1     
Impacted Files Coverage Δ
util/settings/settings.go 41.46% <93.10%> (+1.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a686f12...fb66eaf. Read the comment docs.

@alexmt
Copy link
Collaborator

alexmt commented Apr 5, 2021

Thank you! Perfect timing. I thought it won't make it into v2.0

@alexmt alexmt self-requested a review April 5, 2021 16:52
if source.Kustomize != nil && source.Kustomize.Version != "" {
for _, ver := range ks.Versions {
if ver.Name == source.Kustomize.Version {
binaryPath = ver.Path
// append version specific build options to global build options
Copy link
Collaborator

Choose a reason for hiding this comment

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

The options specified in kustomize.buildOptions is default version build options, not global options. So instead of appending, we should just replace version-specific build options. If version specific build option is empty then we need to use empty build options.

Imagine the following use case. Everyone is org is using kustomize v3.9.x with --load_restrictor none build options.

In order to migrate to v4.x the admin would have to register new v4.0.x version with v4.0 specific build options
( v4.x does not support --load_restrictor none ). Migrate all apps to v4.0.x and them change default to v4.0.x

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. With appending, there is really no way to change the default build options.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I've updated the PR with the below logic

  1. Use kustomize.buildOptions only for the default version and don't include it for version-specific options.
  2. Use kustomize.buildOptions.<version> for version-specific options. If this field is absent, this version will have no build options.

Copy link
Member Author

Choose a reason for hiding this comment

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

@alexmt The PR is updated, please take a look

Choose a reason for hiding this comment

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

Hi guys,
Is this tested with kustomize v.4.0.5?
I'm getting the following kustomize version v4.0.5 is not registered error.

I checked that the argocd-cm is defined and the tool is in the specified path in the container as well.
Any ideas?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, could you try setting the path for v4.0.5 kustomize.path.v4.0.5: <path> in the argocd-cm. I think we get this error when there's no path specified for the kustomize version.

Choose a reason for hiding this comment

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

Of course, I have correct path in configmap and the container has the tool under same path.
Updating my Argo installation from '1.8.7' to '2.0.1' made it work!

Allow adding build options that are specific to a kustomize version instead of using the same default options for each version.

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@alexmt alexmt merged commit f06fc0d into argoproj:master Apr 6, 2021
alexmt pushed a commit that referenced this pull request Apr 6, 2021
Allow adding build options that are specific to a kustomize version instead of using the same default options for each version.

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
@sbose78
Copy link
Contributor

sbose78 commented Apr 6, 2021

Question, these options get acknowledged if the specific version of kustomize is available? ( Assuming upstream may not necessarily be bundling any of the specific versions )

@chetan-rns
Copy link
Member Author

@sbose78 It does get acknowledged. However, the kustomize build will fail later if the binary doesn't exist at the given path.

yujunz added a commit to yujunz/argo-cd that referenced this pull request Apr 7, 2021
* 4f9c500 (upstream/master) docs: k8s version in Ingress Configuration documentation (argoproj#5727)
* 7c88ac8 feat: Allow to pass Kubernetes configuration overrides (argoproj#5906)
* 834a5fa chore: Change grammar in high_availability.md (argoproj#5964)
* 2a2b81f fix: Improvements to mobile UI (argoproj#5965)
* f06fc0d feat: allow per-version kustomize options (argoproj#5967)
* 92c7ca0 chore: make argocd gitpod friendly (argoproj#5973)
* 1bc3348 Upgrade gitops-engine (argoproj#5972)
* a686f12 fix: run dex as nonroot (argoproj#5815)
* ed5c5b6 chore: Update go-git to v5 (argoproj#5520)
* ac3d4cc fix: correct package name in Makefile (argoproj#5960)
* 24b2cac chore: fix incorrect image name in 'publish' CI job (argoproj#5956)
* b37eee1 chore: fix invalid IMAGE_NAMESPACE in image 'publish' CI job (argoproj#5953)
* dc4eaff chore: Remove specification of user id for the Redis workload (argoproj#5863)
* 8eeb9a0 chore: use clusterrolebinding v1 (argoproj#5939)
* 7945286 docs: clarify that the certificate must be in PEM format (argoproj#5946)
* de522bf chore: migrate argocd dev images to ghcr.io (argoproj#5948)
* 0a53fb1 chore(deps): bump y18n from 4.0.0 to 4.0.1 in /ui (argoproj#5919)
* ae49b45 chore: Upgrade Go module to v2 (argoproj#5931)
* a2ebe15 add user (argoproj#5938)
* 7f5a23d Update USERS.md (argoproj#5835)
* 24218b4 docs: Propose an enhancement proposal process (argoproj#5771)
shubhamagarwal19 pushed a commit to shubhamagarwal19/argo-cd that referenced this pull request Apr 15, 2021
Allow adding build options that are specific to a kustomize version instead of using the same default options for each version.

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
@jannfis jannfis added the needs-verification PR requires pre-release verification label Jun 25, 2021
@jgwest jgwest removed the needs-verification PR requires pre-release verification label Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for per-version kustomize options
7 participants