Coverage for scripts / live_release_validation / actions / platform_workloads.py: 100.00%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-09-14 22:07 +0000

1"""platform-workloads: the gco-system services are hosted as the manifests promise.""" 

2 

3from __future__ import annotations 

4 

5from typing import Any 

6 

7from ..checks.cluster import cluster_kubectl 

8from ..checks.platform_workloads import ( 

9 expected_deployments, 

10 manifest_processor_autoscaling_enabled, 

11 network_policy_enforcement_enabled, 

12 verify_platform_workloads, 

13) 

14from ..models import RunContext 

15 

16 

17def action_platform_workloads(ctx: RunContext) -> dict[str, Any]: 

18 """Require every Region's platform services to be converged, restart-free, drain-safe, and autoscaled as configured. 

19 

20 For every deployed Region, open the tunnelled kubectl session and poll a 

21 bounded snapshot of the ``gco-system`` Deployments (health-monitor, 

22 manifest-processor, inference-monitor, inference-proxy, plus cost-monitor 

23 when cost monitoring is configured). Each must be converged at its current 

24 generation with every live container at zero restarts; each multi-replica 

25 service's PodDisruptionBudget must be ``maxUnavailable: 1`` and currently 

26 allow a disruption; the inference-proxy HPA must exist, target its 

27 Deployment, and be able to scale, and the manifest-processor HPA must exist 

28 exactly when ``manifest_processor.autoscaling.enabled`` is set; and the 

29 ``kube-system/amazon-vpc-cni`` switch must carry the value rendered from 

30 ``eks_cluster.network_policy_enforcement``. 

31 

32 Running late in the registry is deliberate: by then the Job, queue, 

33 scheduler, inference, and cost actions have exercised every service, so a 

34 zero restart count is evidence the services held up under real traffic, 

35 not just that they started. 

36 """ 

37 regions: dict[str, Any] = {} 

38 for region in ctx.deployment_regions: 

39 with cluster_kubectl(ctx, region) as kubectl: 

40 regions[region] = verify_platform_workloads(ctx, region, kubectl) 

41 return { 

42 "deployments": list(expected_deployments(ctx)), 

43 "manifest_processor_autoscaling": manifest_processor_autoscaling_enabled(ctx), 

44 "network_policy_enforcement": network_policy_enforcement_enabled(ctx), 

45 "regions": regions, 

46 }