refactor(k8s): extract _any_service_has_host_network to fix C901 complexity
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 5m1s
Deploy Test / Run deploy test suite (pull_request) Successful in 7m58s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Failing after 8m32s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Failing after 9m13s
Webapp Test / Run webapp test suite (pull_request) Successful in 9m30s
Smoke Test / Run basic test suite (pull_request) Successful in 9m8s
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 5m1s
Deploy Test / Run deploy test suite (pull_request) Successful in 7m58s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Failing after 8m32s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Failing after 9m13s
Webapp Test / Run webapp test suite (pull_request) Successful in 9m30s
Smoke Test / Run basic test suite (pull_request) Successful in 9m8s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9c5511ac5d
commit
4d63448e7c
@ -394,6 +394,14 @@ class ClusterInfo:
|
||||
result.append(pv)
|
||||
return result
|
||||
|
||||
def _any_service_has_host_network(self):
|
||||
for pod_name in self.parsed_pod_yaml_map:
|
||||
pod = self.parsed_pod_yaml_map[pod_name]
|
||||
for svc in pod.get("services", {}).values():
|
||||
if svc.get("network_mode") == "host":
|
||||
return True
|
||||
return False
|
||||
|
||||
# TODO: put things like image pull policy into an object-scope struct
|
||||
def get_deployment(self, image_pull_policy: Optional[str] = None):
|
||||
containers = []
|
||||
@ -568,14 +576,7 @@ class ClusterInfo:
|
||||
)
|
||||
)
|
||||
|
||||
# Check if any compose service declares network_mode: host
|
||||
use_host_network = False
|
||||
for pod_name in self.parsed_pod_yaml_map:
|
||||
pod = self.parsed_pod_yaml_map[pod_name]
|
||||
for svc in pod.get("services", {}).values():
|
||||
if svc.get("network_mode") == "host":
|
||||
use_host_network = True
|
||||
break
|
||||
use_host_network = self._any_service_has_host_network()
|
||||
|
||||
template = client.V1PodTemplateSpec(
|
||||
metadata=client.V1ObjectMeta(annotations=annotations, labels=labels),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user