Skip to content
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

Plugins: Add apiserver info to settings when it exists #88041

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ryantxu
Copy link
Member

@ryantxu ryantxu commented May 20, 2024

This replaces #87639

This updates the settings model so it is more clearly a indication of where the apiserver is running with which versions:
image

@ryantxu ryantxu added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels May 20, 2024
@ryantxu ryantxu requested a review from andresmgot May 20, 2024 08:58
@ryantxu ryantxu requested review from a team as code owners May 20, 2024 08:58
@grafana-delivery-bot grafana-delivery-bot bot added this to the 11.1.x milestone May 20, 2024
@@ -28,7 +28,7 @@ type PluginSetting struct {
SignatureType plugins.SignatureType `json:"signatureType"`
SignatureOrg string `json:"signatureOrg"`
AngularDetected bool `json:"angularDetected"`
APIVersion string `json:"apiVersion"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the backend is not a single apiVersion -- it may have a few and a preferred version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simplify this just using the preferredVersion here? In which case the frontend would be interested in knowing all the versions the backend supports?

Also, why duplicating this information? This is currently available in the endpoing /apis for the datasource backend endpoint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replied already here: #87639 (comment)

Not sure if the frontend needs to handle this complexity (multiple api versions) but it's syntactically correct so if we want to move forward with this it can be okay

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we can keep this out of the plugins DTO entirely -- I want to make sure we do not read it to mean more than it does. The issue I have with the simplified version is that it encourages thinking about frontend+backend as one deployment rather than two things: client and server

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to have something here if we want to set the value in queries / configs. The frontend will use the preferredVersion anyway and use it if we add the whole api server info. I don't see a use case for the fronted to use the rest of the information so why adding it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need to move this forward? Agreement on either only including preferred version or plus api group and versions?

Given this is new/experimental can we start with just adding what we actually need right now and iterate figuring out the rest? As long as we don't officially support any new api response field we can add/remove/change how many times we want/need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand from this comment: #87961 (comment) we may want to just remove the apiVersion from the /api/* endpoints and leave it for the new ones under /apis/* 🤷

@ryantxu
Copy link
Member Author

ryantxu commented May 20, 2024

@andresmgot -- See #87639 (comment) -- that thread got lost when I made a new PR here.

@ryantxu ryantxu requested a review from a team as a code owner May 20, 2024 09:47
@@ -28,7 +28,7 @@ type PluginSetting struct {
SignatureType plugins.SignatureType `json:"signatureType"`
SignatureOrg string `json:"signatureOrg"`
AngularDetected bool `json:"angularDetected"`
APIVersion string `json:"apiVersion"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simplify this just using the preferredVersion here? In which case the frontend would be interested in knowing all the versions the backend supports?

Also, why duplicating this information? This is currently available in the endpoing /apis for the datasource backend endpoint.

@@ -224,7 +227,9 @@ func (b *DataSourceAPIBuilder) getPluginContext(ctx context.Context, uid string)
if err != nil {
return backend.PluginContext{}, err
}
return b.contextProvider.PluginContextForDataSource(ctx, instance)
pctx, err := b.contextProvider.PluginContextForDataSource(ctx, instance)
pctx.APIVersion = b.connectionResourceInfo.APIVersion()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be in a different PR? It's unrelated to having apiserver info in the plugin DTO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 -- i can split it out soon, already a few too many open PRs for hte same topic 🤣

@marefr marefr self-requested a review May 20, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants