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

Set datasource spec.name to metadata.name #182

Closed
wants to merge 1 commit into from

Conversation

tenstad
Copy link
Contributor

@tenstad tenstad commented Oct 19, 2021

Closes #181

Resolves the following error when doing grr apply grr.jsonnet in the example folder:
Non-200 response from Grafana while applying datasource prometheus: 422 Unprocessable Entity [{"fieldNames":["Name"],"classification":"RequiredError","message":"Required"}]

spec.name seems to be a required datasource field. I think it makes sense to copy the name from metadata, as done with spec.uid.

@malcolmholmes
Copy link
Collaborator

Actually, the right way to do this, that we should switch all resource types to follow, is to throw a (clear) error when the metadata/name and spec/uid (etc) do not match.

How does this sound? Fancy doing it?

@tenstad
Copy link
Contributor Author

tenstad commented Oct 21, 2021

Not sure if I follow. spec/uid is currently derived from metadata/name, and they thus match.

Should both spec/name and spec/uid be defind by the user, rather than derived from metadata/name? Additionaly, metadata/name and spec/uid must match?

@tenstad
Copy link
Contributor Author

tenstad commented Oct 21, 2021

I can agree that this might not be the best solution, since the metadata/name in k8s (format inspiration) is more restrictive than Grafana's datasource name. I therefore think the example should be updated instead, adding the spec/name field.

@tenstad tenstad closed this Oct 21, 2021
@seb-lean
Copy link

seb-lean commented Dec 6, 2022

what is the resolution for users? How do we avoid this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Field "Name" missing when applying datasource
3 participants