fix(serving): wire MLflow auth and Host header for container-to-container calls

- Pass MLFLOW_ADMIN_PASSWORD as fallback password credential
- Set host_header='localhost' to satisfy MLflow's --allowed-hosts check
  (MLflow rejects Host: mlflow but accepts Host: localhost)
- Default MLFLOW_TRACKING_URI to http://mlflow:5000 in compose so the
  env_file value is not silently overridden to empty

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 10:39:08 +00:00
parent c43dbaf23d
commit 95e1b342b4
2 changed files with 10 additions and 2 deletions

View File

@@ -87,7 +87,15 @@ STATE_DIR = Path(os.getenv("STATE_DIR", "/tmp/oo-serving-state"))
# is logged at WARNING and never propagates to the caller.
_MLFLOW_URI = os.getenv("MLFLOW_TRACKING_URI", "")
_mlflow: MLflowClient | None = MLflowClient(tracking_uri=_MLFLOW_URI) if _MLFLOW_URI else None
_mlflow: MLflowClient | None = (
MLflowClient(
tracking_uri=_MLFLOW_URI,
username=os.getenv("MLFLOW_TRACKING_USERNAME", "admin"),
password=os.getenv("MLFLOW_TRACKING_PASSWORD") or os.getenv("MLFLOW_ADMIN_PASSWORD", "password"),
host_header="localhost",
)
if _MLFLOW_URI else None
)
_MLFLOW_EXP = "oO/serving"