1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

add disallow_node_port.yaml

This commit is contained in:
Shuting Zhao 2019-10-08 22:13:34 -07:00
parent 18c190447f
commit 381210e977
3 changed files with 19 additions and 2 deletions

View file

@ -0,0 +1,17 @@
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: disallow-node-port
spec:
rules:
- name: disallow-node-port
match:
resources:
kinds:
- Service
validate:
message: "Disallow service of type NodePort"
pattern:
spec:
type: "!NodePort"

View file

@ -1,8 +1,8 @@
# file path relative to project root
input:
policy: examples/best_practices/policy_validate_disallow_node_port.yaml
resource: examples/best_practices/resources/resource_validate_disallow_node_port.yaml
policy: samples/best_practices/disallow_node_port.yaml
resource: test/manifest/disallow_node_port.yaml
expected:
validation:
policyresponse: