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

2022-03-03

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

示例1:
nodecontroller_test.go开发语言: Go项目名称: kubernetes代码行数: 970
77
78func (m *FakeNodeHandler) List() (*api.NodeList, error) {
79	defer func() { m.RequestCount++ }()
95	}
96	nodeList := &api.NodeList{}
97	for _, node := range nodes {
228	for _, item := range table {
229		nodes := api.NodeList{}
230		for _, machine := range item.machines {
252		machines      []string
253		expectedNodes *api.NodeList
254	}{
256			machines:      []string{},
257			expectedNodes: &api.NodeList{},
258		},
示例2:
nodecontroller.go开发语言: Go项目名称: kubernetes代码行数: 417
81	// Register intial set of nodes with their status set.
82	var nodes *api.NodeList
83	var err error
90		} else {
91			nodes = &api.NodeList{}
92		}
219// PopulateIPs queries IPs for given list of nodes.
220func (s *NodeController) PopulateIPs(nodes *api.NodeList) (*api.NodeList, error) {
221	if s.isRunningCloudProvider() {
256// DoChecks performs health checking for given list of nodes.
257func (s *NodeController) DoChecks(nodes *api.NodeList) *api.NodeList {
258	var wg sync.WaitGroup
399// canonicalizeName takes a node list and lowercases all nodes' name.
400func (s *NodeController) canonicalizeName(nodes *api.NodeList) *api.NodeList {
401	for i := range nodes.Items {
示例3:
rest_test.go开发语言: Go项目名称: kubernetes代码行数: 171
82	}
83	nodeList := list.(*api.NodeList)
84	if len(expect) != len(nodeList.Items) || !contains(nodeList, "foo") || !contains(nodeList, "baz") {
144
145func contains(nodes *api.NodeList, nodeID string) bool {
146	for _, node := range nodes.Items {
示例4:
factory.go开发语言: Go项目名称: kubernetes代码行数: 323
171func (factory *ConfigFactory) pollMinions() (cache.Enumerator, error) {
172	allNodes := &api.NodeList{}
173	err := factory.Client.Get().Resource("minions").Do().Into(allNodes)
176	}
177	nodes := &api.NodeList{
178		TypeMeta: allNodes.TypeMeta,
233
234// nodeEnumerator allows a cache.Poller to enumerate items in an api.NodeList
235type nodeEnumerator struct {
236	*api.NodeList
237}
示例5:
generic_scheduler.go开发语言: Go项目名称: kubernetes代码行数: 172
78// Each minion is passed through the predicate functions to determine if it is a fit
79func findNodesThatFit(pod api.Pod, podLister PodLister, predicates []FitPredicate, nodes api.NodeList) (api.NodeList, error) {
80	filtered := []api.Node{}
82	if err != nil {
83		return api.NodeList{}, err
84	}
89			if err != nil {
90				return api.NodeList{}, err
91			}
100	}
101	return api.NodeList{Items: filtered}, nil
102}
示例6:
minion.go开发语言: Go项目名称: kubernetes代码行数: 117
31	Minion  string
32	Minions api.NodeList
33
37// MakeMinionList constructs api.MinionList from list of minion names and a NodeResource.
38func MakeMinionList(minions []string, nodeResources api.NodeResources) *api.NodeList {
39	list := api.NodeList{
60
61func (r *MinionRegistry) ListMinions(ctx api.Context) (*api.NodeList, error) {
62	r.Lock()
示例7:
listers.go开发语言: Go项目名称: kubernetes代码行数: 94
27type MinionLister interface {
28	List() (list api.NodeList, err error)
29}
31// FakeMinionLister implements MinionLister on a []string for test purposes.
32type FakeMinionLister api.NodeList
33
34// List returns minions as a []string.
35func (f FakeMinionLister) List() (api.NodeList, error) {
36	return api.NodeList(f), nil
示例8:
minions.go开发语言: Go项目名称: kubernetes代码行数: 97
32	Create(minion *api.Node) (*api.Node, error)
33	List() (*api.NodeList, error)
34	Delete(name string) error
64// List lists all the nodes in the cluster.
65func (c *nodes) List() (*api.NodeList, error) {
66	result := &api.NodeList{}
示例9:
scheduler_predicates.go开发语言: Go项目名称: cjcullen代码行数: 955
51	var cs clientset.Interface
52	var nodeList *api.NodeList
53	var systemPodsNo int
71		ns = f.Namespace.Name
72		nodeList = &api.NodeList{}
73
示例10:
extender_test.go开发语言: Go项目名称: cjcullen代码行数: 307
54type fitPredicate func(pod *api.Pod, node *api.Node) (bool, error)
55type priorityFunc func(pod *api.Pod, nodes *api.NodeList) (*schedulerapi.HostPriorityList, error)
56
106
107func (e *Extender) Filter(pod *api.Pod, nodes *api.NodeList) (*api.NodeList, schedulerapi.FailedNodesMap, error) {
108	filtered := []api.Node{}
114			if err != nil {
115				return &api.NodeList{}, schedulerapi.FailedNodesMap{}, err
116			}
127	}
128	return &api.NodeList{Items: filtered}, failedNodesMap, nil
129}
130
131func (e *Extender) Prioritize(pod *api.Pod, nodes *api.NodeList) (*schedulerapi.HostPriorityList, error) {
132	result := schedulerapi.HostPriorityList{}

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