-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Kustomize 4.5.3+ breaks remote resources #4559
Comments
Same issue here. The remote resource is reached with: (hosted on Gitlab)
And for information, the remote resource looks like that:
|
Seeing the same issue with our remote repos |
Same here |
This issue may also be related: #4455 |
A workaround is to use ssh (e.g. |
Thanks for the link but I don't think they are fixed by that PR. Using
vs
|
Looks like HTTPS remote source specified in |
/triage needs-information Would one of you please be able to provide a public sample we could use to reproduce? And could you please confirm whether kustomize 4.5.3 is able to successfully build the Kustomization if you clone it locally yourself? The fact that the error is about a specific line in a remote file is curious. |
@KnVerey to reproduce the issue:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://github.com/prometheus-operator/kube-prometheus.git?ref=v0.9.0 Running build: $ kustomize build .
Error: accumulating resources: accumulating resources from 'https://github.com/prometheus-operator/kube-prometheus.git?ref=v0.9.0': MalformedYAMLError: yaml: line 25: mapping values are not allowed in this context in File: https://github.com/prometheus-operator/kube-prometheus.git?ref=v0.9.0 Version: $ kustomize version
{Version:kustomize/v4.5.4 GitCommit:cf3a452ddd6f83945d39d582243b8592ec627ae3 BuildDate:2022-03-28T23:06:20Z GoOs:darwin GoArch:amd64} In the example above, changing the remote build URL to the following seems to work: |
@m-Bilal would you be able to take a look? I'm curious if this is related to your |
Sure I'll into this. /assign |
/triage accepted |
FYI @m-Bilal I was able to confirm that building the https://github.com/prometheus-operator/kube-prometheus example given does not work when referenced remotely and does work if you clone it and build. |
The error occurs in this section: kustomize/kyaml/kio/byteio_reader.go Lines 290 to 298 in a464ed0
How should I go about this? Try fixing Also, the idea behind introducing |
Looked at this a little more. The problem is that when The below linked files are the log outputs of kustomize, and you can check for the first log with the prefix The problem is that in previous releases we were allowing problems with YAML files to go through while this was changed in #4497 here: kustomize/api/internal/target/kusttarget.go Lines 409 to 416 in a464ed0
The return nil, errF (lines 414-416) is causing Kustomize to throw an error for the HTML file present in the response.If we revert back to allowing YAML error to pass through, we'd have #3812 all over again. How should I go about fixing this? The way I see it is that HTML (or any other non-YAML file) should not be passed to kyaml/kio/byteio_reader.go decode() . So one way could be to have some sort of a filter that only allows YAML files to go through to decode() or a filter in decode() itself that only allows for parsing of YAML files. But I also think that silently ignoring non-YAML files passed to Kustomize could be an issue in itself in that when it is an actual problem with the files, we're not raising that error and notifying the user about it.
|
I think we should move these lines: kustomize/api/internal/target/kusttarget.go Lines 410 to 416 in a464ed0
down to inside these two if statements: kustomize/api/internal/target/kusttarget.go Lines 418 to 420 in a464ed0
kustomize/api/internal/target/kusttarget.go Lines 432 to 434 in a464ed0
This is what I suggested in the PR here #4334 (comment) so that we don't break existing workflows, and considering that this is the second regression caused by adding an error check, I'm more convinced that my suggestion in that PR is the safer way to go. It should look like:
This way, we are only improving the error message; we won't be throwing any errors where we weren't previously already throwing an error. @m-Bilal is that clear to you? Would you be able to make that change and verify that #3812 would still be solved? At some point we should also build up a larger suite of tests with different remote URLs so that we can be more confident about changes like this, but until we have that IMO we should err on the safer side. |
Btw, thank you @m-Bilal for the thorough investigation and narrowing down what caused the problem. It's super helpful to have you take some time to work on kustomize! |
Hard agree! Breaking changes in patch versions makes it hard to have confidence in upgrades. |
Sure @natasha41575, will submit a PR in a few days. And thanks!! :D |
I have verified that the kustomization file provided by #4559 (comment) no longer throws an error, so this issue will no longer be there in the next release. |
what do we do until next release? downgrade? any workaround? |
There was a release done last week. |
For anyone encountering this issue - even in late 2023 - it's probably because you're using a version of ArgoCD that includes an old Kustomize version. |
if you are running into this in 2024 running in argo with kustomize version v5.2.1 the fix was to nested the remote kustomization under one directory and not have it at root. when running locally on v5.4.3 this was not an issue. so something must have got fixed between then. there goes a few hours of my life i am not getting back... |
Describe the bug
I am having a hard time understanding what is going on because some remote bases work and others don't. I can consistently reproduce the problem with one of our repos but unsure how to datamine more information about what is going on. I tried adding ssh and curl verbose flags but it isn't getting to that point.
Yet the same repo works fine with kustomize 4.5.2
Expected output
The same output as 4.5.2, no errors and the manifests rendered.
Actual output
Error message complaining about mapping contexts.
Kustomize version
Platform
Mac
The text was updated successfully, but these errors were encountered: