Skip to content

Commit 045ed72

Browse files
committed
restart redpanda on changes to the cluster configuration
1 parent de4f039 commit 045ed72

File tree

4 files changed

+37
-21
lines changed

4 files changed

+37
-21
lines changed

charts/redpanda/configmap.tpl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ func RedpandaConfigFile(dot *helmette.Dot, includeNonHashableItems bool) string
122122
return helmette.ToYaml(redpandaYaml)
123123
}
124124

125+
func RedpandaClusterConfig(dot *helmette.Dot) string {
126+
values := helmette.Unwrap[Values](dot.Values)
127+
return helmette.ToYaml(values.Config.Cluster.Translate())
128+
}
129+
125130
// RPKProfile returns a [corev1.ConfigMap] for aiding users in connecting to
126131
// the external listeners of their redpanda cluster.
127132
// It is meant for external consumption via NOTES.txt and is not used within

charts/redpanda/statefulset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ func statefulSetChecksumAnnotation(dot *helmette.Dot) string {
10511051
var dependencies []any
10521052
// NB: Seed servers is excluded to avoid a rolling restart when only
10531053
// replicas is changed.
1054-
dependencies = append(dependencies, RedpandaConfigFile(dot, false))
1054+
dependencies = append(dependencies, RedpandaConfigFile(dot, false), RedpandaClusterConfig(dot))
10551055
if values.External.Enabled {
10561056
dependencies = append(dependencies, ptr.Deref(values.External.Domain, ""))
10571057
if helmette.Empty(values.External.Addresses) {

charts/redpanda/templates/_configmap.go.tpl

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@
7878
{{- end -}}
7979
{{- end -}}
8080

81+
{{- define "redpanda.RedpandaClusterConfig" -}}
82+
{{- $dot := (index .a 0) -}}
83+
{{- range $_ := (list 1) -}}
84+
{{- $_is_returning := false -}}
85+
{{- $values := $dot.Values.AsMap -}}
86+
{{- $_is_returning = true -}}
87+
{{- (dict "r" (toYaml (get (fromJson (include "redpanda.ClusterConfig.Translate" (dict "a" (list $values.config.cluster) ))) "r"))) | toJson -}}
88+
{{- break -}}
89+
{{- end -}}
90+
{{- end -}}
91+
8192
{{- define "redpanda.RPKProfile" -}}
8293
{{- $dot := (index .a 0) -}}
8394
{{- range $_ := (list 1) -}}
@@ -121,23 +132,23 @@
121132
{{- break -}}
122133
{{- end -}}
123134
{{- $kafkaTLS := (get (fromJson (include "redpanda.rpkKafkaClientTLSConfiguration" (dict "a" (list $dot) ))) "r") -}}
124-
{{- $_175___ok_3 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $kafkaTLS "ca_file" (coalesce nil)) ))) "r") -}}
125-
{{- $_ := (index $_175___ok_3 0) -}}
126-
{{- $ok_3 := (index $_175___ok_3 1) -}}
135+
{{- $_180___ok_3 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $kafkaTLS "ca_file" (coalesce nil)) ))) "r") -}}
136+
{{- $_ := (index $_180___ok_3 0) -}}
137+
{{- $ok_3 := (index $_180___ok_3 1) -}}
127138
{{- if $ok_3 -}}
128139
{{- $_ := (set $kafkaTLS "ca_file" "ca.crt") -}}
129140
{{- end -}}
130141
{{- $adminTLS := (get (fromJson (include "redpanda.rpkAdminAPIClientTLSConfiguration" (dict "a" (list $dot) ))) "r") -}}
131-
{{- $_181___ok_4 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $adminTLS "ca_file" (coalesce nil)) ))) "r") -}}
132-
{{- $_ := (index $_181___ok_4 0) -}}
133-
{{- $ok_4 := (index $_181___ok_4 1) -}}
142+
{{- $_186___ok_4 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $adminTLS "ca_file" (coalesce nil)) ))) "r") -}}
143+
{{- $_ := (index $_186___ok_4 0) -}}
144+
{{- $ok_4 := (index $_186___ok_4 1) -}}
134145
{{- if $ok_4 -}}
135146
{{- $_ := (set $adminTLS "ca_file" "ca.crt") -}}
136147
{{- end -}}
137148
{{- $schemaTLS := (get (fromJson (include "redpanda.rpkSchemaRegistryClientTLSConfiguration" (dict "a" (list $dot) ))) "r") -}}
138-
{{- $_187___ok_5 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $schemaTLS "ca_file" (coalesce nil)) ))) "r") -}}
139-
{{- $_ := (index $_187___ok_5 0) -}}
140-
{{- $ok_5 := (index $_187___ok_5 1) -}}
149+
{{- $_192___ok_5 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $schemaTLS "ca_file" (coalesce nil)) ))) "r") -}}
150+
{{- $_ := (index $_192___ok_5 0) -}}
151+
{{- $ok_5 := (index $_192___ok_5 1) -}}
141152
{{- if $ok_5 -}}
142153
{{- $_ := (set $schemaTLS "ca_file" "ca.crt") -}}
143154
{{- end -}}
@@ -318,10 +329,10 @@
318329
{{- if (gt ((get (fromJson (include "_shims.len" (dict "a" (list $tls_8) ))) "r") | int) (0 | int)) -}}
319330
{{- $schemaRegistryTLS = $tls_8 -}}
320331
{{- end -}}
321-
{{- $_372_lockMemory_overprovisioned_flags := (get (fromJson (include "redpanda.RedpandaAdditionalStartFlags" (dict "a" (list $values) ))) "r") -}}
322-
{{- $lockMemory := (index $_372_lockMemory_overprovisioned_flags 0) -}}
323-
{{- $overprovisioned := (index $_372_lockMemory_overprovisioned_flags 1) -}}
324-
{{- $flags := (index $_372_lockMemory_overprovisioned_flags 2) -}}
332+
{{- $_377_lockMemory_overprovisioned_flags := (get (fromJson (include "redpanda.RedpandaAdditionalStartFlags" (dict "a" (list $values) ))) "r") -}}
333+
{{- $lockMemory := (index $_377_lockMemory_overprovisioned_flags 0) -}}
334+
{{- $overprovisioned := (index $_377_lockMemory_overprovisioned_flags 1) -}}
335+
{{- $flags := (index $_377_lockMemory_overprovisioned_flags 2) -}}
325336
{{- $result := (dict "additional_start_flags" $flags "enable_memory_locking" $lockMemory "overprovisioned" $overprovisioned "kafka_api" (dict "brokers" $brokerList "tls" $brokerTLS ) "admin_api" (dict "addresses" (get (fromJson (include "redpanda.Listeners.AdminList" (dict "a" (list $values.listeners ($values.statefulset.replicas | int) (get (fromJson (include "redpanda.Fullname" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.InternalDomain" (dict "a" (list $dot) ))) "r")) ))) "r") "tls" $adminTLS ) "schema_registry" (dict "addresses" (get (fromJson (include "redpanda.Listeners.SchemaRegistryList" (dict "a" (list $values.listeners ($values.statefulset.replicas | int) (get (fromJson (include "redpanda.Fullname" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.InternalDomain" (dict "a" (list $dot) ))) "r")) ))) "r") "tls" $schemaRegistryTLS ) ) -}}
326337
{{- $result = (merge (dict ) $result (get (fromJson (include "redpanda.Tuning.Translate" (dict "a" (list $values.tuning) ))) "r")) -}}
327338
{{- $result = (merge (dict ) $result (get (fromJson (include "redpanda.Config.CreateRPKConfiguration" (dict "a" (list $values.config) ))) "r")) -}}
@@ -565,17 +576,17 @@
565576
{{- end -}}
566577
{{- $enabledOptions := (dict "true" true "1" true "" true ) -}}
567578
{{- $lockMemory := false -}}
568-
{{- $_657_value_14_ok_15 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "--lock-memory" "") ))) "r") -}}
569-
{{- $value_14 := (index $_657_value_14_ok_15 0) -}}
570-
{{- $ok_15 := (index $_657_value_14_ok_15 1) -}}
579+
{{- $_662_value_14_ok_15 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "--lock-memory" "") ))) "r") -}}
580+
{{- $value_14 := (index $_662_value_14_ok_15 0) -}}
581+
{{- $ok_15 := (index $_662_value_14_ok_15 1) -}}
571582
{{- if $ok_15 -}}
572583
{{- $lockMemory = (ternary (index $enabledOptions $value_14) false (hasKey $enabledOptions $value_14)) -}}
573584
{{- $_ := (unset $flags "--lock-memory") -}}
574585
{{- end -}}
575586
{{- $overprovisioned := false -}}
576-
{{- $_664_value_16_ok_17 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "--overprovisioned" "") ))) "r") -}}
577-
{{- $value_16 := (index $_664_value_16_ok_17 0) -}}
578-
{{- $ok_17 := (index $_664_value_16_ok_17 1) -}}
587+
{{- $_669_value_16_ok_17 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "--overprovisioned" "") ))) "r") -}}
588+
{{- $value_16 := (index $_669_value_16_ok_17 0) -}}
589+
{{- $ok_17 := (index $_669_value_16_ok_17 1) -}}
579590
{{- if $ok_17 -}}
580591
{{- $overprovisioned = (ternary (index $enabledOptions $value_16) false (hasKey $enabledOptions $value_16)) -}}
581592
{{- $_ := (unset $flags "--overprovisioned") -}}

charts/redpanda/templates/_statefulset.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@
615615
{{- $_is_returning := false -}}
616616
{{- $values := $dot.Values.AsMap -}}
617617
{{- $dependencies := (coalesce nil) -}}
618-
{{- $dependencies = (concat (default (list ) $dependencies) (list (get (fromJson (include "redpanda.RedpandaConfigFile" (dict "a" (list $dot false) ))) "r"))) -}}
618+
{{- $dependencies = (concat (default (list ) $dependencies) (list (get (fromJson (include "redpanda.RedpandaConfigFile" (dict "a" (list $dot false) ))) "r") (get (fromJson (include "redpanda.RedpandaClusterConfig" (dict "a" (list $dot) ))) "r"))) -}}
619619
{{- if $values.external.enabled -}}
620620
{{- $dependencies = (concat (default (list ) $dependencies) (list (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $values.external.domain "") ))) "r"))) -}}
621621
{{- if (empty $values.external.addresses) -}}

0 commit comments

Comments
 (0)