• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang pod.CreatePodList函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/kubernetes/dashboard/src/app/backend/resource/pod.CreatePodList函数的典型用法代码示例。如果您正苦于以下问题:Golang CreatePodList函数的具体用法?Golang CreatePodList怎么用?Golang CreatePodList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CreatePodList函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: GetServicePods

// GetServicePods gets list of pods targeted by given label selector in given namespace.
func GetServicePods(client k8sClient.Interface, heapsterClient client.HeapsterClient, namespace,
	name string, dsQuery *dataselect.DataSelectQuery) (*pod.PodList, error) {

	service, err := client.Core().Services(namespace).Get(name)
	if err != nil {
		return nil, err
	}

	labelSelector := labels.SelectorFromSet(service.Spec.Selector)
	channels := &common.ResourceChannels{
		PodList: common.GetPodListChannelWithOptions(client,
			common.NewSameNamespaceQuery(namespace),
			api.ListOptions{
				LabelSelector: labelSelector,
				FieldSelector: fields.Everything(),
			},
			1),
	}

	apiPodList := <-channels.PodList.List
	if err := <-channels.PodList.Error; err != nil {
		return nil, err
	}

	podList := pod.CreatePodList(apiPodList.Items, dsQuery, heapsterClient)
	return &podList, nil
}
开发者ID:bryk,项目名称:dashboard,代码行数:28,代码来源:servicedetail.go


示例2: GetDeploymentPods

// getJobPods returns list of pods targeting deployment.
func GetDeploymentPods(client client.Interface, heapsterClient heapster.HeapsterClient,
	dsQuery *dataselect.DataSelectQuery, namespace string, deploymentName string) (*pod.PodList, error) {

	deployment, err := client.Extensions().Deployments(namespace).Get(deploymentName)
	if err != nil {
		return nil, err
	}

	selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector)
	if err != nil {
		return nil, err
	}

	options := api.ListOptions{LabelSelector: selector}
	channels := &common.ResourceChannels{
		PodList: common.GetPodListChannelWithOptions(client,
			common.NewSameNamespaceQuery(namespace), options, 1),
	}

	rawPods := <-channels.PodList.List
	if err := <-channels.PodList.Error; err != nil {
		return nil, err
	}

	pods := common.FilterNamespacedPodsBySelector(rawPods.Items, deployment.ObjectMeta.Namespace,
		deployment.Spec.Selector.MatchLabels)

	podList := pod.CreatePodList(pods, []api.Event{}, dsQuery, heapsterClient)
	return &podList, nil
}
开发者ID:kubernetes,项目名称:dashboard,代码行数:31,代码来源:deploymentpods.go


示例3: GetReplicaSetPods

// GetReplicaSetPods return list of pods targeting replica set.
func GetReplicaSetPods(client k8sClient.Interface, heapsterClient client.HeapsterClient,
	dsQuery *dataselect.DataSelectQuery, petSetName, namespace string) (*pod.PodList, error) {
	log.Printf("Getting replication controller %s pods in namespace %s", petSetName, namespace)

	pods, err := getRawReplicaSetPods(client, petSetName, namespace)
	if err != nil {
		return nil, err
	}

	podList := pod.CreatePodList(pods, dsQuery, heapsterClient)
	return &podList, nil
}
开发者ID:digitalfishpond,项目名称:dashboard,代码行数:13,代码来源:replicasetpods.go


示例4: GetStatefulSetPods

// GetStatefulSetPods return list of pods targeting pet set.
func GetStatefulSetPods(client *k8sClient.Clientset, heapsterClient client.HeapsterClient,
	dsQuery *dataselect.DataSelectQuery, statefulSetName, namespace string) (*pod.PodList, error) {
	log.Printf("Getting replication controller %s pods in namespace %s", statefulSetName, namespace)

	pods, err := getRawStatefulSetPods(client, statefulSetName, namespace)
	if err != nil {
		return nil, err
	}

	podList := pod.CreatePodList(pods, []api.Event{}, dsQuery, heapsterClient)
	return &podList, nil
}
开发者ID:kubernetes,项目名称:dashboard,代码行数:13,代码来源:statefulsetpods.go


示例5: GetNodePods

func GetNodePods(client k8sClient.Interface, heapsterClient client.HeapsterClient, dsQuery *dataselect.DataSelectQuery, name string) (*pod.PodList, error) {
	node, err := client.Core().Nodes().Get(name)
	if err != nil {
		return nil, err
	}

	pods, err := getNodePods(client, *node)
	if err != nil {
		return nil, err
	}

	podList := pod.CreatePodList(pods.Items, dsQuery, heapsterClient)
	return &podList, nil
}
开发者ID:floreks,项目名称:dashboard,代码行数:14,代码来源:nodedetail.go



注:本文中的github.com/kubernetes/dashboard/src/app/backend/resource/pod.CreatePodList函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang common.Template类代码示例发布时间:2022-05-23
下一篇:
Golang dataselect.GenericDataSelectWithMetrics函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap