-
Notifications
You must be signed in to change notification settings - Fork 489
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
[Merged by Bors] - feat: add support for cluster metadata #3628
[Merged by Bors] - feat: add support for cluster metadata #3628
Conversation
This just adds more noise. Instead add cluster type to config object so can avoid parsing error |
[cluster.my_favorite_cluster] |
then lets' add more properties as necessary. annotations doesn't buy anything except adding more friction and increase complexity |
if there are more properties to add, then it probably make sense to move profile as separate crate to make it more reusable |
There is a tradeoff between hard coded properties and annotations. One benefit of annotation is that there is less coupling between different versions later, and less maintenance updates. |
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.
Why not add this under the Profile
struct instead? It would be easier to match to a profile if it was at the Profile
level. Putting it at the FluvioConfig
level requires querying the cluster reference while iterating through profiles.
17b16ed
to
54f89c2
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.
Overall LGTM. minor nit
54f89c2
to
b3ffdac
Compare
What is the point of having |
This is similar to the approach cargo metadata: https://docs.rs/cargo_metadata/0.18.1/cargo_metadata/struct.Metadata.html. The whole point of annotation is to add opinionated config to config without adding more dep to the Fluvio crate. It's the same problem, even if this moves to a separate crate. Then, it is the responsibility of the reader/producer of annotation to ensure the config is correct. With serde |
1f401cd
to
2bf125d
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.
LGTM
bors r+ |
Add support for custom metadata in the cluster configuration. ```toml [cluster.my_favorite_cluster] endpoint = "127.0.0.1:9003" [cluster.my_favorite_cluster.metadata.installation] "fluvio.io/cluster-type" = "local-k8" ``` This will be important for other tasks, such as #3620. These changes are retrocompatible. Closes #3627
Build failed: |
the first attempt failed because of a socket timeout, trying again bors r+ |
Add support for custom metadata in the cluster configuration. ```toml [cluster.my_favorite_cluster] endpoint = "127.0.0.1:9003" [cluster.my_favorite_cluster.metadata.installation] "fluvio.io/cluster-type" = "local-k8" ``` This will be important for other tasks, such as #3620. These changes are retrocompatible. Closes #3627
Build failed: |
@sehz Imagine you need access to some metadata item from 3 different crates: you have to have |
@galibey I think this is a valid concern, what do you think if we add a way for querying metadata? I think it would look something like for example, consider the table below and a query to get [cluster.name.metadata.deep.nested]
key = "value" assert_eq!(cluster.query_metadata::<&str>("deep.nested[key]"), Some("value")); If we agree on this, it will target all your concerns to some extent:
some downsides:
|
@matheus-consoli Yes, that would work. I like the idea. |
We will also need a method for inserting a metadata entry. |
Let's not add more complexity to this API and more work. If some client wants to add strong typing, they can create a wrapper around it which at that point, can hide all dependency. I agree with @galibey, inserting and updating is needed. |
130e385
to
e8e7311
Compare
bors r+ |
Add support for custom metadata in the cluster configuration. ```toml [cluster.my_favorite_cluster] endpoint = "127.0.0.1:9003" [cluster.my_favorite_cluster.metadata.installation] "fluvio.io/cluster-type" = "local-k8" ``` This will be important for other tasks, such as #3620. These changes are retrocompatible. Closes #3627
Pull request successfully merged into master. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
where | ||
T: Deserialize<'de>, | ||
{ | ||
let mut metadata = self.metadata.as_ref().unwrap(); |
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.
This is not good. If there is no metadata, the querying here will shut my process.
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.
ohno, you're right, I missed that one!
This reverts commit b0f846d.
Add support for custom metadata in the cluster configuration.
This will be important for other tasks, such as #3620.
These changes are retrocompatible.
Closes #3627