Skip to content

Commit

Permalink
Add function to enumerate containers in a pod
Browse files Browse the repository at this point in the history
  • Loading branch information
dboreham committed Feb 14, 2024
1 parent 7b5f720 commit afadc83
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions stack_orchestrator/deploy/k8s/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ def pods_in_deployment(core_api: client.CoreV1Api, deployment_name: str):
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):
# Note response has to be UTF-8 encoded because the caller expects to decode it
yield ("ignore", s.encode())
Expand Down

0 comments on commit afadc83

Please sign in to comment.