-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add support for Contexts #271
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.
Great to see these different auth settings part of the same context, it provides a sense of order. The commands to configure a context is something that could be a page on Grafana Cloud, just copy paste and ready to go!
Perhaps also worth bringing this up with the auth team, this might be a feature they could own eventually.
All this does is brings together the way it is done now. There is a conversation to be had with them about whether we can reduce the number of auth settings at all. |
> **NOTE**: If you have used Grizzly previously with environment variables, you can | ||
initialise the `default` context from your environment simply with `grr config import`. |
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.
So, Grizzly does not work without using that command first? Isn't that a breaking change?
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.
No, envvars override contexts. So this is a way to transfer your envvars. What we need to document is that you then need to unset your envvars otherwise they will continue to override.
@@ -11,22 +11,12 @@ import ( | |||
) | |||
|
|||
func TestDashboard(t *testing.T) { |
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.
Do we have any tests that run the actual grr commands? I feel like these tests are slightly short of testing the whole thing and it'd actually be more useful (full integration test) and easier to call the grr
commands to do the work
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.
Yeah, would be great. We have a grafana instance started already. With the openapi client we can validate results. Perhaps this wouldn't be that hard to do actually.
viper.BindEnv("overrides.mimir.address", "CORTEX_ADDRESS") | ||
viper.BindEnv("overrides.mimir.tenant-id", "CORTEX_TENANT_ID") | ||
viper.BindEnv("overrides.mimir.api-key", "CORTEX_API_KEY") |
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.
For a next PR, we could support MIMIR_
envvars and fallback to CORTEX_
ones
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.
Well, switch to calling out to mimirtool, which didn't exist when this integration was made. Then we could allow both CORTEX_ and MIMIR_ evvars, for back compat.
Co-authored-by: Julien Duchesne <[email protected]>
At present, Grizzly is configured through envvars. This is great for CI setups (e.g 12 factor apps), and perhaps if you only interact with a single backend. However, as soon as you have more than one backend, it becomes painful.
This PR adds support for "contexts", modelled after
kubectl
. Each context contains a full set of settings/credentials. Switching between them becomes trivial.