Skip to content

kustomize edit fix needs to split multi-doc SMP patches into multiple files #5040

@IvanovOleg

Description

@IvanovOleg

What happened?

I've tried my existing kustomize manifests with kustomize 5.0.0 and found a problem. I applied kustomize edit fix, but kustomize build command returns error:

Error: trouble configuring builtin PatchTransformer with config: `
path: secret.patch.yaml
`: unable to parse SM or JSON patch from [
manifest content
]

What did you expect to happen?

Kustomize build returns:

apiVersion: v1
kind: Secret
metadata:
  name: secret1
type: Opaque
stringData:
  admin.password: newpassword

---
apiVersion: v1
kind: Secret
metadata:
  name: secret2
type: Opaque
stringData:
  admin.user: newuser

How can we reproduce it (as minimally and precisely as possible)?

# kustomization.yaml
resources:
  - secret.yaml

patches:
  - path: secret.patch.yaml
# secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: secret1
type: Opaque
stringData:
  admin.password: password

---
apiVersion: v1
kind: Secret
metadata:
  name: secret2
type: Opaque
stringData:
  admin.user: user
# secret.patch.yaml
apiVersion: v1
kind: Secret
metadata:
  name: secret1
type: Opaque
stringData:
  admin.password: newpassword

---
apiVersion: v1
kind: Secret
metadata:
  name: secret2
type: Opaque
stringData:
  admin.user: newuser

Expected output

apiVersion: v1
kind: Secret
metadata:
  name: secret1
type: Opaque
stringData:
  admin.password: newpassword

---
apiVersion: v1
kind: Secret
metadata:
  name: secret2
type: Opaque
stringData:
  admin.user: newuser

Actual output

Error: trouble configuring builtin PatchTransformer with config: `
path: secret.patch.yaml
`: unable to parse SM or JSON patch from [apiVersion: v1
kind: Secret
metadata:
  name: secret1
type: Opaque
stringData:
  admin.password: newpassword

---
apiVersion: v1
kind: Secret
metadata:
  name: secret2
type: Opaque
stringData:
  admin.user: newuser
]

Kustomize version

5.0.0

Operating system

Linux

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions