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

parameterize azure PG config and use psql-client container to connect #790

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geoberle
Copy link
Collaborator

@geoberle geoberle commented Oct 30, 2024

What this PR does

  • installing the psql client tool locally brings a log of dependencies on most systems. by using a container we avoid having to install too many things on developer machines
  • this PR also cleans up "current user connect" as this was never working anyways
  • parameterize all fields required for CS and Maestro DB setup so we can have consistency between infra RBAC deployment, service deployment and DB deployment

Jira:
Link to demo recording:

Special notes for your reviewer

--env PGUSER \
--env PGPASSWORD \
postgres psql \
-d clusters-service -p 5432
Copy link
Collaborator

Choose a reason for hiding this comment

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

Depending on how the CS DB is deployed in theory the DB name might be a different one so we might want this configurable with a default. Not a blocker of course, just raising this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'll wait until #763 is merged, then we can draw the actual DB name value from the config

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all CS and maestro settings around DB, namespace, service account and MI have now been parameterized

@miguelsorianod
Copy link
Collaborator

It looks good to me

@@ -7,7 +7,7 @@ NAMESPACE=$4
SA_NAME=$5

# prep creds and configs
PGHOST=$(az postgres flexible-server list --resource-group ${RESOURCEGROUP} --query "[?starts_with(name, '${DB_SERVER_NAME_PREFIX}')].fullyQualifiedDomainName" -o tsv)
export PGHOST=$(az postgres flexible-server list --resource-group ${RESOURCEGROUP} --query "[?starts_with(name, '${DB_SERVER_NAME_PREFIX}')].fullyQualifiedDomainName" -o tsv)
AZURE_TENANT_ID=$(az account show -o json | jq .homeTenantId -r)
AZURE_CLIENT_ID=$(az identity show -g ${RESOURCEGROUP} -n ${MANAGED_IDENTITY_NAME} --query clientId -o tsv)
SA_TOKEN=$(kubectl create token ${SA_NAME} --namespace=${NAMESPACE} --audience api://AzureADTokenExchange)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make the expiration of this token short-lived? I.e. 24 hrs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • the default SA token on AKS expires in 1h, i made it explicit though
  • for az account get-access-token there is no way to set the expiration - it defaults to 24h

Copy link

github-actions bot commented Nov 1, 2024

Please rebase pull request.

@geoberle geoberle changed the title use psql container to connect to azure postgres db parameterize azure PG config and use psql-client container to connect Nov 3, 2024
Copy link

github-actions bot commented Nov 4, 2024

Please rebase pull request.

* installing the psql client tool locally brings a log of dependencies on most systems. by using a container we avoid having to install too many things on developer machines
* parameterize all fields required for CS and Maestro DB setup so we can have consistency between infra RBAC deployment, service deployment and DB deployment

Signed-off-by: Gerd Oberlechner <[email protected]>
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.

3 participants