""" KCL Dependency Management Schema for Provisioning System Provides type-safe dependency declarations with resource requirements and health checks """ schema ResourceRequirement: """Resource requirements for taskserv installation and operation""" cpu?: str = "100m" # CPU requirement (K8s format) memory?: str = "128Mi" # Memory requirement (K8s format) disk?: str = "1Gi" # Disk space requirement network?: bool = True # Requires network connectivity privileged?: bool = False # Requires privileged access check: len(cpu) > 0, "CPU requirement cannot be empty" len(memory) > 0, "Memory requirement cannot be empty" len(disk) > 0, "Disk requirement cannot be empty" schema HealthCheck: """Health check definition for taskserv validation""" command: str # Command to execute for health check interval?: int = 30 # Check interval in seconds timeout?: int = 10 # Command timeout in seconds retries?: int = 3 # Number of retry attempts success_threshold?: int = 1 # Consecutive successes needed failure_threshold?: int = 3 # Consecutive failures to mark unhealthy check: len(command) > 0, "Health check command cannot be empty" interval > 0, "Health check interval must be positive" timeout > 0, "Health check timeout must be positive" retries >= 0, "Health check retries cannot be negative" schema InstallationPhase: """Installation phase definition for ordered deployment""" name: str # Phase name (e.g., "pre-install", "install", "post-install") order: int # Execution order within phase (lower first) parallel?: bool = False # Can run in parallel with same order required?: bool = True # Phase is required for successful installation check: len(name) > 0, "Installation phase name cannot be empty" order >= 0, "Installation phase order cannot be negative" name in ["pre-install", "install", "post-install", "validate", "cleanup"], "Phase name must be one of: pre-install, install, post-install, validate, cleanup" schema TaskservDependencies: """Complete dependency configuration for a taskserv""" name: str # Taskserv name (must match directory) # Dependency relationships requires?: [str] # Required taskservs (must be installed first) conflicts?: [str] # Conflicting taskservs (cannot coexist) optional?: [str] # Optional taskservs (install if available) provides?: [str] # Services this taskserv provides # Resource requirements resources: ResourceRequirement # Resource requirements for installation # Health and validation health_checks?: [HealthCheck] # Health check definitions readiness_probe?: HealthCheck # Readiness check for installation completion # Installation control phases?: [InstallationPhase] # Installation phase definitions timeout?: int = 600 # Installation timeout in seconds retry_count?: int = 3 # Number of installation retry attempts # Compatibility os_support?: [str] = ["linux"] # Supported operating systems arch_support?: [str] = ["amd64"] # Supported CPU architectures k8s_versions?: [str] # Compatible Kubernetes versions check: len(name) > 0, "Taskserv name cannot be empty" name == name.lower(), "Taskserv name must be lowercase" timeout > 0, "Installation timeout must be positive" retry_count >= 0, "Retry count cannot be negative" len(os_support) > 0, "Must specify at least one supported OS" len(arch_support) > 0, "Must specify at least one supported architecture" # Re-export for taskserv use schema TaskservDependency = TaskservDependencies