Skip to content

Latest commit

 

History

History
114 lines (83 loc) · 4.68 KB

File metadata and controls

114 lines (83 loc) · 4.68 KB

MCP Lifecycle Module Operator

A Kubernetes operator that manages the lifecycle of the MCP Lifecycle Operator as a module within Open Data Hub (ODH).

This operator follows the ODH modular architecture pattern: the ODH platform operator creates a MCPLifecycleOperator custom resource, and this module operator reconciles it by deploying and managing the MCP Lifecycle Operator operand.

Architecture

graph TD
    Platform["ODH Platform Operator"]
    CR["MCPLifecycleOperator CR (default)"]
    Module["MCP Lifecycle Module Operator<br/><i>(this repo)</i>"]
    Operand["MCP Lifecycle Operator<br/><i>(operand)</i>"]
    MCPServer["MCPServer Resources"]

    Platform -->|creates| CR
    CR -->|watched by| Module
    Module -->|deploys via SSA| Operand
    Operand -->|manages| MCPServer
Loading

Key concepts:

  • Module operator (this repo) - manages the lifecycle of the operand; deployed by the ODH platform.
  • Operand - the MCP Lifecycle Operator itself, deployed by this module operator.
  • Platform configuration - the operand image reference and target namespace are provided via environment variables (RELATED_IMAGE_*, SYSTEM_NAMESPACE) injected by the platform into the module operator's pod spec.

Reconciliation Flow

flowchart TD
    Start([Reconcile]) --> CheckState{managementState?}
    CheckState -->|Removed| Delete[Delete all owned resources]
    Delete --> Done([Done])
    CheckState -->|Managed| Render[Render operand manifests]
    Render --> Apply[Apply resources via SSA]
    Apply --> GC[Garbage-collect stale resources]
    GC --> CheckDeploy{Deployments ready?}
    CheckDeploy -->|No| Requeue([Requeue after 10s])
    CheckDeploy -->|Yes| Ready[Set Ready condition]
    Ready --> Done
Loading

Prerequisites

  • Kubernetes / OpenShift cluster
  • kubectl configured for your cluster
  • The module operator image (or build it yourself - see CONTRIBUTING.md)

Installation

Deploy to a cluster

# Deploy the operator (uses quay.io/opendatahub/mcp-lifecycle-module-operator:latest by default)
make deploy

# Or specify a custom image
make deploy IMG=quay.io/myrepo/mcp-lifecycle-module-operator:v0.1.0

Operand Configuration

The operator uses environment variables for operand configuration:

Env Var Description Default
RELATED_IMAGE_ODH_MCP_LIFECYCLE_OPERATOR_IMAGE Full image reference for the MCP Lifecycle Operator operand Image from embedded manifests
SYSTEM_NAMESPACE Namespace where the operator and operand are deployed (set via Downward API) Required

In a full ODH/RHOAI deployment, RELATED_IMAGE_ODH_MCP_LIFECYCLE_OPERATOR_IMAGE is injected by the platform. When unset, the default image baked into the operand manifests is used.

Create the MCPLifecycleOperator CR

apiVersion: components.platform.opendatahub.io/v1alpha1
kind: MCPLifecycleOperator
metadata:
  name: default
spec:
  managementState: Managed

A sample is provided at config/samples/mcplifecycleoperator.yaml.

The CR is cluster-scoped and its name must be default (enforced by validation). Set managementState to Removed to tear down the operand.

Uninstall

make undeploy

Custom Resource Reference

Field Description
spec.managementState Managed (deploy/reconcile the operand) or Removed (delete all operand resources)
status.phase Ready or Not Ready
status.conditions Standard conditions: Ready, ProvisioningSucceeded, Degraded, MCPLifecycleOperatorAvailable
status.releases Reports the module operator version and repo URL

Related Resources

Contributing

See CONTRIBUTING.md for development setup, building, testing, and project structure.