Regarding https://open-policy-agent.github.io/gatekeeper-library/website/validation/poddisruptionbudget/
When matching labels between a Deployment and a PDB, the pod template labels should be used instead of the Deployment's selector labels. This is more accurate because PDB selectors match pod labels.
- labels := { [label, value] | some label; value := obj.spec.selector.matchLabels[label] }
+ labels := { [label, value] | some label; value := obj.spec.template.metadata.labels[label] }
Reading the official kubernetes documentation, a PDB targets pod labels, not deployments selector labels.
"A label selector .spec.selector to specify the set of pods to which it applies. This field is required."
https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget
Regarding https://open-policy-agent.github.io/gatekeeper-library/website/validation/poddisruptionbudget/
When matching labels between a Deployment and a PDB, the pod template labels should be used instead of the Deployment's selector labels. This is more accurate because PDB selectors match pod labels.
Reading the official kubernetes documentation, a PDB targets pod labels, not deployments selector labels.
"A label selector .spec.selector to specify the set of pods to which it applies. This field is required."
https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget