Coverage for archdocs/features/kubernetes/const.py: 100%

64 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-18 22:03 +0000

1import dataclasses 

2import typing 

3 

4 

5# The narrow pair keeps the columns of the configuration table in `parser.py` from being 

6# swappable: both are strings, and only the types tell a kind from an attachment. 

7type ConfigurationKind = typing.Literal["ConfigMap", "Secret"] 

8type AttachmentKind = typing.Literal["env", "volume"] 

9 

10CONFIG_MAP_KIND: typing.Final = "ConfigMap" 

11SECRET_KIND: typing.Final = "Secret" # noqa: S105 — a manifest kind, not a credential 

12INGRESS_KIND: typing.Final = "Ingress" 

13AUTOSCALER_KIND: typing.Final = "HorizontalPodAutoscaler" 

14VOLUME_CLAIM_KIND: typing.Final = "PersistentVolumeClaim" 

15DEFAULT_WORKLOAD_KIND: typing.Final = "Deployment" 

16WORKLOAD_KINDS: typing.Final = frozenset((DEFAULT_WORKLOAD_KIND, "StatefulSet", "DaemonSet", "CronJob", "Job")) 

17EXPOSED_SERVICE_TYPES: typing.Final = frozenset(("LoadBalancer", "NodePort")) 

18ENVIRONMENT_ATTACHMENT: typing.Final = "env" 

19VOLUME_ATTACHMENT: typing.Final = "volume" 

20GPU_RESOURCE_KEYS: typing.Final = ("nvidia.com/gpu", "amd.com/gpu", "gpu") 

21REPOSITORY_MARKER_NAME: typing.Final = ".git" 

22PARENT_SEARCH_DEPTH: typing.Final = 2 

23TEMPLATES_DIR_NAME: typing.Final = "templates" 

24VALUES_FILE_STEM: typing.Final = "values" 

25MANIFEST_FILE_SUFFIXES: typing.Final = (".yaml", ".yml") 

26 

27type ValuePath = tuple[str, ...] 

28 

29 

30@typing.final 

31@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

32class ManifestValue: 

33 value_path: ValuePath 

34 raw_value: str 

35 

36 

37type ManifestValues = tuple[ManifestValue, ...] 

38 

39 

40@typing.final 

41@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

42class ResourceAmounts: 

43 requested_amount: str = "" 

44 limited_amount: str = "" 

45 

46 

47@typing.final 

48@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

49class ConfigurationSource: 

50 source_kind: ConfigurationKind 

51 source_name: str 

52 attachment_kind: AttachmentKind 

53 

54 

55@typing.final 

56@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

57class TrafficFeatures: 

58 ingress_enabled: bool = False 

59 ingress_hosts: tuple[str, ...] = () 

60 ingress_tls_enabled: bool = False 

61 service_type: str = "" 

62 service_port: int = 0 

63 

64 

65@typing.final 

66@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

67class ScalingFeatures: 

68 workload_kind: str = "" 

69 replica_count: int = 0 

70 min_replicas: int = 0 

71 max_replicas: int = 0 

72 target_cpu_utilization: int = 0 

73 

74 

75@typing.final 

76@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

77class ResourceFeatures: 

78 cpu_amounts: ResourceAmounts = ResourceAmounts() 

79 memory_amounts: ResourceAmounts = ResourceAmounts() 

80 gpu_amounts: ResourceAmounts = ResourceAmounts() 

81 persistence_enabled: bool = False 

82 persistence_size: str = "" 

83 

84 

85@typing.final 

86@dataclasses.dataclass(slots=True, kw_only=True, frozen=True) 

87class KubernetesFeatures: 

88 traffic_features: TrafficFeatures = TrafficFeatures() 

89 scaling_features: ScalingFeatures = ScalingFeatures() 

90 resource_features: ResourceFeatures = ResourceFeatures() 

91 configuration_sources: tuple[ConfigurationSource, ...] = ()