Add function to enumerate containers in a pod
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 27s
Webapp Test / Run webapp test suite (pull_request) Successful in 3m5s
Smoke Test / Run basic test suite (pull_request) Successful in 5m35s
Deploy Test / Run deploy test suite (pull_request) Successful in 6m7s

This commit is contained in:
David Boreham 2024-02-14 15:58:25 -07:00
parent 7b5f720593
commit afadc83966

View File

@ -62,6 +62,17 @@ def pods_in_deployment(core_api: client.CoreV1Api, deployment_name: str):
return pods return pods
def containers_in_pod(core_api: client.CoreV1Api, pod_name: str):
containers = []
pod_response = core_api.read_namespaced_pod(pod_name, namespace="default")
if opts.o.debug:
print(f"pod_response: {pod_response}")
pod_containers = pod_response.spec.containers
for pod_container in pod_containers:
containers.append(pod_container.name)
return containers
def log_stream_from_string(s: str): def log_stream_from_string(s: str):
# Note response has to be UTF-8 encoded because the caller expects to decode it # Note response has to be UTF-8 encoded because the caller expects to decode it
yield ("ignore", s.encode()) yield ("ignore", s.encode())