當前位置: 首頁>>代碼示例>>Golang>>正文


Golang pod.CreatePodList函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。