Skip to content
Snippets Groups Projects
Commit 18e75974 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5653 update netpol for zufi and add unittests

parent 96394f1b
Branches
Tags
No related merge requests found
...@@ -110,14 +110,17 @@ spec: ...@@ -110,14 +110,17 @@ spec:
matchLabels: matchLabels:
component: info-manager component: info-manager
{{- end }} {{- end }}
{{- if ((.Values.ozgcloud).zufi).enabled }} {{- if (.Values.zufiManager).enabled }}
- to: - to:
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
kubernetes.io/metadata.name: {{ required "ozgcloud.zufi.namespace must be set if zufi is enabled" ((.Values.ozgcloud).zufi).namespace }} kubernetes.io/metadata.name: {{ required "zufiManager.namespace must be set if zufiManager server is enabled" (.Values.zufiManager).namespace }}
podSelector: podSelector:
matchLabels: matchLabels:
component: zufi-server component: zufi-server
ports:
- port: 9190
protocol: TCP
{{- end }} {{- end }}
- to: - to:
- namespaceSelector: - namespaceSelector:
......
...@@ -264,12 +264,31 @@ tests: ...@@ -264,12 +264,31 @@ tests:
- it: should add egress rule to zufi server if zufi is enabled - it: should add egress rule to zufi server if zufi is enabled
set: set:
ozgcloud: zufiManager:
zufi:
enabled: true enabled: true
namespace: zufi namespace: zufi
asserts: asserts:
- contains: - contains:
path: spec.egress
content:
to:
- podSelector:
matchLabels:
component: zufi-server
namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: zufi
ports:
- port: 9190
protocol: TCP
- it: should not add egress rule to zufi server if zufi is disabled
set:
zufiManager:
enabled: false
asserts:
- notContains:
path: spec.egress path: spec.egress
content: content:
to: to:
...@@ -279,12 +298,19 @@ tests: ...@@ -279,12 +298,19 @@ tests:
podSelector: podSelector:
matchLabels: matchLabels:
component: zufi-server component: zufi-server
ports:
- it: should not add egress rule to zufi server if zufi is disabled - port: 9190
protocol: TCP
- it: should throw error if zufi is enabled but zufi namespace is not set
set: set:
ozgcloud: zufiManager:
zufi: enabled: true
enabled: false namespace:
asserts:
- failedTemplate:
errorMessage: zufiManager.namespace must be set if zufiManager server is enabled
- it: should not enable zufi netpol by default
asserts: asserts:
- notContains: - notContains:
path: spec.egress path: spec.egress
...@@ -296,6 +322,10 @@ tests: ...@@ -296,6 +322,10 @@ tests:
podSelector: podSelector:
matchLabels: matchLabels:
component: zufi-server component: zufi-server
ports:
- port: 9190
protocol: TCP
- it: should add egress rule to dns service - it: should add egress rule to dns service
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment