Files
charts/bitnami/valkey-cluster/templates/networkpolicy.yaml
Rafael Ríos Saavedra c167147e25 [bitnami/valkey-cluster] Add valkey cluster chart (#27737)
* [bitnami/valkey-cluster] Initial release

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Some minor modifications

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Fix port parameter in test

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Fix parameter names in tests

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Update bitnami/valkey-cluster/Chart.yaml

Co-authored-by: Fran Mulero <francisco-jose.mulero@broadcom.com>
Signed-off-by: Rafael Ríos Saavedra <rafael.rios.saavedra@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Fix NOTES.txt password env var

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Fix some objects names

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Remove unused value and regenerate README

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Fix ginko module name. Set bitnami image name. Minor change.

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

---------

Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Signed-off-by: Rafael Ríos Saavedra <rafael.rios.saavedra@gmail.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Fran Mulero <francisco-jose.mulero@broadcom.com>
2024-07-08 14:42:02 +02:00

82 lines
3.2 KiB
YAML

{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: {{ template "networkPolicy.apiVersion" . }}
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.valkey.podLabels .Values.commonLabels ) "context" . ) }}
podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
policyTypes:
- Ingress
- Egress
{{- if .Values.networkPolicy.allowExternalEgress }}
egress:
- {}
{{- else }}
egress:
# Allow dns resolution
- ports:
- port: 53
protocol: TCP
- port: 53
protocol: UDP
# Allow outbound connections to other cluster pods
- ports:
- port: {{ .Values.valkey.containerPorts.valkey }}
- port: {{ .Values.valkey.containerPorts.bus }}
to:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
{{- if .Values.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
ingress:
# Allow inbound connections
- ports:
- port: {{ .Values.valkey.containerPorts.valkey }}
- port: {{ .Values.valkey.containerPorts.bus }}
{{- if .Values.metrics.enabled }}
# Allow prometheus scrapes for metrics
- port: {{ .Values.metrics.containerPorts.http }}
{{- end }}
{{- if not .Values.networkPolicy.allowExternal }}
from:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
- podSelector:
matchLabels:
{{ template "common.names.fullname" . }}-client: "true"
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
{{- end }}
{{- if .Values.networkPolicy.ingressNSMatchLabels }}
- namespaceSelector:
matchLabels:
{{- range $key, $value := .Values.networkPolicy.ingressNSMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.networkPolicy.ingressNSPodMatchLabels }}
- podSelector:
matchLabels:
{{- range $key, $value := .Values.networkPolicy.ingressNSPodMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}