2023-07-10 14:02:28 +00:00
|
|
|
{{- /*
|
|
|
|
Copyright VMware, Inc.
|
|
|
|
SPDX-License-Identifier: APACHE-2.0
|
|
|
|
*/}}
|
|
|
|
|
2022-10-26 15:53:33 +00:00
|
|
|
{{- if .Values.networkPolicy.enabled }}
|
|
|
|
kind: NetworkPolicy
|
|
|
|
apiVersion: {{ template "common.capabilities.networkPolicy.apiVersion" . }}
|
|
|
|
metadata:
|
|
|
|
name: {{ template "common.names.fullname" . }}
|
|
|
|
namespace: {{ include "common.names.namespace" . | quote }}
|
2023-08-24 14:41:28 +00:00
|
|
|
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
2022-10-26 15:53:33 +00:00
|
|
|
{{- if .Values.commonAnnotations }}
|
|
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
|
|
{{- end }}
|
|
|
|
spec:
|
|
|
|
podSelector:
|
2023-08-24 14:41:28 +00:00
|
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
|
2022-10-26 15:53:33 +00:00
|
|
|
ingress:
|
|
|
|
# Allow inbound connections
|
|
|
|
- ports:
|
|
|
|
- port: {{ .Values.primary.service.ports.mysql }}
|
|
|
|
{{- if not .Values.networkPolicy.allowExternal }}
|
|
|
|
from:
|
|
|
|
- podSelector:
|
|
|
|
matchLabels:
|
|
|
|
{{ template "common.names.fullname" . }}-client: "true"
|
|
|
|
{{- if .Values.networkPolicy.explicitNamespacesSelector }}
|
|
|
|
namespaceSelector:
|
|
|
|
{{ toYaml .Values.networkPolicy.explicitNamespacesSelector | indent 12 }}
|
|
|
|
{{- end }}
|
|
|
|
- podSelector:
|
2023-08-24 14:41:28 +00:00
|
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
|
2022-10-26 15:53:33 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.metrics.enabled }}
|
|
|
|
# Allow prometheus scrapes
|
|
|
|
- ports:
|
|
|
|
- port: 9104
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|