mirror of
https://github.com/bitnami/charts.git
synced 2026-04-02 07:17:26 +08:00
[bitnami/kafka] bugfix: add missing persistentVolumeClaimRetentionPolicy and fix config & network policies when adding extra listeners (#32615)
This commit is contained in:
committed by
GitHub
parent
328166c403
commit
9d1b911d00
@@ -13,7 +13,7 @@ ref: https://kafka.apache.org/documentation/#configuration
|
||||
{{- else }}
|
||||
# Listeners configuration
|
||||
listeners: {{ include "kafka.listeners" (dict "isController" false "context" .) }}
|
||||
listener.security.protocol.map: {{ include "kafka.securityProtocolMap" . }}
|
||||
listener.security.protocol.map: {{ include "kafka.securityProtocolMap" (dict "isController" false "context" .) }}
|
||||
advertised.listeners: {{ include "kafka.advertisedListeners" . }}
|
||||
# Kafka data logs directory
|
||||
log.dir: {{ printf "%s/data" .Values.broker.persistence.mountPath }}
|
||||
|
||||
94
bitnami/kafka/templates/broker/networkpolicy.yaml
Normal file
94
bitnami/kafka/templates/broker/networkpolicy.yaml
Normal file
@@ -0,0 +1,94 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ template "kafka.broker.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
app.kubernetes.io/component: broker
|
||||
app.kubernetes.io/part-of: kafka
|
||||
{{- 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.broker.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
||||
app.kubernetes.io/component: broker
|
||||
app.kubernetes.io/part-of: kafka
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
{{- if .Values.networkPolicy.allowExternalEgress }}
|
||||
egress:
|
||||
- {}
|
||||
{{- else }}
|
||||
egress:
|
||||
# Allow dns resolution
|
||||
- ports:
|
||||
- port: 53
|
||||
protocol: UDP
|
||||
- port: 53
|
||||
protocol: TCP
|
||||
# Allow internal communications between nodes
|
||||
- ports:
|
||||
- port: {{ .Values.listeners.client.containerPort }}
|
||||
- port: {{ .Values.listeners.interbroker.containerPort }}
|
||||
{{- range $listener := .Values.listeners.extraListeners }}
|
||||
- port: {{ $listener.containerPort }}
|
||||
{{- end }}
|
||||
{{- if .Values.externalAccess.enabled }}
|
||||
- port: {{ .Values.listeners.external.containerPort }}
|
||||
{{- end }}
|
||||
to:
|
||||
- podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
|
||||
{{- if .Values.networkPolicy.extraEgress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ingress:
|
||||
# Allow client connections
|
||||
- ports:
|
||||
- port: {{ .Values.listeners.client.containerPort }}
|
||||
- port: {{ .Values.listeners.interbroker.containerPort }}
|
||||
{{- range $listener := .Values.listeners.extraListeners }}
|
||||
- port: {{ $listener.containerPort }}
|
||||
{{- end }}
|
||||
{{- if .Values.externalAccess.enabled }}
|
||||
- port: {{ .Values.listeners.external.containerPort }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.jmx.enabled }}
|
||||
- port: {{ .Values.metrics.jmx.containerPorts.metrics }}
|
||||
{{- end }}
|
||||
{{- if not .Values.networkPolicy.allowExternal }}
|
||||
from:
|
||||
- podSelector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
|
||||
{{- if .Values.networkPolicy.addExternalClientAccess }}
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{ template "common.names.fullname" . }}-client: "true"
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.ingressPodMatchLabels }}
|
||||
- podSelector:
|
||||
matchLabels: {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.ingressPodMatchLabels "context" $ ) | nindent 14 }}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.ingressNSMatchLabels }}
|
||||
- namespaceSelector:
|
||||
matchLabels: {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.ingressNSMatchLabels "context" $ ) | nindent 14 }}
|
||||
{{- if .Values.networkPolicy.ingressNSPodMatchLabels }}
|
||||
podSelector:
|
||||
matchLabels: {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.ingressNSPodMatchLabel "context" $ ) | nindent 14 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.networkPolicy.extraIngress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -359,6 +359,11 @@ spec:
|
||||
claimName: {{ printf "%s" (tpl .Values.broker.logPersistence.existingClaim .) }}
|
||||
{{- end }}
|
||||
{{- if or (and .Values.broker.persistence.enabled (not .Values.broker.persistence.existingClaim)) (and .Values.broker.logPersistence.enabled (not .Values.broker.logPersistence.existingClaim)) }}
|
||||
{{- if .Values.broker.persistentVolumeClaimRetentionPolicy.enabled }}
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: {{ .Values.broker.persistentVolumeClaimRetentionPolicy.whenDeleted }}
|
||||
whenScaled: {{ .Values.broker.persistentVolumeClaimRetentionPolicy.whenScaled }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
{{- if and .Values.broker.persistence.enabled (not .Values.broker.persistence.existingClaim) }}
|
||||
- apiVersion: v1
|
||||
|
||||
Reference in New Issue
Block a user