-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Wrong globbing in Git file generator #13313
Labels
bug
Something isn't working
Comments
13 tasks
We just ran into that exact issue. Glad there is a fix coming up. |
Calchan
added a commit
to Calchan/argo-cd
that referenced
this issue
May 23, 2023
Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com>
crenshaw-dev
added a commit
that referenced
this issue
May 28, 2023
Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
yyzxw
pushed a commit
to yyzxw/argo-cd
that referenced
this issue
Aug 9, 2023
…rgoproj#13314) Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
tesla59
pushed a commit
to tesla59/argo-cd
that referenced
this issue
Dec 16, 2023
…rgoproj#13314) Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist:
argocd version
.Describe the bug
The Git file generator currently implements globbing in a way which can trigger errors or catch users off-guard. For example, consider the following repository layout:
In
cluster1
we have two charts, one of them with a subchart.Assuming we need the ApplicationSet to template values in the
values.yaml
, then we need to use a Git file generator instead of a directory generator. The value of thepath
key of the Git file generator should be set to:However, the current implementation will interpret the above pattern as:
Meaning, for
mychart
incluster1
, that it will pick up both the chart'svalues.yaml
but also the one from its subchart. This will most likely fail, and even if it didn't it would be wrong.This is the failure users are most likely to encounter but there are multiple other ways this undesirable globbing can fail. For example:
This will return all YAML files in any directory at any level under
some-path
, instead of only those directly under it.To Reproduce
I have created a repository to reproduce the second type of failure above (https://github.com/Calchan/monorepo-local), based on an actual configuration we currently run in production. The repository layout is in the form:
prod/clusters/<cluster name>/<namespace>
We're using a cluster named
local
and deploy in thedefault
namespace because it's easier, so the path to our charts in the repository is:prod/clusters/local/default/
In there, we have two types of charts. The first one is in the usual form of a directory with the usual files and sub-directories in it:
Chart.yaml
,values.yaml
,templates/
, etc… The example for that is atprod/clusters/local/default/hello-world/
.The second type of chart is a simple YAML file pointing to a chart on another directory. The use case here is to store charts that are commonly used in all clusters which increases DRY when dealing with dozens of clusters. In our example we point to the
guestbook
chart atprod/clusters/virtual/default/
.Both type of charts are managed by two ApplicationSets at
prod/bootstrap/local/
in the repository. The implementation details can be perused in the example repository but are not important for this bug.Save the following file as
bootstrap.yaml
:Then bootstrap the cluster with
kubectl -n argocd apply -f bootstrap.yaml
.The regular ApplicationSet generating applications for charts in the directory form will work, but not the one for charts in link YAML files (see screenshots below). In the latter case, the value of the
path
key in the Git file generator spec is set toprod/clusters/local/*/*.yaml
.The reason is instead of picking up YAML files directly under
prod/clusters/local/*/
as the ApplicationSet expects, the Git file generator returns all*.yaml
files at any level underprod/clusters/local/
.The log shows this (simplified for readability, see full log below):
Expected behavior
The
bootstrap-applications-link
ApplicationSet is not in degraded mode and the log shows only this:Screenshots
Version
Logs
Slack discussion with Michael Crenshaw about this issue:
https://cloud-native.slack.com/archives/C01TSERG0KZ/p1681230308737899
I have a PR coming up.
The text was updated successfully, but these errors were encountered: