kyverno(kube): foreach patchStrategicMerge must be inline mapping, not block scalar

This commit is contained in:
2026-09-09 23:07:13 +02:00
parent 764a029c39
commit 3d258f147d
@@ -88,9 +88,12 @@ spec:
# `request.object` is available in BOTH admission and background modes:
# the backgroundController synthesizes an admission-like request for
# existing resources, so the same foreach works for both.
# NOTE: inside `foreach`, patchStrategicMerge must be an INLINE YAML
# mapping — a `|` block scalar is parsed as a string and fails with
# "wrong node kind: expected MappingNode but got ScalarNode".
foreach:
- list: "request.object.spec.containers"
patchStrategicMerge: |
patchStrategicMerge:
spec:
containers:
- name: "{{ element.name }}"
@@ -98,7 +101,7 @@ spec:
requests:
cpu: null
- list: "request.object.spec.initContainers || `[]`"
patchStrategicMerge: |
patchStrategicMerge:
spec:
initContainers:
- name: "{{ element.name }}"