-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from eurostat/sync/helm-chart
Synchronize Helm Chart version 0.2.0
- Loading branch information
Showing
20 changed files
with
3,614 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# To associate groups with the jwt provider use the API to: | ||
# 1. Create a policy for the group | ||
# 2. Create a group | ||
# 3. Associate alias that matches group in token | ||
# (pre-defined in the role cration) Use the groups_claim from the token in the role | ||
|
||
# With VAULT_TOKEN and VAULT_ADDR in environment variables given when calling this script | ||
|
||
# (pre-step, jwt acessor) 2. | ||
JWT_ACESSOR=$(curl --header "X-Vault-Token: $VAULT_TOKEN" $VAULT_ADDR/v1/sys/auth | jq -r '.["jwt/"].accessor') | ||
|
||
# Given a list of existing group ids (written the same way as in Keycloak) | ||
declare -a GROUP_LIST=("g1" "g2" "demo") | ||
|
||
for GROUP in "${GROUP_LIST[@]}" | ||
do | ||
|
||
# 1. | ||
tee payload-pol.json <<EOF | ||
{ | ||
"policy": "path \"onyxia-kv/projet-$GROUP/*\" {\n capabilities = [\"create\",\"update\",\"read\",\"delete\",\"list\"]\n}\n\n path \"onyxia-kv/data/projet-$GROUP/*\" {\n capabilities = [\"create\",\"update\",\"read\"]\n}\n\n path \"onyxia-kv/metadata/projet-$GROUP/*\" {\n capabilities = [\"delete\", \"list\", \"read\"]\n }" | ||
} | ||
EOF | ||
|
||
curl --header "X-Vault-Token: $VAULT_TOKEN" \ | ||
--request PUT \ | ||
--data @payload-pol.json \ | ||
$VAULT_ADDR/v1/sys/policies/acl/$GROUP | ||
|
||
rm payload-pol.json | ||
|
||
|
||
# 2. | ||
tee payload-grp.json <<EOF | ||
{ | ||
"name": "$GROUP", | ||
"policies": ["$GROUP"], | ||
"type": "external", | ||
"metadata": { | ||
"origin": "onyxia" | ||
} | ||
} | ||
EOF | ||
|
||
GROUP_ID=$(curl --header "X-Vault-Token: $VAULT_TOKEN" \ | ||
--request POST \ | ||
--data @payload-grp.json \ | ||
$VAULT_ADDR/v1/identity/group | jq -r ".data.id") | ||
|
||
rm payload-grp.json | ||
|
||
|
||
# 3. | ||
tee payload-grp-alias.json <<EOF | ||
{ | ||
"canonical_id": "$GROUP_ID", | ||
"mount_accessor": "$JWT_ACESSOR", | ||
"name": "$GROUP" | ||
} | ||
EOF | ||
|
||
curl --header "X-Vault-Token: $VAULT_TOKEN" \ | ||
--request POST \ | ||
--data @payload-grp-alias.json \ | ||
$VAULT_ADDR/v1/identity/group-alias | ||
|
||
rm payload-grp-alias.json | ||
|
||
done |
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: secret-basic-auth | ||
annotations: | ||
"helm.sh/hook": pre-install | ||
type: Opaque | ||
stringData: | ||
my_init_script.sh: | | ||
#!/bin/sh | ||
psql postgresql://postgres:{{.Values.postgresql.postgresqlPostgresPassword}}@localhost:5432/user << EOF | ||
CREATE DATABASE keycloak WITH ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8'; | ||
CREATE USER keycloak WITH ENCRYPTED PASSWORD 'keycloak'; | ||
GRANT ALL PRIVILEGES ON DATABASE keycloak TO keycloak; | ||
CREATE DATABASE ckan WITH ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8'; | ||
GRANT ALL PRIVILEGES ON DATABASE ckan TO postgres; | ||
CREATE DATABASE ckan_default WITH ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8'; | ||
CREATE USER ckan_default WITH ENCRYPTED PASSWORD 'ckan_default'; | ||
GRANT ALL PRIVILEGES ON DATABASE ckan_default TO ckan_default; | ||
CREATE DATABASE datastore_default WITH ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8'; | ||
CREATE USER datastorerw WITH ENCRYPTED PASSWORD 'datastorerw'; | ||
GRANT ALL PRIVILEGES ON DATABASE datastore_default TO datastorerw; | ||
CREATE DATABASE datastore_default WITH ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8'; | ||
CREATE USER datastorerw WITH ENCRYPTED PASSWORD 'datastorerw'; | ||
GRANT ALL PRIVILEGES ON DATABASE datastore_default TO datastorerw; | ||
EOF | ||
Oops, something went wrong.