k8s/io/kubernetes/pkg/api/v1.PodList 示例代码

2022-03-03

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

示例1:
client_test.go开发语言: Go项目名称: 289代码行数: 468
1/*
2Copyright 2014 Google Inc. All rights reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
示例2:
statefulset_utils.go开发语言: Go项目名称: ddysher代码行数: 834
201
202	var statefulPodList *v1.PodList
203	pollErr := wait.PollImmediate(StatefulSetPoll, StatefulSetTimeout, func() (bool, error) {
253// GetPodList gets the current Pods in ss.
254func (s *StatefulSetTester) GetPodList(ss *apps.StatefulSet) *v1.PodList {
255	selector, err := metav1.LabelSelectorAsSelector(ss.Spec.Selector)
311// WaitForState periodically polls for the ss and its pods until the until function returns either true or an error
312func (s *StatefulSetTester) WaitForState(ss *apps.StatefulSet, until func(*apps.StatefulSet, *v1.PodList) (bool, error)) {
313	pollErr := wait.PollImmediate(StatefulSetPoll, StatefulSetTimeout,
329func (s *StatefulSetTester) WaitForStatus(set *apps.StatefulSet) *apps.StatefulSet {
330	s.WaitForState(set, func(set2 *apps.StatefulSet, pods *v1.PodList) (bool, error) {
331		if set2.Status.ObservedGeneration != nil && *set2.Status.ObservedGeneration >= set.Generation {
345// WaitForPodReady waits for the Pod named podName in set to exist and have a Ready condition.
346func (s *StatefulSetTester) WaitForPodReady(set *apps.StatefulSet, podName string) (*apps.StatefulSet, *v1.PodList) {
347	var pods *v1.PodList
示例3:
statefulset_utils.go开发语言: Go项目名称: detiber代码行数: 834
201
202	var statefulPodList *v1.PodList
203	pollErr := wait.PollImmediate(StatefulSetPoll, StatefulSetTimeout, func() (bool, error) {
253// GetPodList gets the current Pods in ss.
254func (s *StatefulSetTester) GetPodList(ss *apps.StatefulSet) *v1.PodList {
255	selector, err := metav1.LabelSelectorAsSelector(ss.Spec.Selector)
311// WaitForState periodically polls for the ss and its pods until the until function returns either true or an error
312func (s *StatefulSetTester) WaitForState(ss *apps.StatefulSet, until func(*apps.StatefulSet, *v1.PodList) (bool, error)) {
313	pollErr := wait.PollImmediate(StatefulSetPoll, StatefulSetTimeout,
329func (s *StatefulSetTester) WaitForStatus(set *apps.StatefulSet) *apps.StatefulSet {
330	s.WaitForState(set, func(set2 *apps.StatefulSet, pods *v1.PodList) (bool, error) {
331		if set2.Status.ObservedGeneration != nil && *set2.Status.ObservedGeneration >= set.Generation {
345// WaitForPodReady waits for the Pod named podName in set to exist and have a Ready condition.
346func (s *StatefulSetTester) WaitForPodReady(set *apps.StatefulSet, podName string) (*apps.StatefulSet, *v1.PodList) {
347	var pods *v1.PodList
示例4:
util.go开发语言: Go项目名称: ddysher代码行数: 4781
1548	respondName    bool // Whether the pod should respond with its own name.
1549	pods           *v1.PodList
1550}
1551
1552func PodProxyResponseChecker(c clientset.Interface, ns string, label labels.Selector, controllerName string, respondName bool, pods *v1.PodList) podProxyResponseChecker {
1553	return podProxyResponseChecker{c, ns, label, controllerName, respondName, pods}
1684
1685func PodsResponding(c clientset.Interface, ns, name string, wantName bool, pods *v1.PodList) error {
1686	By("trying to dial each unique pod")
1690
1691func PodsCreated(c clientset.Interface, ns, name string, replicas int32) (*v1.PodList, error) {
1692	label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
1695
1696func PodsCreatedByLabel(c clientset.Interface, ns, name string, replicas int32, label labels.Selector) (*v1.PodList, error) {
1697	timeout := 2 * time.Minute
示例5:
util.go开发语言: Go项目名称: detiber代码行数: 4746
1547	respondName    bool // Whether the pod should respond with its own name.
1548	pods           *v1.PodList
1549}
1550
1551func PodProxyResponseChecker(c clientset.Interface, ns string, label labels.Selector, controllerName string, respondName bool, pods *v1.PodList) podProxyResponseChecker {
1552	return podProxyResponseChecker{c, ns, label, controllerName, respondName, pods}
1683
1684func PodsResponding(c clientset.Interface, ns, name string, wantName bool, pods *v1.PodList) error {
1685	By("trying to dial each unique pod")
1689
1690func PodsCreated(c clientset.Interface, ns, name string, replicas int32) (*v1.PodList, error) {
1691	label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
1694
1695func PodsCreatedByLabel(c clientset.Interface, ns, name string, replicas int32, label labels.Selector) (*v1.PodList, error) {
1696	timeout := 2 * time.Minute
示例6:
controller_utils_test.go开发语言: Go项目名称: ddysher代码行数: 481
99// create count pods with the given phase for the given rc (same selectors and namespace), and add them to the store.
100func newPodList(store cache.Store, count int, status v1.PodPhase, rc *v1.ReplicationController) *v1.PodList {
101	pods := []v1.Pod{}
115	}
116	return &v1.PodList{
117		Items: pods,
示例7:
daemon_set.go开发语言: Go项目名称: ddysher代码行数: 896
548
549func listDaemonPods(c clientset.Interface, ns string, label map[string]string) *v1.PodList {
550	selector := labels.Set(label).AsSelector()
856
857func checkDaemonSetPodsLabels(podList *v1.PodList, hash, templateGeneration string) {
858	for _, pod := range podList.Items {
示例8:
controller_utils_test.go开发语言: Go项目名称: detiber代码行数: 481
99// create count pods with the given phase for the given rc (same selectors and namespace), and add them to the store.
100func newPodList(store cache.Store, count int, status v1.PodPhase, rc *v1.ReplicationController) *v1.PodList {
101	pods := []v1.Pod{}
115	}
116	return &v1.PodList{
117		Items: pods,
示例9:
daemon_set.go开发语言: Go项目名称: detiber代码行数: 896
548
549func listDaemonPods(c clientset.Interface, ns string, label map[string]string) *v1.PodList {
550	selector := labels.Set(label).AsSelector()
856
857func checkDaemonSetPodsLabels(podList *v1.PodList, hash, templateGeneration string) {
858	for _, pod := range podList.Items {
示例10:
etcd_test.go开发语言: Go项目名称: kubernetes代码行数: 1437
1/*
2Copyright 2014 Google Inc. All rights reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/

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