Skip to content

Commit

Permalink
Allow setting schema registry configuration parameters via the RPK no…
Browse files Browse the repository at this point in the history
…de config block
  • Loading branch information
andrewstucki committed Nov 5, 2024
1 parent cc56695 commit 3dc87d8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/go/rpk/pkg/cli/profile/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/go/rpk/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/go/rpk/pkg/config/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/go/rpk/pkg/config/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ rpk:
admin_api:
addresses:
- 0.0.0.3:9644
schema_registry:
addresses:
- 0.0.0.2:8081
overprovisioned: true
coredump_dir: /var/lib/redpanda/coredump
pandaproxy: {}
Expand Down
5 changes: 3 additions & 2 deletions src/go/rpk/pkg/config/redpanda_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3dc87d8

Please sign in to comment.