3 SPDX-License-Identifier: APACHE-2.0
6 {{- if .Values.networkPolicy.enabled }}
8 apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
10 name: {{ include "mongodb.fullname" . }}
11 namespace: {{ include "common.names.namespace" . | quote }}
12 {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.labels .Values.commonLabels ) "context" . ) }}
13 labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
14 app.kubernetes.io/component: mongodb
15 {{- if or .Values.annotations .Values.commonAnnotation }}
16 {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.annotations .Values.commonAnnotations ) "context" . ) }}
17 annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
20 {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
22 matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
23 app.kubernetes.io/component: mongodb
27 {{- if .Values.networkPolicy.allowExternalEgress }}
32 # Allow dns resolution
38 # Allow connection to other cluster pods
40 - port: {{ .Values.containerPorts.mongodb }}
43 matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
44 {{- if .Values.networkPolicy.extraEgress }}
45 {{- include "common.tplvalues.render" ( dict "value" .Values.rts.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
50 - port: {{ .Values.containerPorts.mongodb }}
51 {{- if .Values.metrics.enabled }}
52 - port: {{ .Values.metrics.containerPort }}
54 {{- if not .Values.networkPolicy.allowExternal }}
58 {{ template "common.names.fullname" . }}-client: "true"
60 matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
61 app.kubernetes.io/component: mongodb
62 {{- $ingressNSMatchLabels := coalesce .Values.networkPolicy.ingressNSMatchLabels .Values.networkPolicy.namespaceSelector }}
63 {{- if $ingressNSMatchLabels }}
66 {{- range $key, $value := $ingressNSMatchLabels }}
67 {{ $key | quote }}: {{ $value | quote }}
69 {{- $ingressNSPodMatchLabels := coalesce .Values.networkPolicy.ingressNSPodMatchLabels .Values.networkPolicy.podSelector }}
70 {{- if $ingressNSPodMatchLabels }}
73 {{- range $key, $value := $ingressNSPodMatchLabels }}
74 {{ $key | quote }}: {{ $value | quote }}
79 {{- $extraIngress := coalesce .Values.networkPolicy.extraIngress .Values.networkPolicy.customRules }}
80 {{- if $extraIngress }}
81 {{- include "common.tplvalues.render" ( dict "value" $extraIngress "context" $ ) | nindent 4 }}