# Workspace Template Registry Manifest
# Tracks available templates, layers, and their relationships

version: "1.0.0"
created: "2025-09-29"
source: "wuji infrastructure patterns"

# Layer configuration
layers:
  - name: "core"
    path: "provisioning/extensions"
    priority: 100
    description: "Core provisioning system extensions"
    provides: ["base-schemas", "core-taskservs", "core-providers"]

  - name: "workspace"
    path: "provisioning/workspace/templates"
    priority: 200
    description: "Shared workspace templates and patterns"
    extends: ["core"]
    provides: ["template-patterns", "common-configs", "best-practices"]

  - name: "infra"
    path: "dynamic"  # Resolved at runtime
    priority: 300
    description: "Infrastructure-specific overrides"
    extends: ["workspace", "core"]
    provides: ["custom-configs", "overrides", "infra-specific"]

# Available templates
templates:
  taskservs:
    kubernetes:
      base:
        version: "0.1.0"
        source_file: "templates/taskservs/kubernetes/base.k"
        description: "Base Kubernetes configuration template"
        compatible_providers: ["upcloud", "aws", "local"]
        required_dependencies: ["containerd", "cilium"]

      variants:
        ha-cluster:
          version: "0.1.0"
          source_file: "templates/taskservs/kubernetes/variants/ha-cluster.k"
          description: "High-availability Kubernetes cluster"
          extends: ["kubernetes.base"]
          compatible_providers: ["upcloud", "aws"]

        single-node:
          version: "0.1.0"
          source_file: "templates/taskservs/kubernetes/variants/single-node.k"
          description: "Single-node Kubernetes setup"
          extends: ["kubernetes.base"]
          compatible_providers: ["local", "upcloud"]

    storage:
      rook-ceph:
        version: "0.1.0"
        source_file: "templates/taskservs/storage/rook-ceph.k"
        description: "Rook Ceph storage configuration"
        compatible_providers: ["upcloud", "aws"]

      mayastor:
        version: "0.1.0"
        source_file: "templates/taskservs/storage/mayastor.k"
        description: "Mayastor storage configuration"
        compatible_providers: ["upcloud"]

    networking:
      cilium:
        version: "0.1.0"
        source_file: "templates/taskservs/networking/cilium.k"
        description: "Cilium CNI configuration"
        compatible_providers: ["upcloud", "aws", "local"]

      coredns:
        version: "0.1.0"
        source_file: "templates/taskservs/networking/coredns.k"
        description: "CoreDNS configuration"
        compatible_providers: ["upcloud", "aws", "local"]

  providers:
    upcloud:
      defaults:
        version: "0.1.0"
        source_file: "templates/providers/upcloud/defaults.k"
        description: "UpCloud provider default configuration"
        source: "wuji/defs/upcloud_defaults.k"

    aws:
      defaults:
        version: "0.1.0"
        source_file: "templates/providers/aws/defaults.k"
        description: "AWS provider default configuration"
        source: "wuji/defs/aws_defaults.k"

  servers:
    control-plane:
      version: "0.1.0"
      source_file: "templates/servers/control-plane.k"
      description: "Kubernetes control plane server template"
      source: "wuji patterns"

    worker-node:
      version: "0.1.0"
      source_file: "templates/servers/worker-node.k"
      description: "Kubernetes worker node template"
      source: "wuji patterns"

# Template relationships
relationships:
  extends:
    - template: "kubernetes.variants.ha-cluster"
      extends: "kubernetes.base"
    - template: "kubernetes.variants.single-node"
      extends: "kubernetes.base"

  requires:
    - template: "kubernetes.base"
      requires: ["containerd", "cilium"]
    - template: "kubernetes.variants.ha-cluster"
      requires: ["etcd", "rook-ceph"]

  compatible:
    - template: "kubernetes.base"
      providers: ["upcloud", "aws", "local"]
    - template: "rook-ceph"
      providers: ["upcloud", "aws"]
      not_compatible: ["local"]

# Usage examples
examples:
  - name: "Basic Kubernetes cluster"
    description: "Single control plane with workers"
    templates: ["kubernetes.base", "cilium", "upcloud.defaults"]

  - name: "High availability cluster"
    description: "HA control plane with Ceph storage"
    templates: ["kubernetes.variants.ha-cluster", "rook-ceph", "cilium"]

  - name: "Development single node"
    description: "Local development setup"
    templates: ["kubernetes.variants.single-node", "cilium"]
