Feature/influxdb non admin token - #153
Draft
Plesoun wants to merge 4 commits into
Draft
Conversation
eliska-n
requested changes
Nov 1, 2024
| done | ||
|
|
||
| # Get the bucket ID | ||
| BUCKET_ID=$(curl -s -X GET http://{{INFLUXDB_HOSTNAME}}:8086/api/v2/buckets -H 'Authorization: Token "{{INFLUXDB_TOKEN}}"' -H "Accept: application/json" | jq -r '.buckets[] | select(.name=="{{DOCKER_INFLUXDB_INIT_BUCKET}}") | .id') |
Collaborator
There was a problem hiding this comment.
Even though we create just one bucket, there can be multiple in the influx in the end if created manually by the user.
| USER_ID=$(curl -s -X GET http://{{INFLUXDB_HOSTNAME}}:8086/api/v2/users -H 'Authorization: Token "{{INFLUXDB_TOKEN}}"' -H "Accept: application/json" | jq -r '.users[] | select(.name=="{{DOCKER_INFLUXDB_INIT_USERNAME}}") | .id') | ||
|
|
||
| # Create the non-admin token using the InfluxDB API v2 | ||
| curl -X POST http://{{INFLUXDB_HOSTNAME}}:8086/api/v2/authorizations \ |
Collaborator
There was a problem hiding this comment.
we need to get the token itself and send it to vault.
Collaborator
There was a problem hiding this comment.
even if you manage to send the token into vault, I don't know how to effectively distribute it.
but I can probably somehow solve this in the influxdb tech.
| - rewrite ^/influxdb/(.*) /$1 break | ||
| - proxy_pass http://upstream-influxdb | ||
|
|
||
| sherpas: |
Collaborator
There was a problem hiding this comment.
sherpa runs with every UP. so it must be restartable without breaking antyhing or creating bambilion of new tokens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is about generating a non admin token for the services to use. I am kind of lost what variables I can use, but I think I may have found them (needs to be checked). Also, there is one thing remaining, how do I pass on the generated token to be used. The output of the script looks like this:
{
"id":"0dd2e35923eb7000",
"token":"t4ZRXhJqhNoqA0R7Z6Fz5X_tkvgzEXfreoZUpMwp801M31b31M7xg10tYpmD1CDO4pZuWxR9b3G0p_BpMSMy5Q==",
"status":"active",
"description":"Non-admin user with write access",
"orgID":"29ecabe6fff1d77b",
"org":"myorg",
"userID":"0dd2e0e2c641d000",
"user":"myuser",
"permissions":[
{
"action":"write",
"resource":{
"type":"buckets",
"id":"890ceddae8caa7af",
"name":"mybucket"
}
}
],
"links":{
"self":"/api/v2/authorizations/0dd2e35923eb7000",
"user":"/api/v2/users/0dd2e0e2c641d000"
},
"createdAt":"2024-10-17T17:39:18.799029086Z",
"updatedAt":"2024-10-17T17:39:18.799029086Z"
}
I will neet to extract the token somehow.