diff --git a/.changes/unreleased/chart-redpanda-Added-20250108-153147.yaml b/.changes/unreleased/chart-redpanda-Added-20250108-153147.yaml new file mode 100644 index 000000000..6cd595327 --- /dev/null +++ b/.changes/unreleased/chart-redpanda-Added-20250108-153147.yaml @@ -0,0 +1,22 @@ +project: chart-redpanda +kind: Added +body: | + Added `resources.limits` and `resources.requests` as an alternative method of managing the redpanda container's resources. + + When both `resources.limits` and `resources.requests` are specified, the + redpanda container's `resources` will be set to the provided values and all + other keys of `resources` will be ignored. Instead, all other values will be + inferred from the limits and requests. + + This allows fine grain control of resources. i.e. It is now possible to set + CPU requests without setting limits: + + ```yaml + resources: + limits: {} # Specified but no cpu or memory values provided + requests: + cpu: 5 # Only CPU requests + ``` + + For more details see [redpanda's values.yaml](./charts/redpanda/values.yaml). +time: 2025-01-08T15:31:47.946476-05:00 diff --git a/charts/redpanda/CHANGELOG.md b/charts/redpanda/CHANGELOG.md index 6514803df..73d18b5c8 100644 --- a/charts/redpanda/CHANGELOG.md +++ b/charts/redpanda/CHANGELOG.md @@ -5,6 +5,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and is generated by [Changie](https://github.com/miniscruff/changie). +## Unreleased +### Added +* Added `resources.limits` and `resources.requests` as an alternative method of managing the redpanda container's resources. + + When both `resources.limits` and `resources.requests` are specified, the + redpanda container's `resources` will be set to the provided values and all + other keys of `resources` will be ignored. Instead, all other values will be + inferred from the limits and requests. + + This allows fine grain control of resources. i.e. It is now possible to set + CPU requests without setting limits: + + ```yaml + resources: + limits: {} # Specified but no cpu or memory values provided + requests: + cpu: 5 # Only CPU requests + ``` + + For more details see [redpanda's values.yaml](./charts/redpanda/values.yaml). + + ### [5.9.18](https://github.com/redpanda-data/helm-charts/releases/tag/redpanda-5.9.18) - 2024-12-20 #### Added #### Changed diff --git a/charts/redpanda/README.md b/charts/redpanda/README.md index f0a1a5d31..1e7ba4d08 100644 --- a/charts/redpanda/README.md +++ b/charts/redpanda/README.md @@ -621,7 +621,42 @@ Enable for features that need extra privileges. If you use the Redpanda Operator ### [resources](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=resources) -Pod resource management. This section simplifies resource allocation by providing a single location where resources are defined. Helm sets these resource values within the `statefulset.yaml` and `configmap.yaml` templates. The default values are for a development environment. Production-level values and other considerations are documented, where those values are different from the default. For details, see the [Pod resources documentation](https://docs.redpanda.com/docs/manage/kubernetes/manage-resources/). +Pod resource management. +This section simplifies resource allocation for the redpanda container by +providing a single location where resources are defined. + +Resources may be specified by either setting `resources.cpu` and +`resources.memory` (the default) or by setting `resources.requests` and +`resources.limits`. + +For details on `resources.cpu` and `resources.memory`, see their respective +documentation below. + +When `resources.limits` and `resources.requests` are set, the redpanda +container's resources will be set to exactly the provided values. This allows +users to granularly control limits and requests to best suit their use case. +For example: `resources.requests.cpu` may be set without setting +`resources.limits.cpu` to avoid the potential of CPU throttling. + +Redpanda's resource related CLI flags will then be calculated as follows: +* `--smp max(1, floor(coalesce(resources.requests.cpu, resources.limits.cpu)))` +* `--memory coalesce(resources.requests.memory, resources.limits.memory) * 90%` +* `--reserve-memory 0` +* `--overprovisioned coalesce(resources.requests.cpu, resources.limits.cpu) < 1000m` + +If neither a request nor a limit is provided for cpu or memory, the +corresponding flag will be omitted. As a result, setting `resources.limits` +and `resources.requests` to `{}` will result in redpanda being run without +`--smp` or `--memory`. (This is not recommended). + +If the computed CLI flags are undesirable, they may be overridden by +specifying the desired value through `statefulset.additionalRedpandaCmdFlags`. + +The default values are for a development environment. +Production-level values and other considerations are documented, +where those values are different from the default. +For details, +see the [Pod resources documentation](https://docs.redpanda.com/docs/manage/kubernetes/manage-resources/). **Default:** @@ -961,7 +996,7 @@ To create `Guaranteed` Pods for Redpanda brokers, provide both requests and limi ### [statefulset.sideCars.controllers.image.tag](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=statefulset.sideCars.controllers.image.tag) -**Default:** `"v2.3.5-24.3.2"` +**Default:** `"v2.3.3-24.3.1"` ### [statefulset.sideCars.controllers.metricsAddress](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=statefulset.sideCars.controllers.metricsAddress) diff --git a/charts/redpanda/configmap.tpl.go b/charts/redpanda/configmap.tpl.go index 624a17028..10d6b8c46 100644 --- a/charts/redpanda/configmap.tpl.go +++ b/charts/redpanda/configmap.tpl.go @@ -359,10 +359,12 @@ func rpkNodeConfig(dot *helmette.Dot) map[string]any { schemaRegistryTLS = tls } + lockMemory, overprovisioned, flags := RedpandaAdditionalStartFlags(&values) + result := map[string]any{ - "overprovisioned": values.Resources.GetOverProvisionValue(), - "enable_memory_locking": ptr.Deref(values.Resources.Memory.EnableMemoryLocking, false), - "additional_start_flags": RedpandaAdditionalStartFlags(dot, RedpandaSMP(dot)), + "additional_start_flags": flags, + "enable_memory_locking": lockMemory, + "overprovisioned": overprovisioned, "kafka_api": map[string]any{ "brokers": brokerList, "tls": brokerTLS, @@ -610,49 +612,60 @@ func createInternalListenerCfg(port int32) map[string]any { } } -// RedpandaAdditionalStartFlags returns a string list of flags suitable for use +// RedpandaAdditionalStartFlags returns a string slice of flags suitable for use // as `additional_start_flags`. User provided flags will override any of those // set by default. -func RedpandaAdditionalStartFlags(dot *helmette.Dot, smp int64) []string { - values := helmette.Unwrap[Values](dot.Values) - +func RedpandaAdditionalStartFlags(values *Values) (bool, bool, []string) { // All `additional_start_flags` that are set by the chart. - chartFlags := map[string]string{ - "smp": fmt.Sprintf("%d", int(smp)), - // TODO: The transpiled go template will return float64 from both RedpandaMemory and RedpandaReserveMemory - // By wrapping return value from that function the sprintf will work as expected - // https://github.com/redpanda-data/helm-charts/issues/1249 - "memory": fmt.Sprintf("%dM", int(RedpandaMemory(dot))), - // TODO: The transpiled go template will return float64 from both RedpandaMemory and RedpandaReserveMemory - // By wrapping return value from that function the sprintf will work as expected - // https://github.com/redpanda-data/helm-charts/issues/1249 - "reserve-memory": fmt.Sprintf("%dM", int(RedpandaReserveMemory(dot))), - "default-log-level": values.Logging.LogLevel, - } - - // If in developer_mode, don't set reserve-memory. + flags := values.Resources.GetRedpandaFlags() + flags["--default-log-level"] = values.Logging.LogLevel + + // Unclear why this is done aside from historical reasons. + // Legacy comment: If in developer_mode, don't set reserve-memory. if values.Config.Node["developer_mode"] == true { - delete(chartFlags, "reserve-memory") + delete(flags, "reserve-memory") } - // Check to see if there are any flags overriding the defaults set by the - // chart. - for flag := range chartFlags { - for _, userFlag := range values.Statefulset.AdditionalRedpandaCmdFlags { - if helmette.RegexMatch(fmt.Sprintf("^--%s", flag), userFlag) { - delete(chartFlags, flag) - } - } + for key, value := range ParseCLIArgs(values.Statefulset.AdditionalRedpandaCmdFlags) { + flags[key] = value + } + + enabledOptions := map[string]bool{ + "true": true, + "1": true, + "": true, + } + + // Due to a buglet in rpk, we need to set lock-memory and overprovisioned + // via their fields in redpanda.yaml instead of additional_start_flags. + // https://github.com/redpanda-data/helm-charts/pull/1622#issuecomment-2577922409 + lockMemory := false + if value, ok := flags["lock-memory"]; ok { + lockMemory = enabledOptions[value] + delete(flags, "lock-memory") + } + + overprovisioned := false + if value, ok := flags["overprovisioned"]; ok { + overprovisioned = enabledOptions[value] + delete(flags, "overprovisioned") } // Deterministically order out list and add in values supplied flags. - keys := helmette.Keys(chartFlags) - helmette.SortAlpha(keys) + keys := helmette.Keys(flags) + keys = helmette.SortAlpha(keys) - flags := []string{} + var rendered []string for _, key := range keys { - flags = append(flags, fmt.Sprintf("--%s=%s", key, chartFlags[key])) + value := flags[key] + // Support flags that don't have values (`--overprovisioned`) by + // letting them be specified as key: "" + if value == "" { + rendered = append(rendered, fmt.Sprintf("--%s", key)) + } else { + rendered = append(rendered, fmt.Sprintf("--%s=%s", key, value)) + } } - return append(flags, values.Statefulset.AdditionalRedpandaCmdFlags...) + return lockMemory, overprovisioned, rendered } diff --git a/charts/redpanda/helpers.go b/charts/redpanda/helpers.go index c30a79125..5346fb399 100644 --- a/charts/redpanda/helpers.go +++ b/charts/redpanda/helpers.go @@ -416,18 +416,6 @@ func cleanForK8sWithSuffix(s, suffix string) string { return fmt.Sprintf("%s-%s", s, suffix) } -func RedpandaSMP(dot *helmette.Dot) int64 { - values := helmette.Unwrap[Values](dot.Values) - - coresInMillies := values.Resources.CPU.Cores.MilliValue() - - if coresInMillies < 1000 { - return 1 - } - - return values.Resources.CPU.Cores.Value() -} - // coalesce returns the first non-nil pointer. This is distinct from helmette's // Coalesce which returns the first non-EMPTY pointer. // It accepts a slice as variadic methods are not currently supported in @@ -580,3 +568,54 @@ func mergeContainer(original corev1.Container, override applycorev1.ContainerApp merged.VolumeMounts = mergeSliceBy(original.VolumeMounts, override.VolumeMounts, "name", mergeVolumeMount) return merged } + +// ParseCLIArgs parses a slice of strings intended for rpk's +// `additional_start_flags` field into a map to allow merging slices of flags +// or introspection thereof. +// Flags without values are not differentiated between flags with values of an +// empty string. e.g. --value and --value=” are represented the same way. +func ParseCLIArgs(args []string) map[string]string { + parsed := map[string]string{} + + // NB: templates/gotohelm don't supported c style for loops (or ++) which + // is the ideal for this situation. The janky code you see is a rough + // equivalent for the following: + // for i := 0; i < len(args); i++ { + i := -1 // Start at -1 so our increment can be at the start of the loop. + for range args { // Range needs to range over something and we'll always have < len(args) iterations. + i = i + 1 + if i >= len(args) { + break + } + + // All flags should start with - or --. + // If not present, skip this value. + if !strings.HasPrefix(args[i], "-") { + continue + } + + flag := args[i] + + // Handle values like: `--flag value` or `--flag=value` + // There's no strings.Index in sprig, so RegexSplit is the next best + // option. + spl := helmette.RegexSplit(" |=", flag, 2) + if len(spl) == 2 { + parsed[spl[0]] = spl[1] + continue + } + + // If no ' ' or =, consume the next value if it's not formatted like a + // flag: `--flag`, `value` + if i+1 < len(args) && !strings.HasPrefix(args[i+1], "-") { + parsed[flag] = args[i+1] + i = i + 1 + continue + } + + // Otherwise, assume this is a bare flag and assign it an empty string. + parsed[flag] = "" + } + + return parsed +} diff --git a/charts/redpanda/helpers_test.go b/charts/redpanda/helpers_test.go index e535d4be2..685a655d4 100644 --- a/charts/redpanda/helpers_test.go +++ b/charts/redpanda/helpers_test.go @@ -210,3 +210,58 @@ func TestStrategicMergePatch_nopanic(t *testing.T) { }) }) } + +func TestParseCLIArgs(t *testing.T) { + testCases := []struct { + In []string + Out map[string]string + }{ + { + In: []string{}, + Out: map[string]string{}, + }, + { + In: []string{ + "-foo=bar", + "-baz 1", + "--help", "topic", + }, + Out: map[string]string{ + "-foo": "bar", + "-baz": "1", + "--help": "topic", + }, + }, + { + In: []string{ + "invalid", + "-valid=bar", + "--trailing spaces ", + "--bare=", + "ignored-perhaps-confusingly", + "--final", + }, + Out: map[string]string{ + "-valid": "bar", + "--trailing": "spaces ", + "--bare": "", + "--final": "", + }, + }, + } + + for _, tc := range testCases { + assert.Equal(t, tc.Out, redpanda.ParseCLIArgs(tc.In)) + } + + t.Run("NotPanics", rapid.MakeCheck(func(t *rapid.T) { + // We could certainly be more inventive with + // the inputs here but this is more of a + // fuzz test than a property test. + in := rapid.SliceOf(rapid.String()).Draw(t, "input") + + assert.NotPanics(t, func() { + redpanda.ParseCLIArgs(in) + }) + })) +} diff --git a/charts/redpanda/memory.go b/charts/redpanda/memory.go deleted file mode 100644 index f9ec854d1..000000000 --- a/charts/redpanda/memory.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2025 Redpanda Data, Inc. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.md -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0 - -// +gotohelm:filename=_memory.go.tpl -package redpanda - -import ( - "fmt" - - "github.com/redpanda-data/redpanda-operator/pkg/gotohelm/helmette" -) - -type MebiBytes = int64 - -// RedpandaReserveMemory will return the amount of memory that Redpanda process will not use from the provided value -// in `--memory` or from the internal Redpanda discovery process. It should be passed to the `--reserve-memory` argument -// of the Redpanda process, see RedpandaAdditionalStartFlags and rpk redpanda start documentation. -// https://docs.redpanda.com/current/reference/rpk/rpk-redpanda/rpk-redpanda-start/ -func RedpandaReserveMemory(dot *helmette.Dot) int64 { - values := helmette.Unwrap[Values](dot.Values) - // This optional `redpanda` object allows you to specify the memory size for both the Redpanda - // process and the underlying reserved memory used by Seastar. - // - // The amount of memory to allocate to a container is determined by the sum of three values: - // 1. Redpanda (at least 2Gi per core, ~80% of the container's total memory) - // 2. Seastar subsystem (200Mi * 0.2% of the container's total memory, 200Mi < x < 1Gi) - // 3. Other container processes (whatever small amount remains) - //if rpMem := values.Resources.Memory.Redpanda; rpMem != nil && rpMem.ReserveMemory != nil { - if rpMem := values.Resources.Memory.Redpanda; rpMem != nil && rpMem.ReserveMemory != nil { - return rpMem.ReserveMemory.Value() / (1024 * 1024) - } - - // If Redpanda is omitted (default behavior), memory sizes are calculated automatically - // based on 0.2% of container memory plus 200 Mi. - return int64(float64(ContainerMemory(dot))*0.002) + 200 -} - -// RedpandaMemory will return the amount of memory for Redpanda process. It should be passed to the -// `--memory` argument of the Redpanda process, see RedpandaAdditionalStartFlags and rpk redpanda start documentation. -// https://docs.redpanda.com/current/reference/rpk/rpk-redpanda/rpk-redpanda-start/ -func RedpandaMemory(dot *helmette.Dot) int64 { - values := helmette.Unwrap[Values](dot.Values) - - memory := int64(0) - containerMemory := ContainerMemory(dot) - // This optional `redpanda` object allows you to specify the memory size for both the Redpanda - // process and the underlying reserved memory used by Seastar. - // - // The amount of memory to allocate to a container is determined by the sum of three values: - // 1. Redpanda (at least 2Gi per core, ~80% of the container's total memory) - // 2. Seastar subsystem (200Mi * 0.2% of the container's total memory, 200Mi < x < 1Gi) - // 3. Other container processes (whatever small amount remains) - if rpMem := values.Resources.Memory.Redpanda; rpMem != nil && rpMem.Memory != nil { - memory = rpMem.Memory.Value() / (1024 * 1024) - } else { - // - memory = int64(float64(containerMemory) * 0.8) - } - - if memory == 0 { - panic("unable to get memory value redpanda-memory") - } - - if memory < 256 { - panic(fmt.Sprintf("%d is below the minimum value for Redpanda", memory)) - } - - if memory+RedpandaReserveMemory(dot) > containerMemory { - panic(fmt.Sprintf("Not enough container memory for Redpanda memory values where Redpanda: %d, reserve: %d, container: %d", memory, RedpandaReserveMemory(dot), containerMemory)) - } - - return memory -} - -// Returns either the min or max container memory values as an integer value of MembiBytes -func ContainerMemory(dot *helmette.Dot) MebiBytes { - values := helmette.Unwrap[Values](dot.Values) - - if values.Resources.Memory.Container.Min != nil { - return values.Resources.Memory.Container.Min.Value() / (1024 * 1024) - } - - return values.Resources.Memory.Container.Max.Value() / (1024 * 1024) -} diff --git a/charts/redpanda/servicemonitor.go b/charts/redpanda/servicemonitor.go index 625090b85..19d036b2d 100644 --- a/charts/redpanda/servicemonitor.go +++ b/charts/redpanda/servicemonitor.go @@ -29,7 +29,7 @@ func ServiceMonitor(dot *helmette.Dot) *monitoringv1.ServiceMonitor { Interval: values.Monitoring.ScrapeInterval, Path: "/public_metrics", Port: "admin", - EnableHttp2: values.Monitoring.EnableHttp2, + EnableHttp2: values.Monitoring.EnableHTTP2, Scheme: "http", } diff --git a/charts/redpanda/statefulset.go b/charts/redpanda/statefulset.go index 2aa95755e..bb61ef3a0 100644 --- a/charts/redpanda/statefulset.go +++ b/charts/redpanda/statefulset.go @@ -647,7 +647,7 @@ func statefulSetInitContainerConfigurator(dot *helmette.Dot) *corev1.Container { func StatefulSetContainers(dot *helmette.Dot) []corev1.Container { var containers []corev1.Container - containers = append(containers, *statefulSetContainerRedpanda(dot)) + containers = append(containers, statefulSetContainerRedpanda(dot)) if c := statefulSetContainerConfigWatcher(dot); c != nil { containers = append(containers, *c) } @@ -668,12 +668,12 @@ func wrapLifecycleHook(hook string, timeoutSeconds int64, cmd []string) []string return []string{"bash", "-c", fmt.Sprintf("timeout -v %d %s 2>&1 | sed \"s/^/lifecycle-hook %s $(date): /\" | tee /proc/1/fd/1; true", timeoutSeconds, wrapped, hook)} } -func statefulSetContainerRedpanda(dot *helmette.Dot) *corev1.Container { +func statefulSetContainerRedpanda(dot *helmette.Dot) corev1.Container { values := helmette.Unwrap[Values](dot.Values) internalAdvertiseAddress := fmt.Sprintf("%s.%s", "$(SERVICE_NAME)", InternalDomain(dot)) - container := &corev1.Container{ + container := corev1.Container{ Name: Name(dot), Image: fmt.Sprintf(`%s:%s`, values.Image.Repository, Tag(dot)), Env: bootstrapEnvVars(dot, statefulSetRedpandaEnv()), @@ -755,7 +755,7 @@ func statefulSetContainerRedpanda(dot *helmette.Dot) *corev1.Container { VolumeMounts: append(StatefulSetVolumeMounts(dot), templateToVolumeMounts(dot, values.Statefulset.ExtraVolumeMounts)...), SecurityContext: ptr.To(ContainerSecurityContext(dot)), - Resources: corev1.ResourceRequirements{}, + Resources: values.Resources.GetResourceRequirements(), } if !helmette.Dig(values.Config.Node, false, `recovery_mode_enabled`).(bool) { @@ -861,18 +861,6 @@ func statefulSetContainerRedpanda(dot *helmette.Dot) *corev1.Container { ) } - container.Resources.Limits = helmette.UnmarshalInto[corev1.ResourceList](map[string]any{ - "cpu": values.Resources.CPU.Cores, - "memory": values.Resources.Memory.Container.Max, - }) - - if values.Resources.Memory.Container.Min != nil { - container.Resources.Requests = helmette.UnmarshalInto[corev1.ResourceList](map[string]any{ - "cpu": values.Resources.CPU.Cores, - "memory": *values.Resources.Memory.Container.Min, - }) - } - return container } diff --git a/charts/redpanda/templates/_configmap.go.tpl b/charts/redpanda/templates/_configmap.go.tpl index fc500a921..cb99af309 100644 --- a/charts/redpanda/templates/_configmap.go.tpl +++ b/charts/redpanda/templates/_configmap.go.tpl @@ -313,7 +313,11 @@ {{- if (gt ((get (fromJson (include "_shims.len" (dict "a" (list $tls_8) ))) "r") | int) (0 | int)) -}} {{- $schemaRegistryTLS = $tls_8 -}} {{- end -}} -{{- $result := (dict "overprovisioned" (get (fromJson (include "redpanda.RedpandaResources.GetOverProvisionValue" (dict "a" (list $values.resources) ))) "r") "enable_memory_locking" (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $values.resources.memory.enable_memory_locking false) ))) "r") "additional_start_flags" (get (fromJson (include "redpanda.RedpandaAdditionalStartFlags" (dict "a" (list $dot ((get (fromJson (include "redpanda.RedpandaSMP" (dict "a" (list $dot) ))) "r") | int64)) ))) "r") "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 ) ) -}} +{{- $_370_lockMemory_overprovisioned_flags := (get (fromJson (include "redpanda.RedpandaAdditionalStartFlags" (dict "a" (list $values) ))) "r") -}} +{{- $lockMemory := (index $_370_lockMemory_overprovisioned_flags 0) -}} +{{- $overprovisioned := (index $_370_lockMemory_overprovisioned_flags 1) -}} +{{- $flags := (index $_370_lockMemory_overprovisioned_flags 2) -}} +{{- $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 ) ) -}} {{- $result = (merge (dict ) $result (get (fromJson (include "redpanda.Tuning.Translate" (dict "a" (list $values.tuning) ))) "r")) -}} {{- $result = (merge (dict ) $result (get (fromJson (include "redpanda.Config.CreateRPKConfiguration" (dict "a" (list $values.config) ))) "r")) -}} {{- $_is_returning = true -}} @@ -540,39 +544,53 @@ {{- end -}} {{- define "redpanda.RedpandaAdditionalStartFlags" -}} -{{- $dot := (index .a 0) -}} -{{- $smp := (index .a 1) -}} +{{- $values := (index .a 0) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} -{{- $values := $dot.Values.AsMap -}} -{{- $chartFlags := (dict "smp" (printf "%d" ($smp | int)) "memory" (printf "%dM" (((get (fromJson (include "redpanda.RedpandaMemory" (dict "a" (list $dot) ))) "r") | int64) | int)) "reserve-memory" (printf "%dM" (((get (fromJson (include "redpanda.RedpandaReserveMemory" (dict "a" (list $dot) ))) "r") | int64) | int)) "default-log-level" $values.logging.logLevel ) -}} +{{- $flags := (get (fromJson (include "redpanda.RedpandaResources.GetRedpandaFlags" (dict "a" (list $values.resources) ))) "r") -}} +{{- $_ := (set $flags "--default-log-level" $values.logging.logLevel) -}} {{- if (eq (index $values.config.node "developer_mode") true) -}} -{{- $_ := (unset $chartFlags "reserve-memory") -}} -{{- end -}} -{{- range $flag, $_ := $chartFlags -}} -{{- range $_, $userFlag := $values.statefulset.additionalRedpandaCmdFlags -}} -{{- if (regexMatch (printf "^--%s" $flag) $userFlag) -}} -{{- $_ := (unset $chartFlags $flag) -}} -{{- end -}} -{{- end -}} -{{- if $_is_returning -}} -{{- break -}} +{{- $_ := (unset $flags "reserve-memory") -}} {{- end -}} +{{- range $key, $value := (get (fromJson (include "redpanda.ParseCLIArgs" (dict "a" (list $values.statefulset.additionalRedpandaCmdFlags) ))) "r") -}} +{{- $_ := (set $flags $key $value) -}} {{- end -}} {{- if $_is_returning -}} {{- break -}} {{- end -}} -{{- $keys := (keys $chartFlags) -}} -{{- $_ := (sortAlpha $keys) -}} -{{- $flags := (list ) -}} +{{- $enabledOptions := (dict "true" true "1" true "" true ) -}} +{{- $lockMemory := false -}} +{{- $_655_value_14_ok_15 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "lock-memory" "") ))) "r") -}} +{{- $value_14 := (index $_655_value_14_ok_15 0) -}} +{{- $ok_15 := (index $_655_value_14_ok_15 1) -}} +{{- if $ok_15 -}} +{{- $lockMemory = (ternary (index $enabledOptions $value_14) false (hasKey $enabledOptions $value_14)) -}} +{{- $_ := (unset $flags "lock-memory") -}} +{{- end -}} +{{- $overprovisioned := false -}} +{{- $_662_value_16_ok_17 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $flags "overprovisioned" "") ))) "r") -}} +{{- $value_16 := (index $_662_value_16_ok_17 0) -}} +{{- $ok_17 := (index $_662_value_16_ok_17 1) -}} +{{- if $ok_17 -}} +{{- $overprovisioned = (ternary (index $enabledOptions $value_16) false (hasKey $enabledOptions $value_16)) -}} +{{- $_ := (unset $flags "overprovisioned") -}} +{{- end -}} +{{- $keys := (keys $flags) -}} +{{- $keys = (sortAlpha $keys) -}} +{{- $rendered := (coalesce nil) -}} {{- range $_, $key := $keys -}} -{{- $flags = (concat (default (list ) $flags) (list (printf "--%s=%s" $key (ternary (index $chartFlags $key) "" (hasKey $chartFlags $key))))) -}} +{{- $value := (ternary (index $flags $key) "" (hasKey $flags $key)) -}} +{{- if (eq $value "") -}} +{{- $rendered = (concat (default (list ) $rendered) (list (printf "--%s" $key))) -}} +{{- else -}} +{{- $rendered = (concat (default (list ) $rendered) (list (printf "--%s=%s" $key $value))) -}} +{{- end -}} {{- end -}} {{- if $_is_returning -}} {{- break -}} {{- end -}} {{- $_is_returning = true -}} -{{- (dict "r" (concat (default (list ) $flags) (default (list ) $values.statefulset.additionalRedpandaCmdFlags))) | toJson -}} +{{- (dict "r" (list $lockMemory $overprovisioned $rendered)) | toJson -}} {{- break -}} {{- end -}} {{- end -}} diff --git a/charts/redpanda/templates/_helpers.go.tpl b/charts/redpanda/templates/_helpers.go.tpl index 3d83d1287..d14ea79bb 100644 --- a/charts/redpanda/templates/_helpers.go.tpl +++ b/charts/redpanda/templates/_helpers.go.tpl @@ -464,23 +464,6 @@ {{- end -}} {{- end -}} -{{- define "redpanda.RedpandaSMP" -}} -{{- $dot := (index .a 0) -}} -{{- range $_ := (list 1) -}} -{{- $_is_returning := false -}} -{{- $values := $dot.Values.AsMap -}} -{{- $coresInMillies := ((get (fromJson (include "_shims.resource_MilliValue" (dict "a" (list $values.resources.cpu.cores) ))) "r") | int64) -}} -{{- if (lt $coresInMillies (1000 | int64)) -}} -{{- $_is_returning = true -}} -{{- (dict "r" (1 | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- $_is_returning = true -}} -{{- (dict "r" ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $values.resources.cpu.cores) ))) "r") | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- end -}} - {{- define "redpanda.coalesce" -}} {{- $values := (index .a 0) -}} {{- range $_ := (list 1) -}} @@ -542,9 +525,9 @@ {{- $originalKeys := (dict ) -}} {{- $overrideByKey := (dict ) -}} {{- range $_, $el := $override -}} -{{- $_526_key_ok := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} -{{- $key := (index $_526_key_ok 0) -}} -{{- $ok := (index $_526_key_ok 1) -}} +{{- $_514_key_ok := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} +{{- $key := (index $_514_key_ok 0) -}} +{{- $ok := (index $_514_key_ok 1) -}} {{- if (not $ok) -}} {{- continue -}} {{- end -}} @@ -555,13 +538,13 @@ {{- end -}} {{- $merged := (coalesce nil) -}} {{- range $_, $el := $original -}} -{{- $_538_key__ := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} -{{- $key := (index $_538_key__ 0) -}} -{{- $_ := (index $_538_key__ 1) -}} +{{- $_526_key__ := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} +{{- $key := (index $_526_key__ 0) -}} +{{- $_ := (index $_526_key__ 1) -}} {{- $_ := (set $originalKeys $key true) -}} -{{- $_540_elOverride_7_ok_8 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $overrideByKey $key (coalesce nil)) ))) "r") -}} -{{- $elOverride_7 := (index $_540_elOverride_7_ok_8 0) -}} -{{- $ok_8 := (index $_540_elOverride_7_ok_8 1) -}} +{{- $_528_elOverride_7_ok_8 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $overrideByKey $key (coalesce nil)) ))) "r") -}} +{{- $elOverride_7 := (index $_528_elOverride_7_ok_8 0) -}} +{{- $ok_8 := (index $_528_elOverride_7_ok_8 1) -}} {{- if $ok_8 -}} {{- $merged = (concat (default (list ) $merged) (list (get (fromJson (include $mergeFunc (dict "a" (list $el $elOverride_7) ))) "r"))) -}} {{- else -}} @@ -572,15 +555,15 @@ {{- break -}} {{- end -}} {{- range $_, $el := $override -}} -{{- $_550_key_ok := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} -{{- $key := (index $_550_key_ok 0) -}} -{{- $ok := (index $_550_key_ok 1) -}} +{{- $_538_key_ok := (get (fromJson (include "_shims.get" (dict "a" (list $el $mergeKey) ))) "r") -}} +{{- $key := (index $_538_key_ok 0) -}} +{{- $ok := (index $_538_key_ok 1) -}} {{- if (not $ok) -}} {{- continue -}} {{- end -}} -{{- $_555___ok_9 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $originalKeys $key false) ))) "r") -}} -{{- $_ := (index $_555___ok_9 0) -}} -{{- $ok_9 := (index $_555___ok_9 1) -}} +{{- $_543___ok_9 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $originalKeys $key false) ))) "r") -}} +{{- $_ := (index $_543___ok_9 0) -}} +{{- $ok_9 := (index $_543___ok_9 1) -}} {{- if $ok_9 -}} {{- continue -}} {{- end -}} @@ -642,3 +625,39 @@ {{- end -}} {{- end -}} +{{- define "redpanda.ParseCLIArgs" -}} +{{- $args := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- $parsed := (dict ) -}} +{{- $i := -1 -}} +{{- range $_, $_ := $args -}} +{{- $i = ((add $i (1 | int)) | int) -}} +{{- if (ge $i ((get (fromJson (include "_shims.len" (dict "a" (list $args) ))) "r") | int)) -}} +{{- break -}} +{{- end -}} +{{- if (not (hasPrefix "-" (index $args $i))) -}} +{{- continue -}} +{{- end -}} +{{- $flag := (index $args $i) -}} +{{- $spl := (mustRegexSplit " |=" $flag (2 | int)) -}} +{{- if (eq ((get (fromJson (include "_shims.len" (dict "a" (list $spl) ))) "r") | int) (2 | int)) -}} +{{- $_ := (set $parsed (index $spl (0 | int)) (index $spl (1 | int))) -}} +{{- continue -}} +{{- end -}} +{{- if (and (lt ((add $i (1 | int)) | int) ((get (fromJson (include "_shims.len" (dict "a" (list $args) ))) "r") | int)) (not (hasPrefix "-" (index $args ((add $i (1 | int)) | int))))) -}} +{{- $_ := (set $parsed $flag (index $args ((add $i (1 | int)) | int))) -}} +{{- $i = ((add $i (1 | int)) | int) -}} +{{- continue -}} +{{- end -}} +{{- $_ := (set $parsed $flag "") -}} +{{- end -}} +{{- if $_is_returning -}} +{{- break -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" $parsed) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + diff --git a/charts/redpanda/templates/_memory.go.tpl b/charts/redpanda/templates/_memory.go.tpl deleted file mode 100644 index 015a771b4..000000000 --- a/charts/redpanda/templates/_memory.go.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{{- /* Generated from "memory.go" */ -}} - -{{- define "redpanda.RedpandaReserveMemory" -}} -{{- $dot := (index .a 0) -}} -{{- range $_ := (list 1) -}} -{{- $_is_returning := false -}} -{{- $values := $dot.Values.AsMap -}} -{{- $rpMem_1 := $values.resources.memory.redpanda -}} -{{- if (and (ne (toJson $rpMem_1) "null") (ne (toJson $rpMem_1.reserveMemory) "null")) -}} -{{- $_is_returning = true -}} -{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rpMem_1.reserveMemory) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- $_is_returning = true -}} -{{- (dict "r" ((add (((mulf (((get (fromJson (include "redpanda.ContainerMemory" (dict "a" (list $dot) ))) "r") | int64) | float64) 0.002) | float64) | int64) (200 | int64)) | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- end -}} - -{{- define "redpanda.RedpandaMemory" -}} -{{- $dot := (index .a 0) -}} -{{- range $_ := (list 1) -}} -{{- $_is_returning := false -}} -{{- $values := $dot.Values.AsMap -}} -{{- $memory := ((0 | int64) | int64) -}} -{{- $containerMemory := ((get (fromJson (include "redpanda.ContainerMemory" (dict "a" (list $dot) ))) "r") | int64) -}} -{{- $rpMem_2 := $values.resources.memory.redpanda -}} -{{- if (and (ne (toJson $rpMem_2) "null") (ne (toJson $rpMem_2.memory) "null")) -}} -{{- $memory = ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rpMem_2.memory) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64) -}} -{{- else -}} -{{- $memory = (((mulf ($containerMemory | float64) 0.8) | float64) | int64) -}} -{{- end -}} -{{- if (eq $memory (0 | int64)) -}} -{{- $_ := (fail "unable to get memory value redpanda-memory") -}} -{{- end -}} -{{- if (lt $memory (256 | int64)) -}} -{{- $_ := (fail (printf "%d is below the minimum value for Redpanda" $memory)) -}} -{{- end -}} -{{- if (gt ((add $memory ((get (fromJson (include "redpanda.RedpandaReserveMemory" (dict "a" (list $dot) ))) "r") | int64)) | int64) $containerMemory) -}} -{{- $_ := (fail (printf "Not enough container memory for Redpanda memory values where Redpanda: %d, reserve: %d, container: %d" $memory ((get (fromJson (include "redpanda.RedpandaReserveMemory" (dict "a" (list $dot) ))) "r") | int64) $containerMemory)) -}} -{{- end -}} -{{- $_is_returning = true -}} -{{- (dict "r" $memory) | toJson -}} -{{- break -}} -{{- end -}} -{{- end -}} - -{{- define "redpanda.ContainerMemory" -}} -{{- $dot := (index .a 0) -}} -{{- range $_ := (list 1) -}} -{{- $_is_returning := false -}} -{{- $values := $dot.Values.AsMap -}} -{{- if (ne (toJson $values.resources.memory.container.min) "null") -}} -{{- $_is_returning = true -}} -{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $values.resources.memory.container.min) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- $_is_returning = true -}} -{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $values.resources.memory.container.max) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} -{{- break -}} -{{- end -}} -{{- end -}} - diff --git a/charts/redpanda/templates/_statefulset.go.tpl b/charts/redpanda/templates/_statefulset.go.tpl index 1eda80b1e..d7649a101 100644 --- a/charts/redpanda/templates/_statefulset.go.tpl +++ b/charts/redpanda/templates/_statefulset.go.tpl @@ -395,7 +395,7 @@ {{- $_is_returning := false -}} {{- $values := $dot.Values.AsMap -}} {{- $internalAdvertiseAddress := (printf "%s.%s" "$(SERVICE_NAME)" (get (fromJson (include "redpanda.InternalDomain" (dict "a" (list $dot) ))) "r")) -}} -{{- $container := (mustMergeOverwrite (dict "name" "" "resources" (dict ) ) (dict "name" (get (fromJson (include "redpanda.Name" (dict "a" (list $dot) ))) "r") "image" (printf `%s:%s` $values.image.repository (get (fromJson (include "redpanda.Tag" (dict "a" (list $dot) ))) "r")) "env" (get (fromJson (include "redpanda.bootstrapEnvVars" (dict "a" (list $dot (get (fromJson (include "redpanda.statefulSetRedpandaEnv" (dict "a" (list ) ))) "r")) ))) "r") "lifecycle" (mustMergeOverwrite (dict ) (dict "postStart" (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (get (fromJson (include "redpanda.wrapLifecycleHook" (dict "a" (list "post-start" ((div ($values.statefulset.terminationGracePeriodSeconds | int64) (2 | int64)) | int64) (list "bash" "-x" "/var/lifecycle/postStart.sh")) ))) "r") )) )) "preStop" (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (get (fromJson (include "redpanda.wrapLifecycleHook" (dict "a" (list "pre-stop" ((div ($values.statefulset.terminationGracePeriodSeconds | int64) (2 | int64)) | int64) (list "bash" "-x" "/var/lifecycle/preStop.sh")) ))) "r") )) )) )) "startupProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (list `/bin/sh` `-c` (join "\n" (list `set -e` (printf `RESULT=$(curl --silent --fail -k -m 5 %s "%s://%s/v1/status/ready")` (get (fromJson (include "redpanda.adminTLSCurlFlags" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminInternalHTTPProtocol" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminApiURLs" (dict "a" (list $dot) ))) "r")) `echo $RESULT` `echo $RESULT | grep ready` ``))) )) )) (dict "initialDelaySeconds" ($values.statefulset.startupProbe.initialDelaySeconds | int) "periodSeconds" ($values.statefulset.startupProbe.periodSeconds | int) "failureThreshold" ($values.statefulset.startupProbe.failureThreshold | int) )) "livenessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (list `/bin/sh` `-c` (printf `curl --silent --fail -k -m 5 %s "%s://%s/v1/status/ready"` (get (fromJson (include "redpanda.adminTLSCurlFlags" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminInternalHTTPProtocol" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminApiURLs" (dict "a" (list $dot) ))) "r"))) )) )) (dict "initialDelaySeconds" ($values.statefulset.livenessProbe.initialDelaySeconds | int) "periodSeconds" ($values.statefulset.livenessProbe.periodSeconds | int) "failureThreshold" ($values.statefulset.livenessProbe.failureThreshold | int) )) "command" (list `rpk` `redpanda` `start` (printf `--advertise-rpc-addr=%s:%d` $internalAdvertiseAddress ($values.listeners.rpc.port | int))) "volumeMounts" (concat (default (list ) (get (fromJson (include "redpanda.StatefulSetVolumeMounts" (dict "a" (list $dot) ))) "r")) (default (list ) (get (fromJson (include "redpanda.templateToVolumeMounts" (dict "a" (list $dot $values.statefulset.extraVolumeMounts) ))) "r"))) "securityContext" (get (fromJson (include "redpanda.ContainerSecurityContext" (dict "a" (list $dot) ))) "r") "resources" (mustMergeOverwrite (dict ) (dict )) )) -}} +{{- $container := (mustMergeOverwrite (dict "name" "" "resources" (dict ) ) (dict "name" (get (fromJson (include "redpanda.Name" (dict "a" (list $dot) ))) "r") "image" (printf `%s:%s` $values.image.repository (get (fromJson (include "redpanda.Tag" (dict "a" (list $dot) ))) "r")) "env" (get (fromJson (include "redpanda.bootstrapEnvVars" (dict "a" (list $dot (get (fromJson (include "redpanda.statefulSetRedpandaEnv" (dict "a" (list ) ))) "r")) ))) "r") "lifecycle" (mustMergeOverwrite (dict ) (dict "postStart" (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (get (fromJson (include "redpanda.wrapLifecycleHook" (dict "a" (list "post-start" ((div ($values.statefulset.terminationGracePeriodSeconds | int64) (2 | int64)) | int64) (list "bash" "-x" "/var/lifecycle/postStart.sh")) ))) "r") )) )) "preStop" (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (get (fromJson (include "redpanda.wrapLifecycleHook" (dict "a" (list "pre-stop" ((div ($values.statefulset.terminationGracePeriodSeconds | int64) (2 | int64)) | int64) (list "bash" "-x" "/var/lifecycle/preStop.sh")) ))) "r") )) )) )) "startupProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (list `/bin/sh` `-c` (join "\n" (list `set -e` (printf `RESULT=$(curl --silent --fail -k -m 5 %s "%s://%s/v1/status/ready")` (get (fromJson (include "redpanda.adminTLSCurlFlags" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminInternalHTTPProtocol" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminApiURLs" (dict "a" (list $dot) ))) "r")) `echo $RESULT` `echo $RESULT | grep ready` ``))) )) )) (dict "initialDelaySeconds" ($values.statefulset.startupProbe.initialDelaySeconds | int) "periodSeconds" ($values.statefulset.startupProbe.periodSeconds | int) "failureThreshold" ($values.statefulset.startupProbe.failureThreshold | int) )) "livenessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (list `/bin/sh` `-c` (printf `curl --silent --fail -k -m 5 %s "%s://%s/v1/status/ready"` (get (fromJson (include "redpanda.adminTLSCurlFlags" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminInternalHTTPProtocol" (dict "a" (list $dot) ))) "r") (get (fromJson (include "redpanda.adminApiURLs" (dict "a" (list $dot) ))) "r"))) )) )) (dict "initialDelaySeconds" ($values.statefulset.livenessProbe.initialDelaySeconds | int) "periodSeconds" ($values.statefulset.livenessProbe.periodSeconds | int) "failureThreshold" ($values.statefulset.livenessProbe.failureThreshold | int) )) "command" (list `rpk` `redpanda` `start` (printf `--advertise-rpc-addr=%s:%d` $internalAdvertiseAddress ($values.listeners.rpc.port | int))) "volumeMounts" (concat (default (list ) (get (fromJson (include "redpanda.StatefulSetVolumeMounts" (dict "a" (list $dot) ))) "r")) (default (list ) (get (fromJson (include "redpanda.templateToVolumeMounts" (dict "a" (list $dot $values.statefulset.extraVolumeMounts) ))) "r"))) "securityContext" (get (fromJson (include "redpanda.ContainerSecurityContext" (dict "a" (list $dot) ))) "r") "resources" (get (fromJson (include "redpanda.RedpandaResources.GetResourceRequirements" (dict "a" (list $values.resources) ))) "r") )) -}} {{- if (not (get (fromJson (include "_shims.typeassertion" (dict "a" (list "bool" (dig `recovery_mode_enabled` false $values.config.node)) ))) "r")) -}} {{- $_ := (set $container "readinessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "exec" (mustMergeOverwrite (dict ) (dict "command" (list `/bin/sh` `-c` (join "\n" (list `set -x` `RESULT=$(rpk cluster health)` `echo $RESULT` `echo $RESULT | grep 'Healthy:.*true'` ``))) )) )) (dict "initialDelaySeconds" ($values.statefulset.readinessProbe.initialDelaySeconds | int) "timeoutSeconds" ($values.statefulset.readinessProbe.timeoutSeconds | int) "periodSeconds" ($values.statefulset.readinessProbe.periodSeconds | int) "successThreshold" ($values.statefulset.readinessProbe.successThreshold | int) "failureThreshold" ($values.statefulset.readinessProbe.failureThreshold | int) ))) -}} {{- end -}} @@ -443,10 +443,6 @@ {{- end -}} {{- $_ := (set $container "volumeMounts" (concat (default (list ) $container.volumeMounts) (list (mustMergeOverwrite (dict "name" "" "mountPath" "" ) (dict "name" $name "mountPath" (get (fromJson (include "redpanda.Storage.TieredCacheDirectory" (dict "a" (list $values.storage $dot) ))) "r") ))))) -}} {{- end -}} -{{- $_ := (set $container.resources "limits" (dict "cpu" $values.resources.cpu.cores "memory" $values.resources.memory.container.max )) -}} -{{- if (ne (toJson $values.resources.memory.container.min) "null") -}} -{{- $_ := (set $container.resources "requests" (dict "cpu" $values.resources.cpu.cores "memory" $values.resources.memory.container.min )) -}} -{{- end -}} {{- $_is_returning = true -}} {{- (dict "r" $container) | toJson -}} {{- break -}} diff --git a/charts/redpanda/templates/_values.go.tpl b/charts/redpanda/templates/_values.go.tpl index 0a7e0f67e..0cb5a093a 100644 --- a/charts/redpanda/templates/_values.go.tpl +++ b/charts/redpanda/templates/_values.go.tpl @@ -102,10 +102,72 @@ {{- end -}} {{- end -}} +{{- define "redpanda.RedpandaResources.GetResourceRequirements" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- if (and (ne (toJson $rr.limits) "null") (ne (toJson $rr.requests) "null")) -}} +{{- $_is_returning = true -}} +{{- (dict "r" (mustMergeOverwrite (dict ) (dict "limits" $rr.limits "requests" $rr.requests ))) | toJson -}} +{{- break -}} +{{- end -}} +{{- $reqs := (mustMergeOverwrite (dict ) (dict "limits" (dict "cpu" $rr.cpu.cores "memory" $rr.memory.container.max ) )) -}} +{{- if (ne (toJson $rr.memory.container.min) "null") -}} +{{- $_ := (set $reqs "requests" (dict "cpu" $rr.cpu.cores "memory" $rr.memory.container.min )) -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" $reqs) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + +{{- define "redpanda.RedpandaResources.GetRedpandaFlags" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- $flags := (dict "reserve-memory" (printf "%dM" ((get (fromJson (include "redpanda.RedpandaResources.reserveMemory" (dict "a" (list $rr) ))) "r") | int64)) ) -}} +{{- $smp_2 := (get (fromJson (include "redpanda.RedpandaResources.smp" (dict "a" (list $rr) ))) "r") -}} +{{- if (ne (toJson $smp_2) "null") -}} +{{- $_ := (set $flags "smp" (printf "%d" ($smp_2 | int64))) -}} +{{- end -}} +{{- $memory_3 := (get (fromJson (include "redpanda.RedpandaResources.memory" (dict "a" (list $rr) ))) "r") -}} +{{- if (ne (toJson $memory_3) "null") -}} +{{- $_ := (set $flags "memory" (printf "%dM" ($memory_3 | int64))) -}} +{{- end -}} +{{- if (and (eq (toJson $rr.limits) "null") (eq (toJson $rr.requests) "null")) -}} +{{- $_ := (set $flags "lock-memory" (printf "%v" (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $rr.memory.enable_memory_locking false) ))) "r"))) -}} +{{- end -}} +{{- if (get (fromJson (include "redpanda.RedpandaResources.GetOverProvisionValue" (dict "a" (list $rr) ))) "r") -}} +{{- $_ := (set $flags "overprovisioned" "") -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" $flags) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + {{- define "redpanda.RedpandaResources.GetOverProvisionValue" -}} {{- $rr := (index .a 0) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} +{{- if (and (ne (toJson $rr.limits) "null") (ne (toJson $rr.requests) "null")) -}} +{{- $_449_cpuReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.requests) "cpu" "0") ))) "r") -}} +{{- $cpuReq := (index $_449_cpuReq_ok 0) -}} +{{- $ok := (index $_449_cpuReq_ok 1) -}} +{{- if (not $ok) -}} +{{- $_451_cpuReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.limits) "cpu" "0") ))) "r") -}} +{{- $cpuReq = (index $_451_cpuReq_ok 0) -}} +{{- $ok = (index $_451_cpuReq_ok 1) -}} +{{- end -}} +{{- if (and $ok (lt ((get (fromJson (include "_shims.resource_MilliValue" (dict "a" (list $cpuReq) ))) "r") | int64) (1000 | int64))) -}} +{{- $_is_returning = true -}} +{{- (dict "r" true) | toJson -}} +{{- break -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" false) | toJson -}} +{{- break -}} +{{- end -}} {{- if (lt ((get (fromJson (include "_shims.resource_MilliValue" (dict "a" (list $rr.cpu.cores) ))) "r") | int64) (1000 | int64)) -}} {{- $_is_returning = true -}} {{- (dict "r" true) | toJson -}} @@ -117,14 +179,134 @@ {{- end -}} {{- end -}} +{{- define "redpanda.RedpandaResources.smp" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- if (and (ne (toJson $rr.limits) "null") (ne (toJson $rr.requests) "null")) -}} +{{- $_475_cpuReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.requests) "cpu" "0") ))) "r") -}} +{{- $cpuReq := (index $_475_cpuReq_ok 0) -}} +{{- $ok := (index $_475_cpuReq_ok 1) -}} +{{- if (not $ok) -}} +{{- $_477_cpuReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.limits) "cpu" "0") ))) "r") -}} +{{- $cpuReq = (index $_477_cpuReq_ok 0) -}} +{{- $ok = (index $_477_cpuReq_ok 1) -}} +{{- end -}} +{{- if (not $ok) -}} +{{- $_is_returning = true -}} +{{- (dict "r" (coalesce nil)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $smp := ((div ((get (fromJson (include "_shims.resource_MilliValue" (dict "a" (list $cpuReq) ))) "r") | int64) (1000 | int64)) | int64) -}} +{{- if (lt $smp (1 | int64)) -}} +{{- $smp = (1 | int64) -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" $smp) | toJson -}} +{{- break -}} +{{- end -}} +{{- $coresInMillies_4 := ((get (fromJson (include "_shims.resource_MilliValue" (dict "a" (list $rr.cpu.cores) ))) "r") | int64) -}} +{{- if (lt $coresInMillies_4 (1000 | int64)) -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((1 | int64) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" (((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rr.cpu.cores) ))) "r") | int64) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + +{{- define "redpanda.RedpandaResources.memory" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- if (and (ne (toJson $rr.limits) "null") (ne (toJson $rr.requests) "null")) -}} +{{- $_534_memReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.requests) "memory" "0") ))) "r") -}} +{{- $memReq := (index $_534_memReq_ok 0) -}} +{{- $ok := (index $_534_memReq_ok 1) -}} +{{- if (not $ok) -}} +{{- $_536_memReq_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list ($rr.limits) "memory" "0") ))) "r") -}} +{{- $memReq = (index $_536_memReq_ok 0) -}} +{{- $ok = (index $_536_memReq_ok 1) -}} +{{- end -}} +{{- if (not $ok) -}} +{{- $_is_returning = true -}} +{{- (dict "r" (coalesce nil)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $memory := (((mulf (((get (fromJson (include "_shims.resource_Value" (dict "a" (list $memReq) ))) "r") | int64) | float64) 0.90) | float64) | int64) -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((div $memory ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $memory := ((0 | int64) | int64) -}} +{{- $containerMemory := ((get (fromJson (include "redpanda.RedpandaResources.containerMemory" (dict "a" (list $rr) ))) "r") | int64) -}} +{{- $rpMem_5 := $rr.memory.redpanda -}} +{{- if (and (ne (toJson $rpMem_5) "null") (ne (toJson $rpMem_5.memory) "null")) -}} +{{- $memory = ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rpMem_5.memory) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64) -}} +{{- else -}} +{{- $memory = (((mulf ($containerMemory | float64) 0.8) | float64) | int64) -}} +{{- end -}} +{{- if (eq $memory (0 | int64)) -}} +{{- $_ := (fail "unable to get memory value redpanda-memory") -}} +{{- end -}} +{{- if (lt $memory (256 | int64)) -}} +{{- $_ := (fail (printf "%d is below the minimum value for Redpanda" $memory)) -}} +{{- end -}} +{{- if (gt ((add $memory (((get (fromJson (include "redpanda.RedpandaResources.reserveMemory" (dict "a" (list $rr) ))) "r") | int64) | int64)) | int64) $containerMemory) -}} +{{- $_ := (fail (printf "Not enough container memory for Redpanda memory values where Redpanda: %d, reserve: %d, container: %d" $memory ((get (fromJson (include "redpanda.RedpandaResources.reserveMemory" (dict "a" (list $rr) ))) "r") | int64) $containerMemory)) -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" $memory) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + +{{- define "redpanda.RedpandaResources.reserveMemory" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- if (and (ne (toJson $rr.limits) "null") (ne (toJson $rr.requests) "null")) -}} +{{- $_is_returning = true -}} +{{- (dict "r" (0 | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $rpMem_6 := $rr.memory.redpanda -}} +{{- if (and (ne (toJson $rpMem_6) "null") (ne (toJson $rpMem_6.reserveMemory) "null")) -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rpMem_6.reserveMemory) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((add (((mulf (((get (fromJson (include "redpanda.RedpandaResources.containerMemory" (dict "a" (list $rr) ))) "r") | int64) | float64) 0.002) | float64) | int64) (200 | int64)) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + +{{- define "redpanda.RedpandaResources.containerMemory" -}} +{{- $rr := (index .a 0) -}} +{{- range $_ := (list 1) -}} +{{- $_is_returning := false -}} +{{- if (ne (toJson $rr.memory.container.min) "null") -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rr.memory.container.min) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- $_is_returning = true -}} +{{- (dict "r" ((div ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $rr.memory.container.max) ))) "r") | int64) ((mul (1024 | int) (1024 | int)))) | int64)) | toJson -}} +{{- break -}} +{{- end -}} +{{- end -}} + {{- define "redpanda.Storage.IsTieredStorageEnabled" -}} {{- $s := (index .a 0) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} {{- $conf := (get (fromJson (include "redpanda.Storage.GetTieredStorageConfig" (dict "a" (list $s) ))) "r") -}} -{{- $_406_b_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $conf "cloud_storage_enabled" (coalesce nil)) ))) "r") -}} -{{- $b := (index $_406_b_ok 0) -}} -{{- $ok := (index $_406_b_ok 1) -}} +{{- $_654_b_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $conf "cloud_storage_enabled" (coalesce nil)) ))) "r") -}} +{{- $b := (index $_654_b_ok 0) -}} +{{- $ok := (index $_654_b_ok 1) -}} {{- $_is_returning = true -}} {{- (dict "r" (and $ok (get (fromJson (include "_shims.typeassertion" (dict "a" (list "bool" $b) ))) "r"))) | toJson -}} {{- break -}} @@ -169,21 +351,21 @@ {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} {{- $values := $dot.Values.AsMap -}} -{{- $_435_dir_2_ok_3 := (get (fromJson (include "_shims.typetest" (dict "a" (list "string" (index $values.config.node "cloud_storage_cache_directory") "") ))) "r") -}} -{{- $dir_2 := (index $_435_dir_2_ok_3 0) -}} -{{- $ok_3 := (index $_435_dir_2_ok_3 1) -}} -{{- if $ok_3 -}} +{{- $_683_dir_7_ok_8 := (get (fromJson (include "_shims.typetest" (dict "a" (list "string" (index $values.config.node "cloud_storage_cache_directory") "") ))) "r") -}} +{{- $dir_7 := (index $_683_dir_7_ok_8 0) -}} +{{- $ok_8 := (index $_683_dir_7_ok_8 1) -}} +{{- if $ok_8 -}} {{- $_is_returning = true -}} -{{- (dict "r" $dir_2) | toJson -}} +{{- (dict "r" $dir_7) | toJson -}} {{- break -}} {{- end -}} {{- $tieredConfig := (get (fromJson (include "redpanda.Storage.GetTieredStorageConfig" (dict "a" (list $values.storage) ))) "r") -}} -{{- $_444_dir_4_ok_5 := (get (fromJson (include "_shims.typetest" (dict "a" (list "string" (index $tieredConfig "cloud_storage_cache_directory") "") ))) "r") -}} -{{- $dir_4 := (index $_444_dir_4_ok_5 0) -}} -{{- $ok_5 := (index $_444_dir_4_ok_5 1) -}} -{{- if $ok_5 -}} +{{- $_692_dir_9_ok_10 := (get (fromJson (include "_shims.typetest" (dict "a" (list "string" (index $tieredConfig "cloud_storage_cache_directory") "") ))) "r") -}} +{{- $dir_9 := (index $_692_dir_9_ok_10 0) -}} +{{- $ok_10 := (index $_692_dir_9_ok_10 1) -}} +{{- if $ok_10 -}} {{- $_is_returning = true -}} -{{- (dict "r" $dir_4) | toJson -}} +{{- (dict "r" $dir_9) | toJson -}} {{- break -}} {{- end -}} {{- $_is_returning = true -}} @@ -280,9 +462,9 @@ {{- $result := (dict ) -}} {{- $s := (toJson $t) -}} {{- $tune := (fromJson $s) -}} -{{- $_670_m_ok := (get (fromJson (include "_shims.typetest" (dict "a" (list (printf "map[%s]%s" "string" "interface {}") $tune (coalesce nil)) ))) "r") -}} -{{- $m := (index $_670_m_ok 0) -}} -{{- $ok := (index $_670_m_ok 1) -}} +{{- $_918_m_ok := (get (fromJson (include "_shims.typetest" (dict "a" (list (printf "map[%s]%s" "string" "interface {}") $tune (coalesce nil)) ))) "r") -}} +{{- $m := (index $_918_m_ok 0) -}} +{{- $ok := (index $_918_m_ok 1) -}} {{- if (not $ok) -}} {{- $_is_returning = true -}} {{- (dict "r" (dict )) | toJson -}} @@ -418,10 +600,10 @@ {{- $seen := (dict ) -}} {{- $deduped := (coalesce nil) -}} {{- range $_, $item := $items -}} -{{- $_787___ok_6 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $seen $item.key false) ))) "r") -}} -{{- $_ := (index $_787___ok_6 0) -}} -{{- $ok_6 := (index $_787___ok_6 1) -}} -{{- if $ok_6 -}} +{{- $_1035___ok_11 := (get (fromJson (include "_shims.dicttest" (dict "a" (list $seen $item.key false) ))) "r") -}} +{{- $_ := (index $_1035___ok_11 0) -}} +{{- $ok_11 := (index $_1035___ok_11 1) -}} +{{- if $ok_11 -}} {{- continue -}} {{- end -}} {{- $deduped = (concat (default (list ) $deduped) (list $item)) -}} @@ -473,9 +655,9 @@ {{- $name := (index .a 1) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} -{{- $_878_cert_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $m $name (dict "enabled" (coalesce nil) "caEnabled" false "applyInternalDNSNames" (coalesce nil) "duration" "" "issuerRef" (coalesce nil) "secretRef" (coalesce nil) "clientSecretRef" (coalesce nil) )) ))) "r") -}} -{{- $cert := (index $_878_cert_ok 0) -}} -{{- $ok := (index $_878_cert_ok 1) -}} +{{- $_1126_cert_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $m $name (dict "enabled" (coalesce nil) "caEnabled" false "applyInternalDNSNames" (coalesce nil) "duration" "" "issuerRef" (coalesce nil) "secretRef" (coalesce nil) "clientSecretRef" (coalesce nil) )) ))) "r") -}} +{{- $cert := (index $_1126_cert_ok 0) -}} +{{- $ok := (index $_1126_cert_ok 1) -}} {{- if (not $ok) -}} {{- $_ := (fail (printf "Certificate %q referenced, but not found in the tls.certs map" $name)) -}} {{- end -}} @@ -823,9 +1005,9 @@ {{- if $saslEnabled -}} {{- $_ := (set $internal "authentication_method" "http_basic") -}} {{- end -}} -{{- $am_7 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_7 "") -}} -{{- $_ := (set $internal "authentication_method" $am_7) -}} +{{- $am_12 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_12 "") -}} +{{- $_ := (set $internal "authentication_method" $am_12) -}} {{- end -}} {{- $result := (list $internal) -}} {{- range $k, $l := $l.external -}} @@ -836,9 +1018,9 @@ {{- if $saslEnabled -}} {{- $_ := (set $listener "authentication_method" "http_basic") -}} {{- end -}} -{{- $am_8 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_8 "") -}} -{{- $_ := (set $listener "authentication_method" $am_8) -}} +{{- $am_13 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_13 "") -}} +{{- $_ := (set $listener "authentication_method" $am_13) -}} {{- end -}} {{- $result = (concat (default (list ) $result) (list $listener)) -}} {{- end -}} @@ -921,9 +1103,9 @@ {{- if (get (fromJson (include "redpanda.Auth.IsSASLEnabled" (dict "a" (list $auth) ))) "r") -}} {{- $_ := (set $internal "authentication_method" "sasl") -}} {{- end -}} -{{- $am_9 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_9 "") -}} -{{- $_ := (set $internal "authentication_method" $am_9) -}} +{{- $am_14 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_14 "") -}} +{{- $_ := (set $internal "authentication_method" $am_14) -}} {{- end -}} {{- $kafka := (list $internal) -}} {{- range $k, $l := $l.external -}} @@ -934,9 +1116,9 @@ {{- if (get (fromJson (include "redpanda.Auth.IsSASLEnabled" (dict "a" (list $auth) ))) "r") -}} {{- $_ := (set $listener "authentication_method" "sasl") -}} {{- end -}} -{{- $am_10 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_10 "") -}} -{{- $_ := (set $listener "authentication_method" $am_10) -}} +{{- $am_15 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_15 "") -}} +{{- $_ := (set $listener "authentication_method" $am_15) -}} {{- end -}} {{- $kafka = (concat (default (list ) $kafka) (list $listener)) -}} {{- end -}} @@ -1068,9 +1250,9 @@ {{- if $saslEnabled -}} {{- $_ := (set $internal "authentication_method" "http_basic") -}} {{- end -}} -{{- $am_11 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_11 "") -}} -{{- $_ := (set $internal "authentication_method" $am_11) -}} +{{- $am_16 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_16 "") -}} +{{- $_ := (set $internal "authentication_method" $am_16) -}} {{- end -}} {{- $result := (list $internal) -}} {{- range $k, $l := $l.external -}} @@ -1081,9 +1263,9 @@ {{- if $saslEnabled -}} {{- $_ := (set $listener "authentication_method" "http_basic") -}} {{- end -}} -{{- $am_12 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} -{{- if (ne $am_12 "") -}} -{{- $_ := (set $listener "authentication_method" $am_12) -}} +{{- $am_17 := (get (fromJson (include "_shims.ptr_Deref" (dict "a" (list $l.authenticationMethod "") ))) "r") -}} +{{- if (ne $am_17 "") -}} +{{- $_ := (set $listener "authentication_method" $am_17) -}} {{- end -}} {{- $result = (concat (default (list ) $result) (list $listener)) -}} {{- end -}} @@ -1218,10 +1400,10 @@ {{- $result := (dict ) -}} {{- range $k, $v := $c -}} {{- if (not (empty $v)) -}} -{{- $_1712___ok_13 := (get (fromJson (include "_shims.asnumeric" (dict "a" (list $v) ))) "r") -}} -{{- $_ := ((index $_1712___ok_13 0) | float64) -}} -{{- $ok_13 := (index $_1712___ok_13 1) -}} -{{- if $ok_13 -}} +{{- $_1960___ok_18 := (get (fromJson (include "_shims.asnumeric" (dict "a" (list $v) ))) "r") -}} +{{- $_ := ((index $_1960___ok_18 0) | float64) -}} +{{- $ok_18 := (index $_1960___ok_18 1) -}} +{{- if $ok_18 -}} {{- $_ := (set $result $k $v) -}} {{- else -}}{{- if (kindIs "bool" $v) -}} {{- $_ := (set $result $k $v) -}} @@ -1246,11 +1428,11 @@ {{- $_is_returning := false -}} {{- $result := (dict ) -}} {{- range $k, $v := $c -}} -{{- $_1732_b_14_ok_15 := (get (fromJson (include "_shims.typetest" (dict "a" (list "bool" $v false) ))) "r") -}} -{{- $b_14 := (index $_1732_b_14_ok_15 0) -}} -{{- $ok_15 := (index $_1732_b_14_ok_15 1) -}} -{{- if $ok_15 -}} -{{- $_ := (set $result $k $b_14) -}} +{{- $_1980_b_19_ok_20 := (get (fromJson (include "_shims.typetest" (dict "a" (list "bool" $v false) ))) "r") -}} +{{- $b_19 := (index $_1980_b_19_ok_20 0) -}} +{{- $ok_20 := (index $_1980_b_19_ok_20 1) -}} +{{- if $ok_20 -}} +{{- $_ := (set $result $k $b_19) -}} {{- continue -}} {{- end -}} {{- if (not (empty $v)) -}} @@ -1291,15 +1473,15 @@ {{- $config := (index .a 1) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} -{{- $_1777___hasAccessKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_access_key" (coalesce nil)) ))) "r") -}} -{{- $_ := (index $_1777___hasAccessKey 0) -}} -{{- $hasAccessKey := (index $_1777___hasAccessKey 1) -}} -{{- $_1778___hasSecretKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_secret_key" (coalesce nil)) ))) "r") -}} -{{- $_ := (index $_1778___hasSecretKey 0) -}} -{{- $hasSecretKey := (index $_1778___hasSecretKey 1) -}} -{{- $_1779___hasSharedKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_azure_shared_key" (coalesce nil)) ))) "r") -}} -{{- $_ := (index $_1779___hasSharedKey 0) -}} -{{- $hasSharedKey := (index $_1779___hasSharedKey 1) -}} +{{- $_2025___hasAccessKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_access_key" (coalesce nil)) ))) "r") -}} +{{- $_ := (index $_2025___hasAccessKey 0) -}} +{{- $hasAccessKey := (index $_2025___hasAccessKey 1) -}} +{{- $_2026___hasSecretKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_secret_key" (coalesce nil)) ))) "r") -}} +{{- $_ := (index $_2026___hasSecretKey 0) -}} +{{- $hasSecretKey := (index $_2026___hasSecretKey 1) -}} +{{- $_2027___hasSharedKey := (get (fromJson (include "_shims.dicttest" (dict "a" (list $config "cloud_storage_azure_shared_key" (coalesce nil)) ))) "r") -}} +{{- $_ := (index $_2027___hasSharedKey 0) -}} +{{- $hasSharedKey := (index $_2027___hasSharedKey 1) -}} {{- $envvars := (coalesce nil) -}} {{- if (and (not $hasAccessKey) (get (fromJson (include "redpanda.SecretRef.IsValid" (dict "a" (list $tsc.accessKey) ))) "r")) -}} {{- $envvars = (concat (default (list ) $envvars) (list (mustMergeOverwrite (dict "name" "" ) (dict "name" "REDPANDA_CLOUD_STORAGE_ACCESS_KEY" "valueFrom" (get (fromJson (include "redpanda.SecretRef.AsSource" (dict "a" (list $tsc.accessKey) ))) "r") )))) -}} @@ -1322,12 +1504,12 @@ {{- $c := (index .a 0) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} -{{- $_1815___containerExists := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c "cloud_storage_azure_container" (coalesce nil)) ))) "r") -}} -{{- $_ := (index $_1815___containerExists 0) -}} -{{- $containerExists := (index $_1815___containerExists 1) -}} -{{- $_1816___accountExists := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c "cloud_storage_azure_storage_account" (coalesce nil)) ))) "r") -}} -{{- $_ := (index $_1816___accountExists 0) -}} -{{- $accountExists := (index $_1816___accountExists 1) -}} +{{- $_2063___containerExists := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c "cloud_storage_azure_container" (coalesce nil)) ))) "r") -}} +{{- $_ := (index $_2063___containerExists 0) -}} +{{- $containerExists := (index $_2063___containerExists 1) -}} +{{- $_2064___accountExists := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c "cloud_storage_azure_storage_account" (coalesce nil)) ))) "r") -}} +{{- $_ := (index $_2064___accountExists 0) -}} +{{- $accountExists := (index $_2064___accountExists 1) -}} {{- $_is_returning = true -}} {{- (dict "r" (and $containerExists $accountExists)) | toJson -}} {{- break -}} @@ -1338,9 +1520,9 @@ {{- $c := (index .a 0) -}} {{- range $_ := (list 1) -}} {{- $_is_returning := false -}} -{{- $_1821_value_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c `cloud_storage_cache_size` (coalesce nil)) ))) "r") -}} -{{- $value := (index $_1821_value_ok 0) -}} -{{- $ok := (index $_1821_value_ok 1) -}} +{{- $_2069_value_ok := (get (fromJson (include "_shims.dicttest" (dict "a" (list $c `cloud_storage_cache_size` (coalesce nil)) ))) "r") -}} +{{- $value := (index $_2069_value_ok 0) -}} +{{- $ok := (index $_2069_value_ok 1) -}} {{- if (not $ok) -}} {{- $_is_returning = true -}} {{- (dict "r" (coalesce nil)) | toJson -}} @@ -1365,9 +1547,9 @@ {{- if $_is_returning -}} {{- break -}} {{- end -}} -{{- $size_16 := (get (fromJson (include "redpanda.TieredStorageConfig.CloudStorageCacheSize" (dict "a" (list (deepCopy $c)) ))) "r") -}} -{{- if (ne (toJson $size_16) "null") -}} -{{- $_ := (set $config "cloud_storage_cache_size" ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $size_16) ))) "r") | int64)) -}} +{{- $size_21 := (get (fromJson (include "redpanda.TieredStorageConfig.CloudStorageCacheSize" (dict "a" (list (deepCopy $c)) ))) "r") -}} +{{- if (ne (toJson $size_21) "null") -}} +{{- $_ := (set $config "cloud_storage_cache_size" ((get (fromJson (include "_shims.resource_Value" (dict "a" (list $size_21) ))) "r") | int64)) -}} {{- end -}} {{- $_is_returning = true -}} {{- (dict "r" $config) | toJson -}} diff --git a/charts/redpanda/testdata/template-cases.golden.txtar b/charts/redpanda/testdata/template-cases.golden.txtar index e86faa10e..6f6f30a91 100644 --- a/charts/redpanda/testdata/template-cases.golden.txtar +++ b/charts/redpanda/testdata/template-cases.golden.txtar @@ -346,7 +346,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -742,7 +742,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -1656,7 +1656,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -2009,7 +2009,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e5b1f11d8fb052222d9f4301284b0e91935dbf73c874ee624183b5a04cb9823 + config.redpanda.com/checksum: 33ebc81c8bc9a678507fd263d7be9ce5cb74cd9f2910a106a6da06992d15f688 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -2737,7 +2737,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -3113,7 +3113,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6fd0ffd56475954e062f04d4d1c9393e016e8b66bfba64f6419c794861d1b9b2 + config.redpanda.com/checksum: 8f93462535470857b671d8b2c9ffe8190c7ff305848bbfe8b1eff79cda24b14e creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -4162,7 +4162,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -4527,7 +4527,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 5265a0c42c9888cd69e394a959677e44c5909408f1c85c570bb56e6262285b1a + config.redpanda.com/checksum: 46822e20286192745b9da57c19a488accf39e63679c13a2c15b4bc5fb0e35b70 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -5457,7 +5457,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -5850,7 +5850,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: fc10e3af9a4f7ff7f2e7f76110e0ad824999092e8012a745bc1168ead31e43ad + config.redpanda.com/checksum: e571624a89d9dcb7cb3ed43117fc7a3c4380af44a8923ffef8373dd528474da4 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -6910,7 +6910,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -7404,7 +7404,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -8462,7 +8462,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -8886,7 +8886,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6efc2c489543f3f84c0105524bea43a1fb61e5a3925046cb0a60551f23959964 + config.redpanda.com/checksum: 5530b1089b5c8540e25f5e6066602788ca7cd363b90a633eb2abd1ae5a2ad3c9 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -9990,7 +9990,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -10386,7 +10386,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -11417,7 +11417,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -11813,7 +11813,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -12878,7 +12878,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -13274,7 +13274,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: fc549ca23d4e1dff27e530265d59be059368cd4866ee0ca938c73ceff6815b57 + config.redpanda.com/checksum: d0e312e626c41b7516d6e88dc66c0f52d29d6544766d9d272d743604865d2082 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -14402,7 +14402,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -14815,7 +14815,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: ddcf6376732939f810acb684cafac205507b50b966e5714f128ed87a56fb10f6 + config.redpanda.com/checksum: 307c33811853a1365ab40efa3cca61714f241c9faf3c68138085c5b6512bb8dd creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -15853,7 +15853,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -16249,7 +16249,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 48ad7b247c147d3bd7bcbc3357d831d21016fbd8ca0022343a14dbb23c15a9ae + config.redpanda.com/checksum: 8f9bf99be27e0ff260c58111af9b3d263fc0870e20507d2d82ba7b0028282411 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -17131,7 +17131,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -17614,7 +17614,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 48ad7b247c147d3bd7bcbc3357d831d21016fbd8ca0022343a14dbb23c15a9ae + config.redpanda.com/checksum: 8f9bf99be27e0ff260c58111af9b3d263fc0870e20507d2d82ba7b0028282411 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -18450,7 +18450,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -18818,7 +18818,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 148733ee0ada31cbc1a8fda54191ad29425f8b3dea458814fac1938671843141 + config.redpanda.com/checksum: 94dbd3cea64549bf107fecb9b86480cca583c791a5c1286a0d101af9ad972984 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -19592,7 +19592,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -19988,7 +19988,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -20997,7 +20997,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -21623,7 +21623,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -22638,7 +22638,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2000M - --reserve-memory=0M - --smp=1 @@ -23034,7 +23034,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: f20d341fb81aa7ed6ced1fad2af7b611113cb255d137392a3d2485781a045a19 + config.redpanda.com/checksum: 95632e246388f3efd2d0bea4cd75433ffd1807b2f4cb2966ce7bbe945b3af99b creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -24014,7 +24014,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -24410,7 +24410,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 9802162e4b8b9aaf699d67337e3ee45299ff93beb822d0842765ce1c5a4c911b + config.redpanda.com/checksum: a53438e204f8ca26aa0de23030bcbca01ca14644cbf500af97521199809dab37 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -25435,7 +25435,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -25847,7 +25847,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -26886,7 +26886,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -27298,7 +27298,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -28335,7 +28335,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -28747,7 +28747,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -29747,7 +29747,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -30143,7 +30143,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -31180,7 +31180,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -31592,7 +31592,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -32650,7 +32650,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -33062,7 +33062,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -34118,7 +34118,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -34530,7 +34530,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -35550,7 +35550,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -35946,7 +35946,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -37003,7 +37003,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -37415,7 +37415,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -38473,7 +38473,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -38885,7 +38885,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -39941,7 +39941,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -40353,7 +40353,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -41373,7 +41373,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=1024M - --reserve-memory=100M - --smp=1 @@ -41769,7 +41769,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 6e125110db4b6706f6338010ad36c50316395111aea32b3a9d4f4984a32501f9 + config.redpanda.com/checksum: 1fa6783eda7c009103683a9f93254e995c6a9a02884816ddb2c3a8e2d457ba23 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -42782,10 +42782,12 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' + - '----reserve-memory=9999' + - '----smp=99' - --memory=2048M - - --smp=99 - - --reserve-memory=9999 + - --reserve-memory=205M + - --smp=1 admin_api: addresses: - redpanda-0.redpanda.default.svc.cluster.local.:9644 @@ -43178,7 +43180,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 154bbf670b25a84e084af1f1a6777450206fdb2f3014a881f8350fe0371cdc54 + config.redpanda.com/checksum: 9b16d08486d6f4bc7cee5ff60c9d1d8b66b4886b9243000dc65eaf3bd35cffde creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -44155,7 +44157,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -44551,7 +44553,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -45529,7 +45531,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -45925,7 +45927,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -46963,7 +46965,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -47383,7 +47385,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 52c4224ef1d61d20c262460abf0216fe9307e5d6a7f850500acf83a9fae73176 + config.redpanda.com/checksum: 2068bdb5f8684c9e4578e8107d06bc2cea1e9b3c30d330769d01336efad13aa8 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -48371,7 +48373,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -48776,7 +48778,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -49762,7 +49764,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -50388,7 +50390,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -51470,7 +51472,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -51998,7 +52000,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -53018,7 +53020,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -53628,7 +53630,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -54605,7 +54607,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -55001,7 +55003,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 4dd7f27eb2c63130aae3cb9fb56e906fe64581f6bf10fbfd9cbd78af4538ad4f + config.redpanda.com/checksum: 47d097342800be7c5baa31e29c5a3396affc7e8cbf46085bf1edadb024739120 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -55983,7 +55985,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -56383,7 +56385,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: d36e92a8c61e842dcb008c69f388e92e82e8bac4773ca194fac0b13ab573a5d7 + config.redpanda.com/checksum: 0ebe33e0d4b34b0d2a2e290d5dc1005294289951fca4dda511e58159f9412e0a creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -57394,7 +57396,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -57790,7 +57792,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -58801,7 +58803,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -59197,7 +59199,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -60210,7 +60212,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -60606,7 +60608,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -61552,7 +61554,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=trace + - '----default-log-level=trace' - --memory=1638M - --reserve-memory=204M - --smp=1 @@ -61783,7 +61785,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: e4a33e06a3a848411b8c96665793b25fe19f6633e1dba4696815c7c709e55670 + config.redpanda.com/checksum: 5c977f63f7be064a42e256faabeb209ea913892ee99b42c6d57423cb478969f3 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -62879,7 +62881,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -63275,7 +63277,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -64387,7 +64389,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -64816,7 +64818,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: bd246fb96aa20556886caa8b87c2670c88c07301ead21f08a9686f6516d3e550 + config.redpanda.com/checksum: d090c310b756672763fdddfe12dacff438b889bd83ed3bf014162e0c35468864 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -65894,7 +65896,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -66306,7 +66308,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -67285,7 +67287,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -67686,7 +67688,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -68668,7 +68670,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -69305,7 +69307,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -70332,7 +70334,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -70728,7 +70730,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -71707,7 +71709,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -72103,7 +72105,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -73082,7 +73084,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -73478,7 +73480,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -74737,12 +74739,14 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----abort-on-seastar-bad-alloc' + - '----default-log-level=info' + - '----dump-memory-diagnostics-on-alloc-failure-kind=all' + - '----memory=5G' + - '----reserve-memory=1G' + - --memory=5243M + - --reserve-memory=213M - --smp=1 - - --memory=5G - - --reserve-memory=1G - - --abort-on-seastar-bad-alloc - - --dump-memory-diagnostics-on-alloc-failure-kind=all admin_api: addresses: - redpanda-0.redpanda.default.svc.cluster.local.:9644 @@ -74997,7 +75001,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 69e9dd514b47e871ffed51f91c705708156ff083623eccd0d138847850a6858b + config.redpanda.com/checksum: 224dd9eacb007d5c0bdcf940855d333bcfffe784ba62e6dacbe4d189e227b0d2 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -76160,7 +76164,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -76563,7 +76567,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -77685,7 +77689,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -78098,7 +78102,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: ddcf6376732939f810acb684cafac205507b50b966e5714f128ed87a56fb10f6 + config.redpanda.com/checksum: 307c33811853a1365ab40efa3cca61714f241c9faf3c68138085c5b6512bb8dd creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -79160,7 +79164,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -79556,7 +79560,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -80570,7 +80574,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -80982,7 +80986,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -81966,7 +81970,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -82362,7 +82366,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -83372,7 +83376,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -83768,7 +83772,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -84782,7 +84786,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -85194,7 +85198,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -86178,7 +86182,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -86574,7 +86578,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -87572,7 +87576,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -87968,7 +87972,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -88982,7 +88986,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -89394,7 +89398,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -90378,7 +90382,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -90774,7 +90778,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -91772,7 +91776,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -92168,7 +92172,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -93182,7 +93186,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -93594,7 +93598,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -94578,7 +94582,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -94974,7 +94978,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -95973,7 +95977,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -96369,7 +96373,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -97384,7 +97388,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -97796,7 +97800,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -98781,7 +98785,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -99177,7 +99181,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -100176,7 +100180,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -100572,7 +100576,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -101587,7 +101591,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -101999,7 +102003,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -102984,7 +102988,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -103380,7 +103384,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -104378,7 +104382,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -104774,7 +104778,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -105557,7 +105561,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -105959,7 +105963,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: fd140d05574a4b21ce6b2a6395458401c1e6186bf8e96c7af882169f664768f8 + config.redpanda.com/checksum: 68239113c0497024484ce8a289fbbbcc0dbf266e7b349d7b6f15d4ca4301ceb0 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -106758,7 +106762,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -107384,7 +107388,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -108521,7 +108525,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -109169,7 +109173,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: ddcf6376732939f810acb684cafac205507b50b966e5714f128ed87a56fb10f6 + config.redpanda.com/checksum: 307c33811853a1365ab40efa3cca61714f241c9faf3c68138085c5b6512bb8dd creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -110207,7 +110211,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -110817,7 +110821,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -111810,7 +111814,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -112436,7 +112440,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -113446,7 +113450,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -114072,7 +114076,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -115143,7 +115147,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -115539,7 +115543,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -116586,7 +116590,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -117072,7 +117076,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: c78188d8cc1a290ac7796eded5f3a49988f7a44a5971aad33fe89b9b32293cfa + config.redpanda.com/checksum: 7f0ca171fa138a2fd883852cb701e03ceb8893a0d56146e0541a5d81351354da creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -118053,7 +118057,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -118539,7 +118543,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 40b1555a526efc78caf3107b6358b05773b82d09ed9b9671ad6524e40176955a + config.redpanda.com/checksum: 48b5e804df85159090f181e5d5a3d47ad51718f17876d5ede941db3ade2f1582 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -119573,7 +119577,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -120035,7 +120039,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 94c9073f00666e990b3c71fa079076ea050fb87cd0cc32f503bbe21fb198294e + config.redpanda.com/checksum: 3709db369a06ab0c5ee2b8198ebabf96a92f05eeb42d7b4028792cb3a03223ab creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -121060,7 +121064,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -121468,7 +121472,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 321ff8691ac4f68ffb27c9740544981cf2a289b856d21a3d3eb6b8bab9fe4d05 + config.redpanda.com/checksum: b88c35c851b64d2bba4facc4021864ca1717e83aad2913d268e6df6f71124bea creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -122586,7 +122590,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --smp=1 admin_api: @@ -122981,7 +122985,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b5b5d0fb08868933f0fea06ea634d950c13380b1e9ca7d5f944b9591eeeb2e41 + config.redpanda.com/checksum: fcef61c4510e2ee0f433f583c10d9c1ec18758342b22d5f42a37fcd654b81416 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -123958,7 +123962,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -124354,7 +124358,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -125350,7 +125354,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -125744,7 +125748,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b8e0da1a021479fef4009079ccab692b64a4149233b6a0852c151097c6926cd8 + config.redpanda.com/checksum: bc5b35f768990f404fab6b4fa3cbf5b53ad482446d5b2fcb86d8277c3030b790 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -126848,7 +126852,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=16384M - --reserve-memory=240M - --smp=7 @@ -127555,7 +127559,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: 5cbd0fb4b580d08f9aff2db9d0f18ddecdd179d785b6e8892b220066521c5d05 + config.redpanda.com/checksum: 4e124da333f7a34eeff1565bec4be3b9b962778b5e66c054b883a9f308716b36 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -128808,7 +128812,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -129204,7 +129208,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -130218,7 +130222,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -130630,7 +130634,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -131614,7 +131618,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -132010,7 +132014,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -133009,7 +133013,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -133405,7 +133409,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -134420,7 +134424,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -134832,7 +134836,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -135817,7 +135821,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -136213,7 +136217,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -137211,7 +137215,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -137624,7 +137628,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset @@ -138629,7 +138633,7 @@ data: port: 33145 rpk: additional_start_flags: - - --default-log-level=info + - '----default-log-level=info' - --memory=2048M - --reserve-memory=205M - --smp=1 @@ -139025,7 +139029,7 @@ spec: template: metadata: annotations: - config.redpanda.com/checksum: b689e1074337a6b597b8b9725e277cec5fd5a95b3031e546d96640232ca30ca3 + config.redpanda.com/checksum: 384b9fa70edec5cb7aa09f6ce8d0eba98acdcbee13c97e4021a8354a53b4e4c5 creationTimestamp: null labels: app.kubernetes.io/component: redpanda-statefulset diff --git a/charts/redpanda/testdata/template-cases.txtar b/charts/redpanda/testdata/template-cases.txtar index a16904fe9..174a8fddb 100644 --- a/charts/redpanda/testdata/template-cases.txtar +++ b/charts/redpanda/testdata/template-cases.txtar @@ -1123,4 +1123,28 @@ tls: issuerRef: kind: ClusterIssuer name: letsencrypt-production - enabled: true \ No newline at end of file + enabled: true + +-- direct-resources-examples -- +# ASSERT-NO-ERROR +# ASSERT-FIELD-EQUALS ["apps/v1/StatefulSet", "default/redpanda", "{.spec.template.spec.containers[0].resources.limits}", {"memory": "10Gi"}] +# ASSERT-FIELD-EQUALS ["apps/v1/StatefulSet", "default/redpanda", "{.spec.template.spec.containers[0].resources.requests}", {"cpu": "5500m"}] +# ASSERT-FIELD-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--smp=5"] +# ASSERT-FIELD-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--memory=9216M"] +# ASSERT-FIELD-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--reserve-memory=0M"] +resources: + limits: + memory: 10Gi + requests: + cpu: 5500m + +-- direct-resources-none-provided -- +# ASSERT-NO-ERROR +# ASSERT-FIELD-EQUALS ["apps/v1/StatefulSet", "default/redpanda", "{.spec.template.spec.containers[0].resources.limits}", {}] +# ASSERT-FIELD-EQUALS ["apps/v1/StatefulSet", "default/redpanda", "{.spec.template.spec.containers[0].resources.requests}", {}] +# ASSERT-FIELD-NOT-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--smp"] +# ASSERT-FIELD-NOT-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--memory"] +# ASSERT-FIELD-CONTAINS ["v1/ConfigMap", "default/redpanda", "{.data.redpanda\\.yaml}", "--reserve-memory=0M"] +resources: + limits: {} + requests: {} diff --git a/charts/redpanda/values.go b/charts/redpanda/values.go index c2766f74a..015b4625b 100644 --- a/charts/redpanda/values.go +++ b/charts/redpanda/values.go @@ -53,6 +53,8 @@ const ( certificateMountPoint = "/etc/tls/certs" ) +type MebiBytes = int64 + // values.go contains a collection of go structs that (loosely) map to // values.yaml and are used for generating values.schema.json. Commented out // struct fields are fields that are valid in the eyes of values.yaml but are @@ -300,11 +302,34 @@ type Monitoring struct { ScrapeInterval monitoringv1.Duration `json:"scrapeInterval" jsonschema:"required"` Labels map[string]string `json:"labels"` TLSConfig *monitoringv1.TLSConfig `json:"tlsConfig"` - //nolint:stylecheck - EnableHttp2 *bool `json:"enableHttp2"` + EnableHTTP2 *bool `json:"enableHttp2"` } +// RedpandaResources encapsulates the calculation of the redpanda container's +// [corev1.ResourceRequirements] and parameters such as `--memory`, +// `--reserve-memory`, and `--smp`. +// This calculation supports two modes: +// +// - Explicit mode (recommended): Activated when `Limits` and `Requests` are +// set. In this mode, the CLI flags are calculated directly based on the +// provided `Limits` and `Requests`. This mode ensures predictable resource +// allocation and is recommended for production environments. If additional +// tuning is required, the CLI flags can be manually overridden using +// `statefulset.additionalRedpandaCmdFlags`. +// +// - Legacy mode (default): Used when `Limits` and `Requests` are not set. +// In this mode, the container resources and CLI flags are calculated using +// built-in default logic, where 80% of the container's memory is allocated +// to Redpanda and the rest is reserved for system overhead. Legacy mode is +// intended for backward compatibility and less controlled environments. +// +// Explicit mode offers better control and aligns with Kubernetes best +// practices. Legacy mode is a fallback for users who have not defined `Limits` +// and `Requests`. type RedpandaResources struct { + Limits *corev1.ResourceList `json:"limits,omitempty"` + Requests *corev1.ResourceList `json:"requests,omitempty"` + CPU struct { Cores resource.Quantity `json:"cores" jsonschema:"required"` Overprovisioned *bool `json:"overprovisioned"` @@ -348,13 +373,6 @@ type RedpandaResources struct { // based on container memory. // Uncommenting this section and setting memory and reserveMemory values will disable // automatic calculation. - // - // If you are setting the following values manually, keep in mind the following guidelines. - // Getting this wrong may lead to performance issues, instability, and loss of data: - // The amount of memory to allocate to a container is determined by the sum of three values: - // 1. Redpanda (at least 2Gi per core, ~80% of the container's total memory) - // 2. Seastar subsystem (200Mi * 0.2% of the container's total memory, 200Mi < x < 1Gi) - // 3. Other container processes (whatever small amount remains) Redpanda *struct { // Memory for the Redpanda process. // This must be lower than the container's memory (resources.memory.container.min if provided, otherwise @@ -371,7 +389,76 @@ type RedpandaResources struct { } `json:"memory" jsonschema:"required"` } +func (rr *RedpandaResources) GetResourceRequirements() corev1.ResourceRequirements { + // If Limits and Requests are specified, use them as is. + if rr.Limits != nil && rr.Requests != nil { + return corev1.ResourceRequirements{ + Limits: *rr.Limits, + Requests: *rr.Requests, + } + } + + // Otherwise fallback to the historical behavior. + reqs := corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": rr.CPU.Cores, + "memory": rr.Memory.Container.Max, + }, + } + + if rr.Memory.Container.Min != nil { + reqs.Requests = corev1.ResourceList{ + "cpu": rr.CPU.Cores, + "memory": *rr.Memory.Container.Min, + } + } + + return reqs +} + +func (rr *RedpandaResources) GetRedpandaFlags() map[string]string { + flags := map[string]string{ + "reserve-memory": fmt.Sprintf("%dM", rr.reserveMemory()), + } + + if smp := rr.smp(); smp != nil { + flags["smp"] = fmt.Sprintf("%d", int64(*smp)) + } + + if memory := rr.memory(); memory != nil { + flags["memory"] = fmt.Sprintf("%dM", int64(*memory)) + } + + // Only set lock-memory if Limits and Requests are NOT specified. It should + // otherwise be set through additionalRedpandaCmdFlags. + if rr.Limits == nil && rr.Requests == nil { + flags["lock-memory"] = fmt.Sprintf("%v", ptr.Deref(rr.Memory.EnableMemoryLocking, false)) + } + + if rr.GetOverProvisionValue() { + flags["overprovisioned"] = "" + } + + return flags +} + func (rr *RedpandaResources) GetOverProvisionValue() bool { + if rr.Limits != nil && rr.Requests != nil { + // Get CPU prioritizing requests, falling back to limits if not + // specified as kube-scheduler does. + cpuReq, ok := (*rr.Requests)[corev1.ResourceCPU] + if !ok { + cpuReq, ok = (*rr.Limits)[corev1.ResourceCPU] + } + + // If redpanda has been allocated less than 1 full CPU, set + // overprovisioned to true. + if ok && cpuReq.MilliValue() < 1000 { + return true + } + return false + } + if rr.CPU.Cores.MilliValue() < 1000 { return true } @@ -379,6 +466,167 @@ func (rr *RedpandaResources) GetOverProvisionValue() bool { return ptr.Deref(rr.CPU.Overprovisioned, false) } +func (rr *RedpandaResources) smp() *int64 { + if rr.Limits != nil && rr.Requests != nil { + // Get CPU prioritizing requests, falling back to limits if not + // specified as kube-scheduler does. This ordering also forces --smp to + // be <= the containers CPU limits. The other way around (limits + // fallback to requests; therefore --smp >= CPU limits) isn't useful. + cpuReq, ok := (*rr.Requests)[corev1.ResourceCPU] + if !ok { + cpuReq, ok = (*rr.Limits)[corev1.ResourceCPU] + } + + // If neither requests nor limits are set, don't set --smp. + if !ok { + return nil + } + + // If CPU limits/requests are defined, set --smp to max(1, floor(cpu)). + // + // Due to redpanda/seastar's per core model, we can't do much with + // fractional CPU values we need to round either up or down. Rounding + // up would result in utilizing too much CPU from the CRI perspective + // and cause throttling, so we round down and potentially waste some + // quota. + smp := cpuReq.MilliValue() / 1000 + if smp < 1 { + smp = 1 + } + return ptr.To(smp) + } + + if coresInMillies := rr.CPU.Cores.MilliValue(); coresInMillies < 1000 { + return ptr.To(int64(1)) + } + return ptr.To(int64(rr.CPU.Cores.Value())) +} + +// memory returns the amount of memory for Redpanda process. It should be +// passed to the `--memory` argument of the Redpanda process, see +// RedpandaAdditionalStartFlags and rpk redpanda start documentation. +// +// https://docs.redpanda.com/current/reference/rpk/rpk-redpanda/rpk-redpanda-start/ +func (rr *RedpandaResources) memory() *MebiBytes { + if rr.Limits != nil && rr.Requests != nil { + // `--memory` will be set to something < the container's + // resources.memory.limits value. + // We want to allocate seastar < memory than our limit for several reasons: + // 1. Seastar may slightly exceed this limit due to page tables and + // non-heap memory that's still accounted by cgroups. + // 2. resources.limits.memory applies to the entire container. We want + // to keep headroom to allow exec'ing into the container and for any + // exec probes. + // 3. emptyDir's storage is counted against the container's memory + // limits. We use these to store rendered versions of config files + // and therefore need to account for them. + // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#memory-backed-emptydir + // The memory reservation is done by subtracting from `--memory` and + // always setting `--reserve-memory` to 0 rather than setting + // `--reserve-memory`. This is an easier mental model to follow as the + // `--reserve-memory` flag is exceptionally nuanced in practice and is + // meant to aid seastar running on an entire VM rather than in a + // container. + + // If either memory limit or requests are set, we take the minimum of + // the two (relying on the invariant enforced by Kubernetes that + // requests must be <= limits). + memReq, ok := (*rr.Requests)[corev1.ResourceMemory] + if !ok { + memReq, ok = (*rr.Limits)[corev1.ResourceMemory] + } + + // If neither requests nor limits are set, don't set --memory. + if !ok { + return nil + } + + // Here we perform our memory reservation. Historically, 80% of + // container memory was provided to Redpanda and some additional amount + // was removed due to the usage of `--reserve-memory`. We're largely + // blind to the lower limit of what's tolerated. + // This calculation, therefore, is a complete split ball. We expect + // this to change over time; ideally trending towards providing + // redpanda more memory. + // We intentionally err on the conservative side as we'd prefer to + // "waste" a few megs of memory rather than risking OOM kills. + // For simplicity, we're using a % as a static reservation would need + // to handle weird edge cases. + // + // redpanda get's 90% of the container limit. (It's better than the + // historic 80%). + memory := int64(float64(memReq.Value()) * 0.90) + + // Cast to Membibytes. + return ptr.To(memory / (1024 * 1024)) + } + + // Below we perform the calculations for the legacy resource mode. This + // calculation appears to be based on an incorrect understanding of the + // (admittedly convoluted) `--reserve-memory` seastar flag and is preserved + // solely for backwards compatibility. + // + // It segments out memory for: + // * Seastar/Redpanda (`--memory`) - .Memory.Redpanda OR 80% of memory + // * Seastar's "subsystem" (`--reserve-memory`) - .Memory.Reserve OR 200Mi + 0.2% of memory + // * Container processes (execing, hooks, probes, etc) - The leftovers from the above (if any) + memory := int64(0) + containerMemory := rr.containerMemory() + + if rpMem := rr.Memory.Redpanda; rpMem != nil && rpMem.Memory != nil { + memory = rpMem.Memory.Value() / (1024 * 1024) + } else { + memory = int64(float64(containerMemory) * 0.8) + } + + if memory == 0 { + panic("unable to get memory value redpanda-memory") + } + + if memory < 256 { + panic(fmt.Sprintf("%d is below the minimum value for Redpanda", memory)) + } + + // NB: int64's are working around a bug in gotohelm's BinaryExpr detection + // with Alias types. + if memory+int64(rr.reserveMemory()) > containerMemory { + panic(fmt.Sprintf("Not enough container memory for Redpanda memory values where Redpanda: %d, reserve: %d, container: %d", memory, rr.reserveMemory(), containerMemory)) + } + + return ptr.To(memory) +} + +// reserveMemory returns the amount of memory that the Redpanda process will +// not use from the provided value in `--memory` or from the internal Redpanda +// discovery process. It should be passed to the `--reserve-memory` argument +// of the Redpanda process, see RedpandaAdditionalStartFlags and rpk redpanda +// start documentation. +// +// https://docs.redpanda.com/current/reference/rpk/rpk-redpanda/rpk-redpanda-start/ +func (rr *RedpandaResources) reserveMemory() MebiBytes { + if rr.Limits != nil && rr.Requests != nil { + // See [RedpandaResources.memory] for details here. + return 0 + } + + // See [RedpandaResources.memory] for details here. + if rpMem := rr.Memory.Redpanda; rpMem != nil && rpMem.ReserveMemory != nil { + return rpMem.ReserveMemory.Value() / (1024 * 1024) + } + + return int64(float64(rr.containerMemory())*0.002) + 200 +} + +// containerMemory returns either the min or max container memory values as an +// integer value of MembiBytes. +func (rr *RedpandaResources) containerMemory() MebiBytes { + if rr.Memory.Container.Min != nil { + return rr.Memory.Container.Min.Value() / (1024 * 1024) + } + + return rr.Memory.Container.Max.Value() / (1024 * 1024) +} + type Storage struct { HostPath string `json:"hostPath" jsonschema:"required"` Tiered Tiered `json:"tiered" jsonschema:"required"` diff --git a/charts/redpanda/values.schema.json b/charts/redpanda/values.schema.json index 81af69a1c..233361d29 100644 --- a/charts/redpanda/values.schema.json +++ b/charts/redpanda/values.schema.json @@ -14019,6 +14019,20 @@ ], "type": "object" }, + "limits": { + "additionalProperties": { + "oneOf": [ + { + "type": "integer" + }, + { + "pattern": "^[0-9]+(\\.[0-9]){0,1}(m|k|M|G|T|P|Ki|Mi|Gi|Ti|Pi)?$", + "type": "string" + } + ] + }, + "type": "object" + }, "memory": { "properties": { "container": { @@ -14086,6 +14100,20 @@ "container" ], "type": "object" + }, + "requests": { + "additionalProperties": { + "oneOf": [ + { + "type": "integer" + }, + { + "pattern": "^[0-9]+(\\.[0-9]){0,1}(m|k|M|G|T|P|Ki|Mi|Gi|Ti|Pi)?$", + "type": "string" + } + ] + }, + "type": "object" } }, "required": [ diff --git a/charts/redpanda/values.yaml b/charts/redpanda/values.yaml index f9128fafc..5ce371686 100644 --- a/charts/redpanda/values.yaml +++ b/charts/redpanda/values.yaml @@ -346,9 +346,36 @@ monitoring: # keyFile: /etc/prom-certs/key.pem # -- Pod resource management. -# This section simplifies resource allocation -# by providing a single location where resources are defined. -# Helm sets these resource values within the `statefulset.yaml` and `configmap.yaml` templates. +# @raw +# This section simplifies resource allocation for the redpanda container by +# providing a single location where resources are defined. +# +# Resources may be specified by either setting `resources.cpu` and +# `resources.memory` (the default) or by setting `resources.requests` and +# `resources.limits`. +# +# For details on `resources.cpu` and `resources.memory`, see their respective +# documentation below. +# +# When `resources.limits` and `resources.requests` are set, the redpanda +# container's resources will be set to exactly the provided values. This allows +# users to granularly control limits and requests to best suit their use case. +# For example: `resources.requests.cpu` may be set without setting +# `resources.limits.cpu` to avoid the potential of CPU throttling. +# +# Redpanda's resource related CLI flags will then be calculated as follows: +# * `--smp max(1, floor(coalesce(resources.requests.cpu, resources.limits.cpu)))` +# * `--memory coalesce(resources.requests.memory, resources.limits.memory) * 90%` +# * `--reserve-memory 0` +# * `--overprovisioned coalesce(resources.requests.cpu, resources.limits.cpu) < 1000m` +# +# If neither a request nor a limit is provided for cpu or memory, the +# corresponding flag will be omitted. As a result, setting `resources.limits` +# and `resources.requests` to `{}` will result in redpanda being run without +# `--smp` or `--memory`. (This is not recommended). +# +# If the computed CLI flags are undesirable, they may be overridden by +# specifying the desired value through `statefulset.additionalRedpandaCmdFlags`. # # The default values are for a development environment. # Production-level values and other considerations are documented, @@ -356,6 +383,8 @@ monitoring: # For details, # see the [Pod resources documentation](https://docs.redpanda.com/docs/manage/kubernetes/manage-resources/). resources: + # limits: null + # requests: null # # -- CPU resources. # For details, diff --git a/charts/redpanda/values_partial.gen.go b/charts/redpanda/values_partial.gen.go index fbb4c7206..9f20ef771 100644 --- a/charts/redpanda/values_partial.gen.go +++ b/charts/redpanda/values_partial.gen.go @@ -127,11 +127,13 @@ type PartialMonitoring struct { ScrapeInterval *monitoringv1.Duration "json:\"scrapeInterval,omitempty\" jsonschema:\"required\"" Labels map[string]string "json:\"labels,omitempty\"" TLSConfig *monitoringv1.TLSConfig "json:\"tlsConfig,omitempty\"" - EnableHttp2 *bool "json:\"enableHttp2,omitempty\"" + EnableHTTP2 *bool "json:\"enableHttp2,omitempty\"" } type PartialRedpandaResources struct { - CPU *struct { + Limits *corev1.ResourceList "json:\"limits,omitempty\"" + Requests *corev1.ResourceList "json:\"requests,omitempty\"" + CPU *struct { Cores *resource.Quantity "json:\"cores,omitempty\" jsonschema:\"required\"" Overprovisioned *bool "json:\"overprovisioned,omitempty\"" } "json:\"cpu,omitempty\" jsonschema:\"required\"" diff --git a/charts/redpanda/values_test.go b/charts/redpanda/values_test.go index c6f0115bc..0b1f0bc76 100644 --- a/charts/redpanda/values_test.go +++ b/charts/redpanda/values_test.go @@ -13,8 +13,10 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/utils/ptr" ) @@ -618,3 +620,87 @@ func TestTieredStorageConfigCreds(t *testing.T) { }) } } + +func TestRedpandaResources_RedpandaFlags(t *testing.T) { + cases := []struct { + Resources RedpandaResources + Expected map[string]string + }{ + { + Resources: RedpandaResources{ + Limits: &corev1.ResourceList{}, + Requests: &corev1.ResourceList{}, + }, + Expected: map[string]string{ + "reserve-memory": "0M", // Always set when Limits && Requests != nil. + // No other flags set as there's nothing to base them off of (Not recommended). + }, + }, + { + // overprovisioned is only set if CPU < 1000m. + Resources: RedpandaResources{ + Limits: &corev1.ResourceList{}, + Requests: &corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("500m"), + }, + }, + Expected: map[string]string{ + "reserve-memory": "0M", // Always set when Limits && Requests != nil. + "smp": "1", + "overprovisioned": "", + }, + }, + { + Resources: RedpandaResources{ + Limits: &corev1.ResourceList{}, + Requests: &corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("2500m"), + corev1.ResourceMemory: resource.MustParse("10Gi"), + }, + }, + Expected: map[string]string{ + "reserve-memory": "0M", + "smp": "2", // floor(CPU) + "memory": "9216M", // memory * 90% + }, + }, + { + // Limits are taken if requests aren't specified. + Resources: RedpandaResources{ + Limits: &corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("3"), + corev1.ResourceMemory: resource.MustParse("20Gi"), + }, + Requests: &corev1.ResourceList{}, + }, + Expected: map[string]string{ + "reserve-memory": "0M", + "smp": "3", // floor(CPU) + "memory": "18432M", // memory * 90% + }, + }, + { + // Showcase that Requests are taken for CLI params in favor of limits. + Resources: RedpandaResources{ + Limits: &corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("10"), + corev1.ResourceMemory: resource.MustParse("200Gi"), + }, + Requests: &corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("5"), + corev1.ResourceMemory: resource.MustParse("100Gi"), + }, + }, + Expected: map[string]string{ + "reserve-memory": "0M", + "smp": "5", // floor(CPU) + "memory": "92160M", // memory * 90% + }, + }, + } + + for _, tc := range cases { + flags := tc.Resources.GetRedpandaFlags() + assert.Equal(t, tc.Expected, flags) + } +}