Skip to content

Commit 5835b9c

Browse files
committed
Add default network policy that allows network ingress inside psmdb namespace and between psmdb namespace and percona-mongodb operator's namespace.
1 parent 35473cc commit 5835b9c

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ range .Values.extraObjects }}
2+
---
3+
{{- if typeIs "string" . }}
4+
{{- tpl . $ }}
5+
{{- else }}
6+
{{- tpl (toYaml .) $ }}
7+
{{- end }}
8+
{{ end }}
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{ if .Values.networkPolicy.enabled }}
2+
---
3+
apiVersion: networking.k8s.io/v1
4+
kind: NetworkPolicy
5+
metadata:
6+
name: allow-ingress-psmdb-operator
7+
spec:
8+
podSelector: {}
9+
policyTypes:
10+
- Ingress
11+
ingress:
12+
- from:
13+
- namespaceSelector:
14+
matchLabels:
15+
kubernetes.io/metadata.name: {{ .Values.networkPolicy.operatorNamespace }}
16+
ports:
17+
- port: 27017
18+
---
19+
apiVersion: networking.k8s.io/v1
20+
kind: NetworkPolicy
21+
metadata:
22+
name: allow-ingress-in-namespace
23+
spec:
24+
podSelector: {}
25+
policyTypes:
26+
- Ingress
27+
ingress:
28+
- from:
29+
- namespaceSelector:
30+
matchLabels:
31+
kubernetes.io/metadata.name: {{ .Release.Namespace }}
32+
ports:
33+
- port: 27017
34+
{{ end }}

charts/psmdb-db/values.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -591,3 +591,13 @@ backup:
591591
# PMM_SERVER_API_KEY: apikey
592592
# # PMM_SERVER_USER: admin
593593
# # PMM_SERVER_PASSWORD: admin
594+
595+
networkPolicy:
596+
## Set as psmdb-operator namespace
597+
#operatorNamespace: FIXME
598+
enabled: false
599+
600+
extraObjects: []
601+
# - apiVersion: plop
602+
# spec:
603+
# foo: bar

0 commit comments

Comments
 (0)