From e521d95172053b2aafb8668e1b1bb387d6fc2086 Mon Sep 17 00:00:00 2001 From: Andrew Stucki Date: Tue, 5 Nov 2024 14:26:25 -0500 Subject: [PATCH] Allow setting schema registry configuration parameters via the RPK node config block --- src/go/rpk/pkg/cli/profile/create.go | 1 + src/go/rpk/pkg/config/config.go | 1 + src/go/rpk/pkg/config/params.go | 6 ++++++ src/go/rpk/pkg/config/redpanda_yaml.go | 5 +++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/go/rpk/pkg/cli/profile/create.go b/src/go/rpk/pkg/cli/profile/create.go index 7e0bb277a93a1..db11ba1796760 100644 --- a/src/go/rpk/pkg/cli/profile/create.go +++ b/src/go/rpk/pkg/cli/profile/create.go @@ -259,6 +259,7 @@ func CreateFlow( p = &config.RpkProfile{ KafkaAPI: nodeCfg.KafkaAPI, AdminAPI: nodeCfg.AdminAPI, + SR: nodeCfg.SR, } } if err := doSet(p, set); err != nil { diff --git a/src/go/rpk/pkg/config/config.go b/src/go/rpk/pkg/config/config.go index 5c4cbdd100fb5..4c624e555ce20 100644 --- a/src/go/rpk/pkg/config/config.go +++ b/src/go/rpk/pkg/config/config.go @@ -247,6 +247,7 @@ func (y *RedpandaYaml) setDevMode() { y.Rpk = RpkNodeConfig{ KafkaAPI: y.Rpk.KafkaAPI, AdminAPI: y.Rpk.AdminAPI, + SR: y.Rpk.SR, AdditionalStartFlags: y.Rpk.AdditionalStartFlags, SMP: DevDefault().Rpk.SMP, Overprovisioned: true, diff --git a/src/go/rpk/pkg/config/params.go b/src/go/rpk/pkg/config/params.go index cd670fbbcd3d1..a0d2cf2bbd1ac 100644 --- a/src/go/rpk/pkg/config/params.go +++ b/src/go/rpk/pkg/config/params.go @@ -1389,6 +1389,9 @@ func (c *Config) mergeRpkIntoRedpanda(actual bool) { if !reflect.DeepEqual(p.AdminAPI, RpkAdminAPI{}) { dst.AdminAPI = p.AdminAPI } + if !reflect.DeepEqual(p.SR, RpkSchemaRegistryAPI{}) { + dst.SR = p.SR + } } // This function ensures a current profile exists in the Virtual rpk.yaml. @@ -1473,6 +1476,9 @@ func (c *Config) mergeRedpandaIntoRpk() { if reflect.DeepEqual(p.AdminAPI, RpkAdminAPI{}) { p.AdminAPI = src.AdminAPI } + if reflect.DeepEqual(p.SR, RpkSchemaRegistryAPI{}) { + p.SR = src.SR + } } // Similar to backcompat flags, we first capture old env vars and then new diff --git a/src/go/rpk/pkg/config/redpanda_yaml.go b/src/go/rpk/pkg/config/redpanda_yaml.go index 179ad3650454e..40e742b7e9333 100644 --- a/src/go/rpk/pkg/config/redpanda_yaml.go +++ b/src/go/rpk/pkg/config/redpanda_yaml.go @@ -141,8 +141,9 @@ type ( } RpkNodeConfig struct { - KafkaAPI RpkKafkaAPI `yaml:"kafka_api,omitempty" json:"kafka_api"` - AdminAPI RpkAdminAPI `yaml:"admin_api,omitempty" json:"admin_api"` + KafkaAPI RpkKafkaAPI `yaml:"kafka_api,omitempty" json:"kafka_api"` + AdminAPI RpkAdminAPI `yaml:"admin_api,omitempty" json:"admin_api"` + SR RpkSchemaRegistryAPI `yaml:"schema_registry,omitempty" json:"schema_registry"` // The following four configs are passed to redpanda on `rpk // redpanda start`. They are not tuner configs. They live here