Skip to content

Commit

Permalink
Create Deny-Service-Type-Nodeport.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
epasham authored Dec 7, 2023
1 parent 0fedc7b commit 3c2648f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/by-use-case/Deny-Service-Type-Nodeport.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: policy.jspolicy.com/v1beta1
kind: JsPolicy
metadata:
name: "deny-service-type-nodeport.example.com"
spec:
operations: ["CREATE", "UPDATE"]
resources: ["services"]
javascript: |
// This policy blocks Service of type NodePort
if (request.object.spec.type === "NodePort") {
deny(`${request.name} => service type ${request.object.spec.type} is not allowed!`);
}

0 comments on commit 3c2648f

Please # to comment.