[ci skip] Fix Kyverno priority injection to remove default priority/preemptionPolicy

The priority injection policy was setting priorityClassName on pods but
Kubernetes had already defaulted priority=0 and preemptionPolicy=PreemptLowerPriority
on those pods, causing admission controller to reject the mismatch.

Switch from patchStrategicMerge to patchesJson6902 to explicitly remove
the priority and preemptionPolicy fields before setting priorityClassName.
This commit is contained in:
Viktor Barzin 2026-02-21 23:11:35 +00:00
parent fc0e1c3c6e
commit 642e774b62

View file

@ -719,11 +719,21 @@ resource "kubernetes_manifest" "mutate_priority_from_tier" {
]
}
mutate = {
patchStrategicMerge = {
spec = {
priorityClassName = "tier-{{tierLabel}}"
patchesJson6902 = yamlencode([
{
op = "remove"
path = "/spec/priority"
},
{
op = "remove"
path = "/spec/preemptionPolicy"
},
{
op = "add"
path = "/spec/priorityClassName"
value = "tier-{{tierLabel}}"
}
}
])
}
}
]