kpt: kpt/kyaml doesn't parse yaml sequence nodes correctly

The following is expected workflow

@seh So summarizing your request…

If you start with

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
    kind: Something
  patch: |-
    - op: add
      path: placeholder
      value: known

and do

kpt cfg create-setter . some-json-pointer placeholder

The output should be

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
    kind: Something
  patch: |-
    - op: add
      path: placeholder # {"$kpt-set":"some-json-pointer"}
      value: known

and later on

kpt cfg set . some-json-pointer new-placeholder

should give output

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
    kind: Something
  patch: |-
    - op: add
      path: new-placeholder # {"$kpt-set":"some-json-pointer"}
      value: known

But it doesn’t work as expected. Investigate and fix it.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 19 (9 by maintainers)

Most upvoted comments

@seh well I have tried that, could not get it work though (which means that the documentation is correct) it fails with

json: cannot unmarshal array into Go struct field Patch.patches.patch of type string"