# KCL Dependency configuration for containerd taskserv
# Defines comprehensive dependency, resource, and health requirements

import provisioning.dependencies as schema

# Containerd taskserv dependency configuration
_dependencies = schema.TaskservDependencies {
    name = "containerd"

    # Critical dependencies - must be installed first
    requires = ["runc", "os"]

    # Optional enhancements - install if available
    optional = ["youki", "crun"]

    # Cannot coexist with other container runtimes
    conflicts = ["docker", "podman", "crio"]

    # Services provided by this taskserv
    provides = ["container-runtime", "cri", "containerd-service"]

    # Resource requirements for containerd installation
    resources = schema.ResourceRequirement {
        cpu = "200m"            # 200m CPU for container runtime
        memory = "256Mi"        # 256MB RAM minimum
        disk = "5Gi"           # 5GB for images and container storage
        network = True          # Requires network for image pulls
        privileged = True       # Needs privileged access for container operations
    }

    # Health checks for containerd service
    health_checks = [
        schema.HealthCheck {
            command = "systemctl is-active containerd"
            interval = 30
            timeout = 5
            retries = 2
            success_threshold = 1
            failure_threshold = 3
        },
        schema.HealthCheck {
            command = "ctr version"
            interval = 60
            timeout = 10
            retries = 3
        },
        schema.HealthCheck {
            command = "ctr images list | wc -l"
            interval = 120
            timeout = 15
            retries = 2
        }
    ]

    # Readiness probe for installation completion
    readiness_probe = schema.HealthCheck {
        command = "ctr namespaces list | grep -q default"
        interval = 15
        timeout = 5
        retries = 5
        success_threshold = 2
    }

    # Installation phases for ordered deployment
    phases = [
        schema.InstallationPhase {
            name = "pre-install"
            order = 1
            parallel = False
            required = True
        },
        schema.InstallationPhase {
            name = "install"
            order = 2
            parallel = False
            required = True
        },
        schema.InstallationPhase {
            name = "post-install"
            order = 3
            parallel = True
            required = True
        },
        schema.InstallationPhase {
            name = "validate"
            order = 4
            parallel = False
            required = True
        }
    ]

    # Installation control
    timeout = 300               # 5 minutes for containerd setup
    retry_count = 3

    # Platform compatibility
    os_support = ["linux"]
    arch_support = ["amd64", "arm64"]
    k8s_versions = ["1.31.x", "1.30.x", "1.29.x", "1.28.x"]
}

# Output for dynamic dependency resolution
_dependencies