-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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 managed instance installation resources #76767
Conversation
pkg/plugins/config/config.go
Outdated
StackID string | ||
InstallToken string | ||
ExternalManageEnabled bool |
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 may be possible to get away without adding these to this config - we try to reserve this struct for core internal configuration where possible - so I think we can just inject *setting.Cfg
where we want this info instead. WDYT?
# Auth token for plugin installations and removal in managed instances | ||
install_token = |
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.
can you verify if is it okay to put a token in configuration? Maybe we have a better place for this?
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.
That is how gcom provide tokens to the instances and that's how the feature toggles admin are doing:
https://github.com/grafana/hosted-grafana/blob/main/pkg/hgapi/instance/config_ini.go#L491-L495
https://github.com/grafana/grafana/blob/main/conf/defaults.ini#L1707
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!
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!
@@ -204,6 +204,7 @@ type FakePluginRepo struct { | |||
GetPluginArchiveFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchive, error) | |||
GetPluginArchiveByURLFunc func(_ context.Context, archiveURL string, _ repo.CompatOpts) (*repo.PluginArchive, error) | |||
GetPluginArchiveInfoFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchiveInfo, error) | |||
PluginVersionFunc func(pluginID, version string, compatOpts repo.CompatOpts) (repo.VersionData, error) |
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.
Nit: Would be good to have context.Context
here but you can save that a follow up if you prefer
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 prefer to make it in a follow up request. PluginVersionFunc
is a mock of PluginVersion
and PluginVersion is just a the old pluginVersion
exported to reuse some code.
pkg/plugins/httpclient.go
Outdated
"time" | ||
) | ||
|
||
func MakeHttpClient(skipTLSVerify bool, timeout time.Duration) http.Client { |
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 you could probably have this one in the repo
package. WDYT?
ef9af1c
to
75293f6
Compare
@wbrowne all fixed, could you check it again? |
75293f6
to
2d8af72
Compare
What is this feature?
This PR adds the necessary changes to create a new plugin installer for plugins running in managed instance:
Why do we need this feature?
This work is necessary to create a manage plugin installer, which is an alternative implementation of
plugins.Installer
interface and will allow plugins to be installed in a managed instance without being redirected to gcom.Who is this feature for?
Grafana developers
Which issue(s) does this PR fix?:
This is part of https://github.com/grafana/grafana-plugins-platform-team/issues/28
Special notes for your reviewer:
The corresponding enterprise PR: https://github.com/grafana/grafana-enterprise/pull/5915
Please check that: