Skip to main content

BuildPodLogContext

Builds a PodLogContext object from a given Kubernetes Pod object. It extracts the namespace, pod name, primary container name, and creates contexts for both regular and init containers.

def BuildPodLogContext(
pod: *v1.Pod
) - > *core.PodLogContext

Builds a PodLogContext object from a given Kubernetes Pod object. This function is used to extract relevant logging information from a Pod, such as its namespace, name, primary container, and details about all its containers and init containers.

Parameters

NameTypeDescription
pod*v1.PodThe Kubernetes Pod object from which to build the log context. This object provides all the necessary metadata about the Pod and its containers.

Returns

TypeDescription
*core.PodLogContextA pointer to a core.PodLogContext object containing the extracted log context information for the Pod.