Skip to content

feat: Weight Controller skeleton that watches ExternalModels #1060

Description

@yehuditkerido

Create the complete weight-controller infrastructure: Go module, controller skeleton, deployment manifests. The controller watches ExternalModel resources and logs reconciliation events.

What's Included:

  • Go module structure (weight-controller/)
  • Import ODH Payload Processing types (ExternalModel, ExternalProvider)
  • Controller-runtime based controller that watches ExternalModel
  • Logs when ExternalModel is created/updated/deleted
  • RBAC manifests (ServiceAccount, ClusterRole, ClusterRoleBinding)
  • Deployment manifests (Deployment, Service)
  • Dockerfile (multi-stage, distroless base)
  • Makefile with build, test, lint, docker-build targets

Directory Structure:

# Go module (follows maas-controller pattern)
weight-controller/
├── go.mod
├── go.sum
├── Makefile
├── Dockerfile
├── cmd/
│   └── main.go
└── pkg/
    ├── controller/
    │   └── weight/
    │       ├── controller.go      # Main reconciliation loop
    │       └── calculator.go      # Weight calculation algorithm
    │
    ├── metrics/
    │   ├── types.go               # ClusterMetrics struct
    │   ├── source.go              # ClusterMetricsSource interface
    │   │
    │   ├── vllm/                  # VRAM utilization (from vLLM)
    │   │   └── scraper.go         # vLLM Prometheus scraper (:8000)
    │   │
    │   └── epp/                   # Latency (from llm-d EPP)
    │       └── scraper.go         # EPP Prometheus scraper (:9090)
    │
    ├── health/
    │   └── tracker.go             # Cluster health state tracking
    │
    └── config/
        └── config.go              # ConfigMap-based configuration

# Deployment manifests (centralized, follows repo pattern)
deployment/base/weight-controller/
├── default/
│   └── kustomization.yaml      # ties everything together
├── rbac/
│   ├── kustomization.yaml
│   ├── serviceaccount.yaml
│   ├── clusterrole.yaml
│   └── clusterrolebinding.yaml
├── manager/
│   ├── kustomization.yaml
│   └── deployment.yaml
└── monitoring/
    ├── kustomization.yaml
    └── service.yaml

# Sample CRs
docs/samples/weight-controller/
└── externalmodel-multi-cluster.yaml

Architecture:

        vllm/scraper.go              epp/scraper.go
        (VRAM utilization)           (Latency)
              │                           │
              └───────────┬───────────────┘
                          │
                          ▼
                   ClusterMetrics
                          │
                          ▼
               controller/weight/
               calculator.go
                          │
                          ▼
               Patch ExternalModel

Acceptance Criteria:

  • make -C weight-controller build succeeds
  • make -C weight-controller docker-build creates image < 100MB
  • kubectl apply -k deployment/base/weight-controller/default/ deploys successfully
  • Controller logs "Reconciling ExternalModel: " when ExternalModel is created
  • Controller reconnects after API server restart

Demo:

# Deploy controller
kubectl apply -k deployment/base/weight-controller/default/

# Create an ExternalModel with multiple providers
kubectl apply -f docs/samples/weight-controller/externalmodel-multi-cluster.yaml

# See controller logs
kubectl logs -l app=weight-controller -n maas-system
# Output: "Reconciling ExternalModel: my-model"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions