patch file with comments only not supported anymore in 5.2.1 (was supported in 5.1.1)
What happened?
I have multiple patches in a directory, some of them containing only comments (# put here your patches for the foo environment ) to serve as a guidance for end users to know what they could put inside
In kustomize 5.1.1, applying all the patches was not an issue.
Since kustomize 5.2.1, patched files with only comment in it are not supported anymore and kustomize throws an error : illegally qualifies as both an SM and JSON patch
If I remove the comment and leave the file empty, it is working again.
What did you expect to happen?
I expected patches with only comment to be supported as it was in the previous version. I expected no regression introduced by new version of kustomize.
How can we reproduce it (as minimally and precisely as possible)?
cat <<EOF >> kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- appset.yaml
patches:
- target:
group: argoproj.io
version: v1alpha1
kind: ApplicationSet
name: addons
path: patches/appset-region-eu.yaml
EOF
mkdir -p patches
cat <<EOF >> patches/appset-region-eu.yaml
# add patches for EU region here if needed
EOF
worked in kustomize 5.1.1 :
$ kustomize build .
<successfully outputs the content of "appset.yaml">
error in kustomize 5.2.1 and above (same result with kustomize 5.3.0) :
$ kustomize build .
Error: trouble configuring builtin PatchTransformer with config: `
path: patches/appset-region-eu.yaml
target:
group: argoproj.io
kind: ApplicationSet
name: gtp-addons
version: v1alpha1
`: illegally qualifies as both an SM and JSON patch: [path: "patches/appset-region-eu.yaml"]
Expected output
the content of the resource
Actual output
Error: trouble configuring builtin PatchTransformer with config: `
path: patches/appset-region-eu.yaml
target:
group: argoproj.io
kind: ApplicationSet
name: gtp-addons
version: v1alpha1
`: illegally qualifies as both an SM and JSON patch: [path: "patches/appset-region-eu.yaml"]
Kustomize version
5.2.1
Operating system
Linux
This issue is currently awaiting triage.
SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
/remove-lifecycle rotten