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 the ability to get config remotely #805

Merged
merged 12 commits into from
Oct 29, 2024
Merged

Add the ability to get config remotely #805

merged 12 commits into from
Oct 29, 2024

Conversation

petewall
Copy link
Collaborator

@petewall petewall commented Oct 16, 2024

Notes to reviewers:
The only files I'd like you to review are:

So much of the rest are just:

  • Refactoring secret handling to work for things other than destinations
  • Adding the concept of "platform tests" which are special integration tests that utilize external dependencies like Grafana Cloud.

@petewall petewall self-assigned this Oct 16, 2024
@petewall petewall linked an issue Oct 16, 2024 that may be closed by this pull request
@petewall petewall force-pushed the feat/remote-config branch 2 times, most recently from ca27d88 to 880032f Compare October 23, 2024 09:16
@petewall petewall marked this pull request as ready for review October 29, 2024 00:37
Not working because the secret management templates are tied specifically to destinations

Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Signed-off-by: Pete Wall <pete.wall@grafana.com>
Comment on lines +237 to +240
usernameKey: "username"
# -- Raw config for accessing the password.
# @section -- Collectors - Alloy Metrics
usernameFrom: ""
Copy link
Member

Choose a reason for hiding this comment

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

Do these get used somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, because this line:

username = {{ include "secrets.read" (dict "object" . "key" "auth.username" "nonsensitive" true) }}

Actually does a ton.

If your values are:

auth: { username = "myuser" }

Then, this will create a K8s secret, with username: myuser and then the alloy config references that secret.

If your values are:

auth: { username = "myuser" }
secret: { embed = true }

Then the string "myuser" is set in the alloy config and no secret is created.

Finally, if your values are:

auth: { usernameFrom = env("MY_USERAME") }

Then it injects the raw string env("MY_USERAME") as the value for the username.

All of this is handled by the template functions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's not even mentioning these values:

auth: { usernameKey = "user" }
secret: { create = false, name = mysecret }

Which then references another pre-created secret with a custom key in that secret.

@petewall petewall merged commit 0e4f3f5 into main Oct 29, 2024
23 checks passed
@petewall petewall deleted the feat/remote-config branch October 29, 2024 18:41
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.

Add the ability to deploy a remotecfg block
2 participants