File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments