Skip to content

Commit

Permalink
updated admission policy to account for controller
Browse files Browse the repository at this point in the history
  • Loading branch information
guptaNswati committed Dec 21, 2024
1 parent 34d49b8 commit 89abbec
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ spec:
- name: objectNodeName
expression: >-
(request.operation == "DELETE" ? oldObject : object).spec.?nodeName.orValue("")
- name: nodeSelectorValue
expression: >-
(request.operation == "DELETE" ? oldObject : object).spec.nodeSelector.nodeSelectorTerms[0].matchExpressions[0].values[0].orValue("")
validations:
- expression: variables.userNodeName != ""
message: >-
no node association found for user, this user must run in a pod on a node and ServiceAccountTokenPodNodeInfo must be enabled
- expression: variables.userNodeName == variables.objectNodeName
- expression: variables.userNodeName == variables.objectNodeName || variables.nodeSelectorValue != ""
messageExpression: >-
"this user running on node '"+variables.userNodeName+"' may not modify " +
(variables.objectNodeName == "" ?"cluster resourceslices" : "resourceslices on node '"+variables.objectNodeName+"'")
"this user running on node '"+variables.userNodeName+"' may not modify cluster or node resourceslices"

0 comments on commit 89abbec

Please sign in to comment.