| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- suite: test external-secrets networkpolicy
- templates:
- - networkpolicy.yaml
- tests:
- - it: should create a networkPolicy
- set:
- networkPolicy.enabled: true
- asserts:
- - equal:
- path: spec.policyTypes
- value:
- - Egress
- - Ingress
- - it: should not create a networkPolicy
- set:
- networkPolicy.enabled: false
- asserts:
- - hasDocuments:
- count: 0
- - it: should set correct pod selector
- set:
- networkPolicy.enabled: true
- asserts:
- - isNotEmpty:
- path: spec.podSelector.matchLabels
- - equal:
- path: spec.podSelector.matchLabels["app.kubernetes.io/name"]
- value: external-secrets
- - it: should apply default ingress ports
- set:
- networkPolicy.enabled: true
- asserts:
- - equal:
- path: spec.ingress[0].ports
- value:
- - protocol: TCP
- port: 8080
- - protocol: TCP
- port: 8082
- - it: should allow custom ingress CIDR blocks
- set:
- networkPolicy.enabled: true
- networkPolicy.ingress:
- - from:
- - ipBlock:
- cidr: 10.0.0.0/8
- ports:
- - protocol: TCP
- port: 8080
- asserts:
- - equal:
- path: spec.ingress[0].from[0].ipBlock.cidr
- value: 10.0.0.0/8
- - it: should allow custom ingress pod selector
- set:
- networkPolicy.enabled: true
- networkPolicy.ingress:
- - from:
- - podSelector:
- matchLabels:
- app: prometheus
- ports:
- - protocol: TCP
- port: 8080
- asserts:
- - equal:
- path: spec.ingress[0].from[0].podSelector.matchLabels.app
- value: prometheus
- - it: should allow custom egress CIDR blocks
- set:
- networkPolicy.enabled: true
- networkPolicy.egress:
- - to:
- - ipBlock:
- cidr: 0.0.0.0/0
- ports:
- - protocol: TCP
- port: 443
- asserts:
- - equal:
- path: spec.egress[0].to[0].ipBlock.cidr
- value: 0.0.0.0/0
- - it: should allow custom egress pod selector
- set:
- networkPolicy.enabled: true
- networkPolicy.egress:
- - to:
- - podSelector:
- matchLabels:
- k8s-app: kube-dns
- ports:
- - protocol: UDP
- port: 53
- asserts:
- - equal:
- path: spec.egress[0].to[0].podSelector.matchLabels["k8s-app"]
- value: kube-dns
|