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
APIVersion: Add API Version to protobuf #911
Conversation
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 this makes sense 👍 But have you thought about how this relates to the plugin.json version, and how/where we might map them?
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
|
||
// The API version when the settings were saved. | ||
// NOTE: this may be an older version than the current apiVersion | ||
string apiVersion = 12; |
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.
@wbrowne -- I updated this so we can now send the apiVersion when the plugin was saved. This can be something older than what people are currently running
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.
Make sense to support passing the API version on each request, but would like some more context around ManagedOpts.APIVersion
(see comment)
backend/app/manage.go
Outdated
// ApiVersion is the required ApiVersion -- setting this will | ||
// fail any request asking for a different version. For multi-version servers, | ||
// this value should not be set, and be handled directly in each server | ||
APIVersion string |
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 shouldn't the SDK support multi-version and/or why would you want to populate this? Hard to understand without seeing the full picture.
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.
Good question -- I'll remove this config and make the api-management entirely up to the handler.
Also wondering - currently the runtime config param tells us what version of the API we want to run. But if we're loading a plugin as we traditionally do, we would want to know what it reports itself in order to validate, right? |
FTR, I am taking a look at this and the discussion in grafana/grafana#76419. I'll try to gather the proposal and feedback and write a small design doc so we can agree. Hope that makes sense! |
This change will propagate thought many things -- I'm not sure the best approach here, but these are a few exploration branches: |
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.
Nice! Just a few nits
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 a first step (before adding the API version to protobuf), would be to decide what would be the origin (source of truth) for this API version. Would that be the plugin.json or another schema somewhere?
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
Don't think it's a blocker for merging this given it's not in use and currently we only have v0alpha1 for the foreseeable future so we can default to this to begin with if we want to start populating/forward this? Feels like your question is related to how plugins can return openapi schemas per api version as well, i.e. resources. Something @ryantxu has been talking about earlier. So maybe this needs some additional discussions/design doc? |
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
…dk-go into add-api-version
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
…dk-go into add-api-version
Yes, that's my point. It will be dead code at the moment but 🤷
Yes, ideally a schema file with the query / settings definition would be the best but we kind of lost the progress there. We could temporarily use the plugin.json to specify that. |
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.
Code LGTM, we can merge even if it's not in use
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.
🚀
In an effort to limit the number of supported backend versions, we will want to specify what apiVersion we want, and what we are running. This PR adds apiVersion to the protobuf and startup arguments so it can throw an error when there is a mismatch.
When versions are not set, there is no added verification