Skip to content

Conversation

bradkwadsworth
Copy link
Contributor

@bradkwadsworth bradkwadsworth commented Jan 26, 2025

Added ability to ignore Kustomize component directory if it does not exist. A new field called ignoreMissingComponents, if enabled, will verify if a given components directory exists and if not will log a debug message. Only found component directories will be used if ignoreMissingComponents is set to true.

Fixes #18634

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).
  • The title of the PR conforms to the Toolchain Guide
  • 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.
  • 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).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@bradkwadsworth bradkwadsworth requested a review from a team as a code owner January 26, 2025 21:53
Copy link

bunnyshell bot commented Jan 26, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 8272cf6 to aaf19de Compare January 26, 2025 21:56
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

Attention: Patch coverage is 78.57143% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.65%. Comparing base (922dd77) to head (7ce8e9c).
Report is 385 commits behind head on master.

Files with missing lines Patch % Lines
util/kustomize/kustomize.go 78.57% 2 Missing and 1 partial ⚠️
cmd/util/app.go 66.66% 2 Missing ⚠️
cmd/argocd/commands/app.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21674      +/-   ##
==========================================
+ Coverage   55.63%   55.65%   +0.01%     
==========================================
  Files         339      339              
  Lines       56812    56838      +26     
==========================================
+ Hits        31609    31632      +23     
- Misses      22553    22562       +9     
+ Partials     2650     2644       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bradkwadsworth bradkwadsworth requested a review from a team as a code owner January 26, 2025 22:40
@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 8975964 to dcbd254 Compare January 29, 2025 14:16
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Could you look into adding CLI and UI support for the new flag as part of this PR?

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 2ce7e91 to 73a063d Compare January 30, 2025 15:41
@bradkwadsworth
Copy link
Contributor Author

bradkwadsworth commented Jan 30, 2025

I looked in the existing CLI and UI and noticed that neither expose configuring Kustomize Components.

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 73a063d to 0bdc86d Compare January 30, 2025 15:43
@crenshaw-dev
Copy link
Member

@bradkwadsworth I think it probably still makes sense to expose the flag. Maybe not via the UI, but at least via the CLI. I think the code could be modeled off the Helm ignore missing values file equivalent field (assuming that has CLI/UI support, which it might not).

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 3d33d8f to ee1d1b4 Compare January 30, 2025 18:00
@bradkwadsworth
Copy link
Contributor Author

I was able to update the CLI, but couldn't find any references for something similar with the helm values files in the web UI. Updated some docs as well.

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from d6f8b09 to 78adaa5 Compare January 30, 2025 22:49
@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 78adaa5 to 871338b Compare February 3, 2025 04:29
@crenshaw-dev crenshaw-dev changed the title feat: Kustomize ignore components - issues/18634 feat: Kustomize ignore missing components (#18634) Feb 3, 2025
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Code lgtm! One last docs request: can you add a note about the feature here - https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/#components

@bradkwadsworth
Copy link
Contributor Author

I believe I did here https://github.com/argoproj/argo-cd/pull/21674/files#. Is there a doc generation command that I should run?

@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 871338b to 8a74108 Compare February 6, 2025 21:59
@bradkwadsworth
Copy link
Contributor Author

I just did a rebase and re-ran codegen so I think the docs may have been generated now.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

One last request, then lgtm. :-)

@crenshaw-dev
Copy link
Member

Sorry to keep moving the goalposts. 😆 You've been super responsive, which helps me feel a bit better asking for last tweaks.

exist

Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
@bradkwadsworth bradkwadsworth force-pushed the feature/ignore-missing-components branch from 5f1e494 to 7ce8e9c Compare February 7, 2025 15:37
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

🚀

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) February 7, 2025 16:10
@crenshaw-dev crenshaw-dev merged commit 0973409 into argoproj:master Feb 7, 2025
26 checks passed
Sriteja-Tadakaluru pushed a commit to Sriteja-Tadakaluru/argo-cd that referenced this pull request Feb 16, 2025
…21674)

Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
chzar pushed a commit to chzar/argo-cd that referenced this pull request Mar 3, 2025
…21674)

Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
blakepettersson added a commit to blakepettersson/argo-cd that referenced this pull request Jun 19, 2025
With argoproj#21674 the ability to ignore Kustomize component directories if they
do not exist got introduced. This generally works fine, but the
`securejoin` check is a bit too strict - we want to ensure that no-one
can break out of the repo, but the current implementation doesn't allow
for breaking outside the kustomization folder. This breaks the usage of
this feature when using it for a monorepo.

