type HandlerRunner … type RuntimeHelper … // ShouldContainerBeRestarted checks whether a container needs to be restarted. // TODO(yifan): Think about how to refactor this. func ShouldContainerBeRestarted(container *v1.Container, pod *v1.Pod, podStatus *PodStatus) bool { … } // HashContainer returns the hash of the container. It is used to compare // the running container with its desired spec. // Note: remember to update hashValues in container_hash_test.go as well. func HashContainer(container *v1.Container) uint64 { … } // pickFieldsToHash pick fields that will affect the running status of the container for hash, // currently this field range only contains `image` and `name`. // Note: this list must be updated if ever kubelet wants to allow mutations to other fields. func pickFieldsToHash(container *v1.Container) map[string]string { … } // envVarsToMap constructs a map of environment name to value from a slice // of env vars. func envVarsToMap(envs []EnvVar) map[string]string { … } // v1EnvVarsToMap constructs a map of environment name to value from a slice // of env vars. func v1EnvVarsToMap(envs []v1.EnvVar) map[string]string { … } // ExpandContainerCommandOnlyStatic substitutes only static environment variable values from the // container environment definitions. This does *not* include valueFrom substitutions. // TODO: callers should use ExpandContainerCommandAndArgs with a fully resolved list of environment. func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []v1.EnvVar) (command []string) { … } // ExpandContainerVolumeMounts expands the subpath of the given VolumeMount by replacing variable references with the values of given EnvVar. func ExpandContainerVolumeMounts(mount v1.VolumeMount, envs []EnvVar) (string, error) { … } // ExpandContainerCommandAndArgs expands the given Container's command by replacing variable references `with the values of given EnvVar. func ExpandContainerCommandAndArgs(container *v1.Container, envs []EnvVar) (command []string, args []string) { … } // FilterEventRecorder creates an event recorder to record object's event except implicitly required container's, like infra container. func FilterEventRecorder(recorder record.EventRecorder) record.EventRecorder { … } type innerEventRecorder … func (irecorder *innerEventRecorder) shouldRecordEvent(object runtime.Object) (*v1.ObjectReference, bool) { … } func (irecorder *innerEventRecorder) Event(object runtime.Object, eventtype, reason, message string) { … } func (irecorder *innerEventRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{ … } func (irecorder *innerEventRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{ … } // IsHostNetworkPod returns whether the host networking requested for the given Pod. // Pod must not be nil. func IsHostNetworkPod(pod *v1.Pod) bool { … } // ConvertPodStatusToRunningPod returns Pod given PodStatus and container runtime string. // TODO(random-liu): Convert PodStatus to running Pod, should be deprecated soon func ConvertPodStatusToRunningPod(runtimeName string, podStatus *PodStatus) Pod { … } // SandboxToContainerState converts runtimeapi.PodSandboxState to // kubecontainer.State. // This is only needed because we need to return sandboxes as if they were // kubecontainer.Containers to avoid substantial changes to PLEG. // TODO: Remove this once it becomes obsolete. func SandboxToContainerState(state runtimeapi.PodSandboxState) State { … } // GetContainerSpec gets the container spec by containerName. func GetContainerSpec(pod *v1.Pod, containerName string) *v1.Container { … } // HasPrivilegedContainer returns true if any of the containers in the pod are privileged. func HasPrivilegedContainer(pod *v1.Pod) bool { … } // HasWindowsHostProcessContainer returns true if any of the containers in a pod are HostProcess containers. func HasWindowsHostProcessContainer(pod *v1.Pod) bool { … } // AllContainersAreWindowsHostProcess returns true if all containers in a pod are HostProcess containers. func AllContainersAreWindowsHostProcess(pod *v1.Pod) bool { … } // MakePortMappings creates internal port mapping from api port mapping. func MakePortMappings(container *v1.Container) (ports []PortMapping) { … } // HasAnyRegularContainerStarted returns true if any regular container has // started, which indicates all init containers have been initialized. func HasAnyRegularContainerStarted(spec *v1.PodSpec, statuses []v1.ContainerStatus) bool { … }