We are looking to use OPA gatekeeper to audit K8s PodDisruptionBudget (PDB) objects. In particular, we are looking to audit the number of disruptionsAllowed
within the status
field.
I believe this field will not be available at point of admission since it is calculated and added by the apiserver once the PDB has been applied to the cluster.
It appears that for e.g Pods, the status
field is passed as part of the AdmissionReview
object [1]. In that particular example it appears that only the pre-admission status fields make it into the AdmissionReview
object.
1.) Is it possible to audit on the current in-cluster status fields in the case of PDBs?
2.) Given the intended use of OPA Gatekeeper as an admission controller, would this be considered an anti-pattern?
[1] https://www.openpolicyagent.org/docs/latest/kubernetes-introduction/