Skip to content

Commit

Permalink
0.27.4: embed secret fetching script explicitly to configmap
Browse files Browse the repository at this point in the history
  • Loading branch information
zaychenko-sergei committed Jul 1, 2024
1 parent f8f58d5 commit e6f23a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion charts/kamu-api-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: kamu-api-server
description: API server component of the Kamu Compute Node
type: application
version: 0.27.3
version: 0.27.4
appVersion: "0.27.1"
home: https://kamu.dev
icon: https://www.kamu.dev/images/kamu_logo_icon_bg_square.png
Expand Down
20 changes: 0 additions & 20 deletions charts/kamu-api-server/fetch_db_secret.sh

This file was deleted.

21 changes: 20 additions & 1 deletion charts/kamu-api-server/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,23 @@ metadata:
data:
{{- include "kamu-api-server.config.yaml" . | nindent 2 }}
fetch-db-secret.sh: |
{{ .Files.Get "fetch_db_secret.sh" | nindent 4}}
#!/bin/bash
if [ $# -ne 5 ]; then
echo "Usage: $0 <secret-name> <region> <db-host> <db-port> <db-name>"
exit 1
fi
SECRET_NAME="$1"
REGION="$2"
DB_HOST="$3"
DB_PORT="$4"
DB_NAME="$5"
SECRET_STRING=$(aws secretsmanager get-secret-value --secret-id $SECRET_NAME --region $REGION --query SecretString --output text)
USERNAME=$(echo $SECRET_STRING | jq -r .username)
PASSWORD=$(echo $SECRET_STRING | jq -r .password)
export DB_CONNECTION_STRING="postgresql://${USERNAME}:${PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
exec "$@"

0 comments on commit e6f23a7

Please sign in to comment.