MCPcopy Index your code
hub / github.com/devspace-sh/devspace / SelectPod

Method SelectPod

pkg/devspace/devpod/targetselector.go:111–132  ·  view source on GitHub ↗
(ctx context.Context, client kubectl.Client, namespace string, pods []*corev1.Pod, log log.Logger)

Source from the content-addressed store, hash-verified

109}
110
111func (u *untilNewestRunning) SelectPod(ctx context.Context, client kubectl.Client, namespace string, pods []*corev1.Pod, log log.Logger) (bool, *corev1.Pod, error) {
112 now := time.Now()
113 if now.Before(u.initialDelay) {
114 return false, nil, nil
115 } else if len(pods) == 0 {
116 u.parent.Kill(DevPodLostConnection{})
117 return false, nil, DevPodLostConnection{}
118 }
119
120 sort.Slice(pods, func(i, j int) bool {
121 return selector.SortPodsByNewest(pods, i, j)
122 })
123 if targetselector.HasPodProblem(pods[0]) {
124 u.podInfoPrinter.PrintPodWarning(pods[0], log)
125 return false, nil, nil
126 } else if kubectl.GetPodStatus(pods[0]) != "Running" {
127 u.podInfoPrinter.PrintPodInfo(ctx, client, pods[0], log)
128 return false, nil, nil
129 }
130
131 return true, pods[0], nil
132}
133
134func (u *untilNewestRunning) SelectContainer(ctx context.Context, client kubectl.Client, namespace string, containers []*selector.SelectedPodContainer, log log.Logger) (bool, *selector.SelectedPodContainer, error) {
135 now := time.Now()

Callers

nothing calls this directly

Calls 5

HasPodProblemFunction · 0.92
GetPodStatusFunction · 0.92
KillMethod · 0.80
PrintPodWarningMethod · 0.80
PrintPodInfoMethod · 0.80

Tested by

no test coverage detected