k8s/io/kubernetes/pkg/api.PodStatus 示例代码

2022-03-03

以下示例是关于golang中包含api.PodStatus用法的示例代码,想了解api.PodStatus的具体用法?api.PodStatus怎么用?api.PodStatus使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
etcd_test.go开发语言: Go项目名称: kubernetes代码行数: 1437
45
46	statusToReturn *api.PodStatus
47	errorToReturn  error
49
50func (f *fakeCache) GetPodStatus(namespace, name string) (*api.PodStatus, error) {
51	f.requestedNamespace = namespace
70	storage, bindingStorage := NewREST(h, &pod.BasicBoundPodFactory{})
71	storage = storage.WithPodStatus(&fakeCache{statusToReturn: &api.PodStatus{}})
72	return storage, bindingStorage, fakeEtcdClient, h
113	storage, _ := NewREST(helper, nil)
114	cache := &fakeCache{statusToReturn: &api.PodStatus{}}
115	storage = storage.WithPodStatus(cache)
154	storage, _ := NewREST(helper, nil)
155	cache := &fakeCache{statusToReturn: &api.PodStatus{}}
156	storage = storage.WithPodStatus(cache)
示例2:
pod_cache_test.go开发语言: Go项目名称: kubernetes代码行数: 524
37	useCount int
38	data     api.PodStatusResult
39	err      error
49	// responses to specific calls-- that will take precedence.
50	data api.PodStatusResult
51	err  error
53
54func (f *FakePodInfoGetter) GetPodStatus(host, namespace, name string) (api.PodStatusResult, error) {
55	f.lock.Lock()
76
77	expectedDefault := api.PodStatus{
78		Info: api.PodInfo{
81	}
82	expectedOther := api.PodStatus{
83		Info: api.PodInfo{
示例3:
pod_cache.go开发语言: Go项目名称: kubernetes代码行数: 266
40	// cached pod statuses.
41	podStatus map[objKey]api.PodStatus
42	// nodes that we know exist. Cleared at the beginning of each
59		currentNodes:  map[objKey]api.NodeStatus{},
60		podStatus:     map[objKey]api.PodStatus{},
61	}
64// GetPodStatus gets the stored pod status.
65func (p *PodCache) GetPodStatus(namespace, name string) (*api.PodStatus, error) {
66	status := p.getPodStatusInternal(namespace, name)
72
73func (p *PodCache) updateCacheAndReturn(namespace, name string) (*api.PodStatus, error) {
74	pod, err := p.pods.GetPod(api.WithNamespace(api.NewContext(), namespace), name)
88
89func (p *PodCache) getPodStatusInternal(namespace, name string) *api.PodStatus {
90	p.lock.Lock()
示例4:
etcd_test.go开发语言: Go项目名称: kubernetes代码行数: 441
74		ObjectMeta: api.ObjectMeta{Name: "foo"},
75		Status:     api.PodStatus{Host: "machine"},
76	}
78		ObjectMeta: api.ObjectMeta{Name: "bar"},
79		Status:     api.PodStatus{Host: "machine"},
80	}
156		ObjectMeta: api.ObjectMeta{Name: "foo"},
157		Status:     api.PodStatus{Host: "machine"},
158	}
160		ObjectMeta: api.ObjectMeta{Name: "foo"},
161		Status:     api.PodStatus{Host: "machine2"},
162	}
219		ObjectMeta: api.ObjectMeta{Name: "foo"},
220		Status:     api.PodStatus{Host: "machine"},
221	}
示例5:
resource_printer_test.go开发语言: Go项目名称: kubernetes代码行数: 592
329		"nilInfo":   {api.Pod{}, "false"},
330		"emptyInfo": {api.Pod{Status: api.PodStatus{Info: api.PodInfo{}}}, "false"},
331		"fooExists": {
332			api.Pod{
333				Status: api.PodStatus{
334					Info: api.PodInfo{"foo": api.ContainerStatus{}},
340			api.Pod{
341				Status: api.PodStatus{
342					Info: api.PodInfo{"bar": api.ContainerStatus{}},
348			api.Pod{
349				Status: api.PodStatus{
350					Info: api.PodInfo{
359			api.Pod{
360				Status: api.PodStatus{
361					Info: api.PodInfo{
示例6:
predicates_test.go开发语言: Go项目名称: kubernetes代码行数: 577
519			pod:      api.Pod{ObjectMeta: api.ObjectMeta{Labels: selector}},
520			pods:     []api.Pod{{Status: api.PodStatus{Host: "machine1"}, ObjectMeta: api.ObjectMeta{Labels: selector}}},
521			node:     "machine1",
528			pod:      api.Pod{ObjectMeta: api.ObjectMeta{Labels: selector}},
529			pods:     []api.Pod{{Status: api.PodStatus{Host: "machine2"}, ObjectMeta: api.ObjectMeta{Labels: selector}}},
530			node:     "machine1",
537			pod:      api.Pod{ObjectMeta: api.ObjectMeta{Labels: selector}},
538			pods:     []api.Pod{{Status: api.PodStatus{Host: "machine3"}, ObjectMeta: api.ObjectMeta{Labels: selector}}},
539			node:     "machine1",
546			pod:      api.Pod{ObjectMeta: api.ObjectMeta{Labels: selector}},
547			pods:     []api.Pod{{Status: api.PodStatus{Host: "machine2"}, ObjectMeta: api.ObjectMeta{Labels: selector}}},
548			node:     "machine1",
555			pod:      api.Pod{ObjectMeta: api.ObjectMeta{Labels: selector}},
556			pods:     []api.Pod{{Status: api.PodStatus{Host: "machine5"}, ObjectMeta: api.ObjectMeta{Labels: selector}}},
557			node:     "machine4",
示例7:
client_test.go开发语言: Go项目名称: kubernetes代码行数: 794
210					{
211						Status: api.PodStatus{
212							Phase: api.PodRunning,
243					{
244						Status: api.PodStatus{
245							Phase: api.PodRunning,
271			Body: &api.Pod{
272				Status: api.PodStatus{
273					Phase: api.PodRunning,
311	requestPod := &api.Pod{
312		Status: api.PodStatus{
313			Phase: api.PodRunning,
343		},
344		Status: api.PodStatus{
345			Phase: api.PodRunning,
示例8:
spreading_test.go开发语言: Go项目名称: kubernetes代码行数: 294
35	}
36	zone1Status := api.PodStatus{
37		Host: "machine1",
38	}
39	zone2Status := api.PodStatus{
40		Host: "machine2",
149	}
150	zone0Status := api.PodStatus{
151		Host: "machine01",
152	}
153	zone1Status := api.PodStatus{
154		Host: "machine11",
155	}
156	zone2Status := api.PodStatus{
157		Host: "machine21",
示例9:
server_test.go开发语言: Go项目名称: kubernetes代码行数: 1016
41	podByNameFunc                      func(namespace, name string) (*api.BoundPod, bool)
42	statusFunc                         func(name string) (api.PodStatus, error)
43	containerInfoFunc                  func(podFullName string, uid types.UID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
59
60func (fk *fakeKubelet) GetPodStatus(name string, uid types.UID) (api.PodStatus, error) {
61	return fk.statusFunc(name)
156	fw := newServerTest()
157	expected := api.PodStatus{
158		Info: map[string]api.ContainerStatus{
161	}
162	fw.fakeKubelet.statusFunc = func(name string) (api.PodStatus, error) {
163		if name == "goodpod.default.etcd" {
165		}
166		return api.PodStatus{}, fmt.Errorf("bad pod %s", name)
167	}
示例10:
rest.go开发语言: Go项目名称: kubernetes代码行数: 185
52	pod := obj.(*api.Pod)
53	pod.Status = api.PodStatus{
54		Phase: api.PodPending,
75type PodStatusGetter interface {
76	GetPodStatus(namespace, name string) (*api.PodStatus, error)
77	ClearPodStatus(namespace, name string)
86		if status, err := cache.GetPodStatus(pod.Namespace, pod.Name); err != nil {
87			pod.Status = api.PodStatus{
88				Phase: api.PodUnknown,

本文地址:https://www.itbaoku.cn/snippets/415666.html