-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rpk config: Support polymorphic advertised kafka api #529
Conversation
Set as draft while I write more tests. |
I'm not completely sure that this feature is useful without If it helps I'm not sure there is any value in ever writing the original non-list format (newer versions of redpanda will read the older version) which might simplify compatibility handling in rpk. |
@dotnwat I hadn't seen 15795ed#diff-029da2340cdf2c65a04e8cda2e44dc6bea00e5be5d643429be7050bcfa408a43 when I started this, but it should be easy enough to support |
Nice. Any reason not to use that format for the named versions of I think you'll be able to use an URI parser, which might simplify some parser code. |
2ff2279
to
461b15d
Compare
I'm sorry! I meant that exactly. Seeds don't have names 🤦🏽♂️
Done! |
40733b3
to
418dd41
Compare
4bbda60
to
442af0b
Compare
8222fa4
to
17a6803
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth considering:
func MakeNamedSocketAddress(name, host, port) NamedSocketAddress
Firstly to reduce the syntactic noise, and secondly to help potential refactoring, if, say, we wanted nice JSON serialisation and deserialisation the struct would have to be manually flattened. Maybe also a MakeUnnamedNamedSocket
of some sort, but naming is hard, so maybe use the builder pattern:
sa := SocketAddress{"localhost", 80};
nsa1 := BuildNamedSocketAddress().Name("internal"),SocketAddress(sa).Build();
nsa2 := BuildNamedSocketAddress().HostAndPort("localhost",80).Build();
But that might not be helping much with the syntactic noise.
Maybe just manually flatten it and potentially add a convenience member if required:
func (nsa NamedSocketAddress) AsSocketAddress() SocketAddress
Probably worth validating []NamedSocketAddress
for unique names.
But now that I think about it, perhaps a map[string]SocketAddress
is a more appropriate internal structure than []NamedSocketAddress
, but that makes serde a little more manual and verbose.
@0x5d has this moved passed the draft stage? |
9e697ba
to
3bafa42
Compare
I removed all the reviewers while I tidy things up a bit. |
3bafa42
to
90378ed
Compare
90378ed
to
efcfd33
Compare
Closing this to prevent spamming the participants. |
Redpanda supports 2 different structures for
redpanda.advertised_kafka_api
:and
However, rpk only recognized the 1st one. This change set adds support for both.
It also introduces config versioning. From here on, whenever there's a change in the config structure, a new config version schema will be declared, to which the config file contents can be marshalled unto. The new schema should implement
ToGeneric() (*Config, error)
, which should translate that schema to the "generic" one declared inconfig/schema.go
.Pending work:
redpanda.seed_servers
redpanda.kafka_api
redpanda.kafka_api
&redpanda.advertised_kafka_api
items.The above changes will be made in a follow-up PR, so that this one can be merged faster to unblock other work that depends on it.
Fix #524