40496a763f8d743e3c982168ebd34fffa0079878
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / charts / postgresql / templates / networkpolicy.yaml
1 {{- if .Values.networkPolicy.enabled }}
2 kind: NetworkPolicy
3 apiVersion: {{ template "postgresql.networkPolicy.apiVersion" . }}
4 metadata:
5   name: {{ template "postgresql.fullname" . }}
6   labels:
7     app: {{ template "postgresql.name" . }}
8     chart: {{ template "postgresql.chart" . }}
9     release: {{ .Release.Name | quote }}
10     heritage: {{ .Release.Service | quote }}
11 spec:
12   podSelector:
13     matchLabels:
14       app: {{ template "postgresql.name" . }}
15       release: {{ .Release.Name | quote }}
16   ingress:
17     # Allow inbound connections
18     - ports:
19       - port: 5432
20     {{- if not .Values.networkPolicy.allowExternal }}
21       from:
22       - podSelector:
23           matchLabels:
24             {{ template "postgresql.fullname" . }}-client: "true"
25     {{- end }}
26     # Allow prometheus scrapes
27     - ports:
28       - port: 9187
29 {{- end }}