MCPcopy
hub / github.com/kubernetes/kubectl / containerNameToRef

Function containerNameToRef

pkg/cmd/debug/debug.go:880–895  ·  view source on GitHub ↗
(pod *corev1.Pod)

Source from the content-addressed store, hash-verified

878}
879
880func containerNameToRef(pod *corev1.Pod) map[string]*corev1.Container {
881 names := map[string]*corev1.Container{}
882 for i := range pod.Spec.Containers {
883 ref := &pod.Spec.Containers[i]
884 names[ref.Name] = ref
885 }
886 for i := range pod.Spec.InitContainers {
887 ref := &pod.Spec.InitContainers[i]
888 names[ref.Name] = ref
889 }
890 for i := range pod.Spec.EphemeralContainers {
891 ref := (*corev1.Container)(&pod.Spec.EphemeralContainers[i].EphemeralContainerCommon)
892 names[ref.Name] = ref
893 }
894 return names
895}
896
897// waitForContainer watches the given pod until the container is running
898func (o *DebugOptions) waitForContainer(ctx context.Context, ns, podName, containerName string) (*corev1.Pod, error) {

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…