Metadata-Version: 2.4
Name: mlflow-kubernetes-plugins
Version: 1.2.0
Summary: Kubernetes-backed WorkspaceProvider implementation and Kubernetes authorization plugin for MLflow workspaces.
Author: Red Hat
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/opendatahub-io/mlflow-kubernetes-plugins
Project-URL: Repository, https://github.com/opendatahub-io/mlflow-kubernetes-plugins
Project-URL: Issues, https://github.com/opendatahub-io/mlflow-kubernetes-plugins/issues
Project-URL: Documentation, https://github.com/opendatahub-io/mlflow-kubernetes-plugins/tree/main/docs
Keywords: mlflow,kubernetes,workspaces,authorization,plugins
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mlflow<4.0.0,>=3.10.0
Requires-Dist: kubernetes>=29.0.0
Requires-Dist: graphql-core>=3.2.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-mock>=3.10; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# MLflow Kubernetes Plugins

This repository packages two MLflow extensions for Kubernetes-backed deployments:

- a workspace provider that maps MLflow workspaces to Kubernetes namespaces
- an optional authorization plugin that enforces Kubernetes RBAC for MLflow requests

These plugins build on top of MLflow's 3.10 workspace support. If you are new to MLflow workspaces, start with the official guide: <https://mlflow.org/docs/latest/self-hosting/workspaces/getting-started/>. It covers the core MLflow server requirements, how workspace context is set by clients, and the upstream workspace lifecycle model.

## Components

| Entry point | MLflow hook | Purpose |
| --- | --- | --- |
| [`kubernetes`](docs/workspace-provider.md) | `mlflow.workspace_provider` | Exposes Kubernetes namespaces as MLflow workspaces. |
| [`kubernetes-auth`](docs/authorization-plugin.md) | `mlflow.app` | Wraps the MLflow server with Kubernetes-based authorization checks. |

## Install

Install from PyPI:

```bash
pip install mlflow-kubernetes-plugins
```

For local development:

```bash
pip install -e ".[dev]"
```

## Quick Start

1. Enable MLflow workspaces on an MLflow server backed by a SQL store.
2. Install this package into the same environment as the MLflow server.
3. Configure the workspace provider and, if needed, the auth plugin.

```bash
export MLFLOW_K8S_WORKSPACE_LABEL_SELECTOR="mlflow-enabled=true"
export MLFLOW_K8S_DEFAULT_WORKSPACE="team-a"

mlflow server \
  --backend-store-uri postgresql://user:pass@localhost/mlflow \
  --default-artifact-root s3://mlflow-artifacts \
  --enable-workspaces \
  --workspace-store-uri "kubernetes://" \
  --app-name kubernetes-auth
```

Use `--app-name kubernetes-auth` only when you want request authorization enforced by Kubernetes RBAC.

## Documentation

- [`docs/index.md`](docs/index.md): docs index
- [`docs/workspace-provider.md`](docs/workspace-provider.md): workspace provider behavior, configuration, and startup
- [`docs/authorization-plugin.md`](docs/authorization-plugin.md): auth modes, headers, and request handling
- [`docs/kubernetes-rbac.md`](docs/kubernetes-rbac.md): RBAC requirements and example manifests
- `config/crd/bases/mlflow.kubeflow.org_mlflowconfigs.yaml`: generated `MLflowConfig` CRD manifest

## Development

Run the main local checks from the repository root:

```bash
pip install -e ".[dev]"
make generate-k8s
ruff check .
pytest
python -m build
```
