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

[Bug] get version does not work with Azure Managed Grafana #1569

Closed
arminfelder opened this issue Jun 5, 2024 · 8 comments · Fixed by #1583
Closed

[Bug] get version does not work with Azure Managed Grafana #1569

arminfelder opened this issue Jun 5, 2024 · 8 comments · Fixed by #1583
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@arminfelder
Copy link

Describe the bug

The Grafana Operator tries to get the version of the external Grafana instance from its /api/health endpoint, unfortunatly this does not work wit Azure Managed Grafana, as in this case, all endpoints, including the /api/health require authentication.

Secondly the Grafana Operator, seams not to check the HTTP status code (in my case 403) , but only if the request is successful.

Log:

2024-06-05T17:20:23Z    ERROR   GrafanaReconciler       failed to get version from external instance    {"controller": "grafana", "controllerGroup": "grafana.integreatly.org", "controllerKind": "Grafana", "Grafana": {"name":"external-grafana","namespace":"grafana-operator"}, "namespace": "grafana-operator", "name": "external-grafana", "reconcileID": "79f3e706-0b32-4053-bdac-952e33464692", "error": "parsing health endpoint data: EOF"}
github.com/grafana/grafana-operator/v5/controllers.(*GrafanaReconciler).Reconcile
        github.com/grafana/grafana-operator/v5/controllers/grafana_controller.go:95
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
        sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:114
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
        sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:311
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
        sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:261
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
        sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:222

Version
5.9.2
To Reproduce

configure Azure Managed Grafana as external Grafana

Expected behavior
A clear and concise description of what you expected to happen.

Suspect component/Location where the bug might be occurring

Runtime (please complete the following information):

  • OS: Linux
  • Grafana Operator Version 5.9.2
  • Environment: Azure Kubernetes Cluster
  • Deployment type: kustomize
@arminfelder arminfelder added bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 5, 2024
@arminfelder arminfelder changed the title [Bug] get version does not work with Azure managed Grafana [Bug] get version does not work with Azure Managed Grafana Jun 5, 2024
@theSuess theSuess added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 10, 2024
@theSuess
Copy link
Member

@weisdd will check how authentication for this endpoint is implemented and we'll decide what to do from there

@weisdd
Copy link
Collaborator

weisdd commented Jun 11, 2024

@theSuess The health endpoint can be accessed using the same API key as for managing grafana instance:

image

So, I think the fix would be to simply use the same client as in various controllers.

@weisdd weisdd added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Jun 11, 2024
@arminfelder
Copy link
Author

@theSuess The health endpoint can be accessed using the same API key as for managing grafana instance:
image

So, I think the fix would be to simply use the same client as in various controllers.

this was also me thought, after debugging with curl, but I did not want to mess up your code

@DanielAtanasovski
Copy link

Getting a similar issue with AWS Managed Grafana on Version 5.9.2:

2024-06-13T04:33:13Z	ERROR	GrafanaReconciler	failed to get version from external instance	{"controller": "grafana", "controllerGroup": "grafana.integreatly.org", "controllerKind": "Grafana", "Grafana": {"name":"grafana-workspace","namespace":"grafana"}, "namespace": "grafana", "name": "grafana-workspace", "reconcileID": "e3efad02-5a15-4bc8-a527-2f30cc480e7b", "error": "parsing health endpoint data: invalid character 'B' looking for beginning of value"}
github.com/grafana/grafana-operator/v5/controllers.(*GrafanaReconciler).Reconcile
	github.com/grafana/grafana-operator/v5/controllers/grafana_controller.go:95
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
	sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:114
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:311
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:261
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	sigs.k8s.io/controller-runtime@v0.18.3/pkg/internal/controller/controller.go:222

@weisdd
Copy link
Collaborator

weisdd commented Jun 13, 2024

@DanielAtanasovski I don't have an AWS environment at hand, so could you send an authenticated request (using the same credentials that you supply to the operator) to that endpoint and post the result here?

@bonclay7
Copy link

Is there a possibility to avoid that api endpoint by specifying the grafana version in configs?

@DanielAtanasovski
Copy link

@DanielAtanasovski I don't have an AWS environment at hand, so could you send an authenticated request (using the same credentials that you supply to the operator) to that endpoint and post the result here?

It might be worse with AWS as the api/health endpoint appears to be blocked. An authenticated request just responds with Bad Request: Not allowed.

Related to this issue:
aws/amazon-managed-grafana-roadmap#41

@VermaPriyanka
Copy link

@DanielAtanasovski Amazon Managed grafana supports this API endpoint: https://grafana.com/docs/grafana/latest/developers/http_api/other/#frontend-settings-api. Can this be used alternatively to get the version?

theSuess added a commit that referenced this issue Jun 17, 2024
This changes the version detection logic to use the frontend settings endpoint
as it is more reliable, especially on cloud provider offerings.

Fixes #1569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants