Skip to content

violation to check if key exists #525

Answered by anderseknert
equick asked this question in Gatekeeper
Discussion options

You must be logged in to vote

If you want to make that attribute required, I'd add another violation. That way you'll can have the error message explain in detail why it fails:

violation[{"msg": msg}] {
  not pod.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms

  msg := "missing required pod.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms"
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@equick
Comment options

Answer selected by equick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants