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

Add config options to manage variables expansion #1212

Merged
merged 9 commits into from
Jan 12, 2022

Conversation

irizzant
Copy link
Contributor

@irizzant irizzant commented Jan 7, 2022

What this PR does:
This PR adds support for specifying config options to manage variables expansion in a single point.

For example, to enable S3 storage backend simply add the following to the _config object:

...
local envVar = k.core.v1.envVar,
...
variables_expansion: true,
variables_expansion_env_mixin: [
          envVar.withName('S3_ACCESS_KEY')
          + envVar.valueFrom.secretKeyRef.withKey('S3_ACCESS_KEY')
          + envVar.valueFrom.secretKeyRef.withName('minio-secret'),
          envVar.withName('S3_SECRET_KEY')
          + envVar.valueFrom.secretKeyRef.withKey('S3_SECRET_KEY')
          + envVar.valueFrom.secretKeyRef.withName('minio-secret'),
        ],

where S3_ACCESS_KEY and S3_SECRET_KEY are taken for a secret named minio-secret.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@irizzant irizzant changed the title Config variables Add config options to manage variables expansion Jan 7, 2022
Signed-off-by: irizzant <[email protected]>

# Conflicts:
#	example/tk/jsonnetfile.lock.json
@irizzant irizzant marked this pull request as ready for review January 10, 2022 07:25
Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

nice addition. just asking for some minor cleanup to the changelog.

CHANGELOG.md Outdated Show resolved Hide resolved
@joe-elliott
Copy link
Member

@irizzant CI was broken in main. If you could rebase/merge main CI should pass and we can get this merged.

@irizzant
Copy link
Contributor Author

@joe-elliott that makes sense...I updated the branch as you suggested it should be ok then

Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

Nice. Thanks for the contribution!

@joe-elliott joe-elliott merged commit 9a89b86 into grafana:main Jan 12, 2022
@irizzant irizzant deleted the config_variables branch January 12, 2022 20:26
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.

2 participants