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

[grafana] correct array formatting for grafana.ini #3352

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

nathwill
Copy link
Contributor

fixes array format in configmap grafana.ini.

previously produced: org_mapping = ["a" "b" "c"], which grafana did not apply correctly
now produces: org_mapping = ["a", "b", "c"], which grafana applies correctly

of note:
for some reason this only seems to work when applied as TOML style array lists ["a", "b", "c"], even though the file type is nominally ini, which would suggest the following would actually be appropriate:

org_mapping[] = "a"
org_mapping[] = "b"
org_mapping[] = "c"

🤷

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2024

CLA assistant check
All committers have signed the CLA.

@jkroepke
Copy link
Collaborator

Could you link documentation, where array style is used?

for org_mapping, I can only find a space separated string:

org_mapping = org_foo:org_foo:Viewer org_bar:org_bar:Editor *:org_baz:Editor

@nathwill
Copy link
Contributor Author

@jkroepke yeah this was documented here: https://grafana.com/docs/grafana/latest/setup-grafana/configure-security/configure-authentication/okta/#org-roles-mapping-example and seems to work that way... the helm chart currently is doing space-separated but inside square brackets, so not even the way you described either

@jkroepke
Copy link
Collaborator

but with the join method, it will result into:

org_mapping = [a,b,c]

not

org_mapping = ["a","b","c"]

@nathwill
Copy link
Contributor Author

yeah, string-wrapping is optional as it's written and afaik only required when spaces are involved (?)... if we want to enforce string-wrapping i can update the PR accordingly, just wanted to only do the minimal needed so it could be made to work via values...

in our patched version of the chart we're passing values in like this:

    org_mapping:
    - '"SRE:1:Admin"'
    - '"Support:1:Editor"'
    - '"Data Scientists:1:Editor"'
    - '"Developers:1:Editor"'

which produces

org_mapping = ["SRE:1:Admin", "Support:1:Editor", "Data Scientists:1:Editor", "Developers:1:Editor"]

@jkroepke
Copy link
Collaborator

jkroepke commented Oct 11, 2024

instead join, consider using toJson and take not of CI failures

@nathwill
Copy link
Contributor Author

cool, i like it.

@nathwill nathwill changed the title correct array formatting [grafana] correct array formatting for grafana.ini Oct 11, 2024
Copy link
Collaborator

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

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

For conistancy reasons, could you has this to the config section (15 lines above) as well?

@zanhsieh zanhsieh merged commit 9c9d071 into grafana:main Oct 17, 2024
6 checks passed
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.

4 participants