Skip to content

Commit b190f6c

Browse files
committed
chore(mysql-cluster): modify networkpolicy rules. empty ingress when router service type is loadbalancer
1 parent 0d90c1f commit b190f6c

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,35 @@ spec:
2020
podSelector:
2121
matchLabels:
2222
{{- include "common.labels.matchLabels" . | nindent 6 }}
23+
{{- if eq .Values.router.service.type "ClusterIP" }}
2324
ingress:
2425
# Allow inbound connections
2526
- ports:
2627
- port: {{ .Values.router.service.portrw }}
2728
- port: {{ .Values.router.service.portro }}
2829
- port: 24901
2930
- port: 33061
30-
{{- if and .Values.metrics.enabled }}
31+
{{- if and .Values.metrics.enabled }}
3132
- port: {{ .Values.metrics.service.port }}
32-
{{ end }}
33-
{{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
33+
{{- end }}
34+
{{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
3435
from:
3536
{{- if .Values.networkPolicy.allowCurrentNamespace }}
3637
- namespaceSelector:
3738
matchLabels:
3839
kubernetes.io/metadata.name: {{ .Release.Namespace }}
3940
{{- end }}
4041
{{- range $namespace := .Values.networkPolicy.allowNamespaces }}
41-
{{- if $namespace }}
42+
{{- if $namespace }}
4243
- namespaceSelector:
4344
matchLabels:
4445
kubernetes.io/metadata.name: {{ $namespace }}
46+
{{- end }}
4547
{{- end }}
46-
{{- end }}
48+
{{- end }}
4749
{{- end }}
50+
{{- if eq .Values.router.service.type "LoadBalancer" }}
51+
ingress:
52+
- {}
53+
{{- end}}
4854
{{- end }}

0 commit comments

Comments
 (0)