kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

patch file with comments only not supported anymore in 5.2.1 (was supported in 5.1.1)

Open yogeek opened this issue 2 years ago • 8 comments

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

yogeek avatar Dec 13 '23 13:12 yogeek

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.

k8s-ci-robot avatar Dec 13 '23 13:12 k8s-ci-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Mar 12 '24 14:03 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Apr 11 '24 14:04 k8s-triage-robot

/remove-lifecycle rotten

yogeek avatar Apr 11 '24 15:04 yogeek