Skip to content

Commit b581ccc

Browse files
Ambient Code Botclaude
andcommitted
fix: auto-create mlflow-db-credentials from existing postgresql-credentials
Instead of failing when the mlflow-db-credentials secret is missing, construct it from the existing postgresql-credentials secret in the ambient-code namespace. This avoids requiring manual secret setup on each cluster. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd502bd commit b581ccc

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

.github/workflows/components-build-deploy.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,20 @@ jobs:
294294
|| oc exec -n ambient-code deploy/postgresql -- \
295295
psql -U postgres -c "CREATE DATABASE mlflow"
296296
297-
- name: Verify mlflow-db-credentials secret exists
297+
- name: Ensure mlflow-db-credentials secret exists
298298
run: |
299-
if ! oc get secret mlflow-db-credentials -n redhat-ods-applications &>/dev/null; then
300-
echo "::error::Secret mlflow-db-credentials not found in redhat-ods-applications."
301-
echo "::error::Create it before applying the MLflow resource."
302-
echo "::error::See components/manifests/base/mlflow-db-credentials-secret.yaml.example"
303-
exit 1
299+
if oc get secret mlflow-db-credentials -n redhat-ods-applications &>/dev/null; then
300+
echo "Secret already exists"
301+
else
302+
echo "Creating mlflow-db-credentials from postgresql-credentials..."
303+
DB_USER=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.user}' | base64 -d)
304+
DB_PASS=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.password}' | base64 -d)
305+
DB_HOST=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.host}' | base64 -d)
306+
DB_PORT=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.port}' | base64 -d)
307+
oc create namespace redhat-ods-applications --dry-run=client -o yaml | oc apply -f -
308+
oc create secret generic mlflow-db-credentials \
309+
-n redhat-ods-applications \
310+
--from-literal=uri="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}.ambient-code.svc.cluster.local:${DB_PORT}/mlflow?sslmode=disable"
304311
fi
305312
306313
- name: Deploy MLflow instance

.github/workflows/prod-release-deploy.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,20 @@ jobs:
433433
|| oc exec -n ambient-code deploy/postgresql -- \
434434
psql -U postgres -c "CREATE DATABASE mlflow"
435435
436-
- name: Verify mlflow-db-credentials secret exists
436+
- name: Ensure mlflow-db-credentials secret exists
437437
run: |
438-
if ! oc get secret mlflow-db-credentials -n redhat-ods-applications &>/dev/null; then
439-
echo "::error::Secret mlflow-db-credentials not found in redhat-ods-applications."
440-
echo "::error::Create it before applying the MLflow resource."
441-
echo "::error::See components/manifests/base/mlflow-db-credentials-secret.yaml.example"
442-
exit 1
438+
if oc get secret mlflow-db-credentials -n redhat-ods-applications &>/dev/null; then
439+
echo "Secret already exists"
440+
else
441+
echo "Creating mlflow-db-credentials from postgresql-credentials..."
442+
DB_USER=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.user}' | base64 -d)
443+
DB_PASS=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.password}' | base64 -d)
444+
DB_HOST=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.host}' | base64 -d)
445+
DB_PORT=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.port}' | base64 -d)
446+
oc create namespace redhat-ods-applications --dry-run=client -o yaml | oc apply -f -
447+
oc create secret generic mlflow-db-credentials \
448+
-n redhat-ods-applications \
449+
--from-literal=uri="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}.ambient-code.svc.cluster.local:${DB_PORT}/mlflow?sslmode=disable"
443450
fi
444451
445452
- name: Deploy MLflow instance

0 commit comments

Comments
 (0)