38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
{{- if .Values.networkPolicy.enabled }}
|
|
kind: NetworkPolicy
|
|
apiVersion: networking.k8s.io/v1
|
|
metadata:
|
|
name: {{ include "rabbitmq.fullname" . }}
|
|
namespace: {{ .Release.Namespace | quote }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
podSelector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
ingress:
|
|
# Allow inbound connections
|
|
- ports:
|
|
- port: 4369 # EPMD
|
|
- port: {{ .Values.service.port }}
|
|
- port: {{ .Values.service.tlsPort }}
|
|
- port: {{ .Values.service.distPort }}
|
|
- port: {{ .Values.service.managerPort }}
|
|
{{- if not .Values.networkPolicy.allowExternal }}
|
|
from:
|
|
- podSelector:
|
|
matchLabels:
|
|
{{ template "rabbitmq.fullname" . }}-client: "true"
|
|
- podSelector:
|
|
matchLabels:
|
|
{{- include "common.labels.matchLabels" . | nindent 14 }}
|
|
{{- if .Values.networkPolicy.additionalRules }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.additionalRules "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
# Allow prometheus scrapes
|
|
- ports:
|
|
- port: {{ .Values.service.metricsPort }}
|
|
{{- end }}
|