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

Function newPodList

pkg/polymorphichelpers/helpers_test.go:292–322  ·  view source on GitHub ↗
(count, isUnready, isUnhealthy int, labels map[string]string)

Source from the content-addressed store, hash-verified

290}
291
292func newPodList(count, isUnready, isUnhealthy int, labels map[string]string) *corev1.PodList {
293 pods := []corev1.Pod{}
294 for i := 0; i < count; i++ {
295 newPod := corev1.Pod{
296 ObjectMeta: metav1.ObjectMeta{
297 Name: fmt.Sprintf("pod-%d", i+1),
298 Namespace: metav1.NamespaceDefault,
299 CreationTimestamp: metav1.Date(2016, time.April, 1, 1, 0, i, 0, time.UTC),
300 Labels: labels,
301 },
302 Status: corev1.PodStatus{
303 Conditions: []corev1.PodCondition{
304 {
305 Status: corev1.ConditionTrue,
306 Type: corev1.PodReady,
307 },
308 },
309 },
310 }
311 pods = append(pods, newPod)
312 }
313 if isUnready > -1 && isUnready < count {
314 pods[isUnready].Status.Conditions[0].Status = corev1.ConditionFalse
315 }
316 if isUnhealthy > -1 && isUnhealthy < count {
317 pods[isUnhealthy].Status.ContainerStatuses = []corev1.ContainerStatus{{RestartCount: 5}}
318 }
319 return &corev1.PodList{
320 Items: pods,
321 }
322}

Callers 2

TestGetPodListFunction · 0.85
TestGetFirstPodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…