This PR loosens the check to allow for traversals up to the repo root. We
use the new `os.Root` functionality to ensure that users can't break
outside the repo. Path traversals are still relative from the kustomize
repo.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
blakepettersson added a commit to blakepettersson/argo-cd that referenced this pull request Jun 19, 2025
With argoproj#21674 the ability to ignore Kustomize component directories if they
do not exist got introduced. This generally works fine, but the
`securejoin` check is a bit too strict - we want to ensure that no-one
can break out of the repo, but the current implementation doesn't allow
for breaking outside the kustomization folder. This breaks the usage of
this feature when using it for a monorepo.

This PR loosens the check to allow for traversals up to the repo root. We
use the new `os.Root` functionality to ensure that users can't break
outside the repo. Path traversals are still relative from the kustomize
repo.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
blakepettersson added a commit to blakepettersson/argo-cd that referenced this pull request Jun 19, 2025
With argoproj#21674 the ability to ignore Kustomize component directories if they
do not exist got introduced. This generally works fine, but the
`securejoin` check is a bit too strict - we want to ensure that no-one
can break out of the repo, but the current implementation doesn't allow
for breaking outside the kustomization folder. This breaks the usage of
this feature when using it for a monorepo.

This PR loosens the check to allow for traversals up to the repo root. We
use the new `os.Root` functionality to ensure that users can't break
outside the repo. Path traversals are still relative from the kustomize
repo.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
cardoe added a commit to cardoe/argo-cd that referenced this pull request Jul 21, 2025
Following argoproj#21674 which allowed ignoring components and argoproj#23486 which
allowed having components specified in a monorepo, this allows
specifying components by reference the same way that helm values files
can be specified. This is useful for people that store components in
branches or are doing testing by using branches against the main
application components.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
cardoe added a commit to cardoe/argo-cd that referenced this pull request Jul 21, 2025
)

This is an implmentation of argoproj#23873. Following argoproj#21674 which allowed
ignoring components and argoproj#23486 which allowed having components
specified in a monorepo, this allows specifying components by reference
the same way that helm values files can be specified. Today kustomize
supports having URL references to components but ArgoCD has no concept
of this and does not detect that the component might have changed.
Using the reference form ArgoCD is aware of the changes to components
and can re-run any sync that is configured. This is useful for people
that store components in branches or are doing testing by using
branches against the main application components. Fixes argoproj#23872

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
cardoe added a commit to cardoe/argo-cd that referenced this pull request Jul 21, 2025
)

This is an implmentation of argoproj#23873. Following argoproj#21674 which allowed
ignoring components and argoproj#23486 which allowed having components
specified in a monorepo, this allows specifying components by reference
the same way that helm values files can be specified. Today kustomize
supports having URL references to components but ArgoCD has no concept
of this and does not detect that the component might have changed.
Using the reference form ArgoCD is aware of the changes to components
and can re-run any sync that is configured. This is useful for people
that store components in branches or are doing testing by using
branches against the main application components. Fixes argoproj#23872

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
cardoe added a commit to cardoe/argo-cd that referenced this pull request Jul 21, 2025
)

This is an implmentation of argoproj#23873. Following argoproj#21674 which allowed
ignoring components and argoproj#23486 which allowed having components
specified in a monorepo, this allows specifying components by reference
the same way that helm values files can be specified. Today kustomize
supports having URL references to components but ArgoCD has no concept
of this and does not detect that the component might have changed.
Using the reference form ArgoCD is aware of the changes to components
and can re-run any sync that is configured. This is useful for people
that store components in branches or are doing testing by using
branches against the main application components. Fixes argoproj#23872

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
cardoe added a commit to cardoe/argo-cd that referenced this pull request Jul 22, 2025
)

This is an implmentation of argoproj#23873. Following argoproj#21674 which allowed
ignoring components and argoproj#23486 which allowed having components
specified in a monorepo, this allows specifying components by reference
the same way that helm values files can be specified. Today kustomize
supports having URL references to components but ArgoCD has no concept
of this and does not detect that the component might have changed.
Using the reference form ArgoCD is aware of the changes to components
and can re-run any sync that is configured. This is useful for people
that store components in branches or are doing testing by using
branches against the main application components. Fixes argoproj#23872

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
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.

Support optional components/patches in kustomize applications (similar to ignoreMissingValueFiles for helm)
2 participants