Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Extension Registry Service

A high-performance Rust microservice that provides a unified REST API for extension discovery, versioning, and download from multiple sources.

Source: provisioning/platform/extension-registry/

Features

  • Multi-Backend Support: Fetch extensions from Gitea releases and OCI registries
  • Unified REST API: Single API for all extension operations
  • Smart Caching: LRU cache with TTL to reduce backend API calls
  • Prometheus Metrics: Built-in metrics for monitoring
  • Health Monitoring: Health checks for all backends
  • Type-Safe: Strong typing for extension metadata
  • Async/Await: High-performance async operations with Tokio
  • Docker Support: Production-ready containerization

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Extension Registry API                    │
│                         (axum)                               │
├─────────────────────────────────────────────────────────────┤
│  ┌────────────────┐  ┌────────────────┐  ┌──────────────┐  │
│  │  Gitea Client  │  │   OCI Client   │  │  LRU Cache   │  │
│  │  (reqwest)     │  │   (reqwest)    │  │  (parking)   │  │
│  └────────────────┘  └────────────────┘  └──────────────┘  │
└─────────────────────────────────────────────────────────────┘

Installation

cd provisioning/platform/extension-registry
cargo build --release

Configuration

Create config.toml:

[server]
host = "0.0.0.0"
port = 8082

# Gitea backend (optional)
[gitea]
url = "https://gitea.example.com"
organization = "provisioning-extensions"
token_path = "/path/to/gitea-token.txt"

# OCI registry backend (optional)
[oci]
registry = "registry.example.com"
namespace = "provisioning"
auth_token_path = "/path/to/oci-token.txt"

# Cache configuration
[cache]
capacity = 1000
ttl_seconds = 300

API Endpoints

Extension Operations

List Extensions

GET /api/v1/extensions?type=provider&limit=10

Get Extension

GET /api/v1/extensions/{type}/{name}

List Versions

GET /api/v1/extensions/{type}/{name}/versions

Download Extension

GET /api/v1/extensions/{type}/{name}/{version}

Search Extensions

GET /api/v1/extensions/search?q=kubernetes&type=taskserv

System Endpoints

Health Check

GET /api/v1/health

Metrics

GET /api/v1/metrics

Cache Statistics

GET /api/v1/cache/stats

Extension Naming Conventions

Gitea Repositories

  • Providers: {name}_prov (e.g., aws_prov)
  • Task Services: {name}_taskserv (e.g., kubernetes_taskserv)
  • Clusters: {name}_cluster (e.g., buildkit_cluster)

OCI Artifacts

  • Providers: {namespace}/{name}-provider
  • Task Services: {namespace}/{name}-taskserv
  • Clusters: {namespace}/{name}-cluster

Deployment

Docker

docker build -t extension-registry:latest .
docker run -d -p 8082:8082 -v $(pwd)/config.toml:/app/config.toml:ro extension-registry:latest

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: extension-registry
spec:
  replicas: 3
  template:
    spec:
      containers:
      - name: extension-registry
        image: extension-registry:latest
        ports:
        - containerPort: 8082