本文整理汇总了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
}
示例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
}
示例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
}
示例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
}
示例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
}