@@ -212,28 +212,14 @@ jobs:
212212 run : |
213213 oc apply -f components/manifests/components/openshift-ai/namespace.yaml
214214 oc apply -f components/manifests/components/openshift-ai/operatorgroup.yaml
215- # Remove any existing subscription/CSV to ensure clean install on the target channel
216- OLD_CSV=$(oc get subscription rhods-operator -n redhat-ods-operator \
217- -o jsonpath='{.status.installedCSV}' 2>/dev/null || true)
218- if [ -n "$OLD_CSV" ]; then
219- DESIRED_CHANNEL=$(grep 'channel:' components/manifests/components/openshift-ai/subscription.yaml | awk '{print $2}')
220- CURRENT_CHANNEL=$(oc get subscription rhods-operator -n redhat-ods-operator \
221- -o jsonpath='{.spec.channel}' 2>/dev/null || true)
222- if [ "$CURRENT_CHANNEL" != "$DESIRED_CHANNEL" ]; then
223- echo "Channel mismatch ($CURRENT_CHANNEL → $DESIRED_CHANNEL), removing old operator..."
224- oc delete subscription rhods-operator -n redhat-ods-operator --ignore-not-found
225- oc delete csv "$OLD_CSV" -n redhat-ods-operator --ignore-not-found
226- fi
227- fi
228215 oc apply -f components/manifests/components/openshift-ai/subscription.yaml
229216
230217 - name : Wait for RHOAI operator to be ready
231218 run : |
232- DESIRED_CHANNEL=$(grep 'channel:' components/manifests/components/openshift-ai/subscription.yaml | awk '{print $2}')
233- echo "Waiting for RHOAI operator CSV on channel $DESIRED_CHANNEL..."
219+ echo "Waiting for RHOAI operator CSV to appear..."
234220 for i in $(seq 1 60); do
235221 CSV=$(oc get subscription rhods-operator -n redhat-ods-operator \
236- -o jsonpath='{.status.currentCSV }' 2>/dev/null)
222+ -o jsonpath='{.status.installedCSV }' 2>/dev/null)
237223 if [ -n "$CSV" ]; then
238224 echo "Found CSV: $CSV"
239225 break
@@ -294,13 +280,20 @@ jobs:
294280 || oc exec -n ambient-code deploy/postgresql -- \
295281 psql -U postgres -c "CREATE DATABASE mlflow"
296282
297- - name : Verify mlflow-db-credentials secret exists
283+ - name : Ensure mlflow-db-credentials secret exists
298284 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
285+ if oc get secret mlflow-db-credentials -n redhat-ods-applications &>/dev/null; then
286+ echo "Secret already exists"
287+ else
288+ echo "Creating mlflow-db-credentials from postgresql-credentials..."
289+ DB_USER=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.user}' | base64 -d)
290+ DB_PASS=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.password}' | base64 -d)
291+ DB_HOST=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.host}' | base64 -d)
292+ DB_PORT=$(oc get secret postgresql-credentials -n ambient-code -o jsonpath='{.data.db\.port}' | base64 -d)
293+ oc create namespace redhat-ods-applications --dry-run=client -o yaml | oc apply -f -
294+ oc create secret generic mlflow-db-credentials \
295+ -n redhat-ods-applications \
296+ --from-literal=uri="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}.ambient-code.svc.cluster.local:${DB_PORT}/mlflow?sslmode=disable"
304297 fi
305298
306299 - name : Deploy MLflow instance
0 commit comments