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

2022-03-03

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

示例1:
ref.go开发语言: Go项目名称: ashumeow代码行数: 78
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:
watch_test.go开发语言: Go项目名称: kubernetes代码行数: 287
82		}
83		if _, err := api.GetReference(gotObj); err != nil {
84			t.Errorf("Unable to construct reference: %v", err)
149		t.Logf("obj: %#v", gotObj)
150		if _, err := api.GetReference(gotObj); err != nil {
151			t.Errorf("Unable to construct reference: %v", err)
示例3:
watch_test.go开发语言: Go项目名称: cjcullen代码行数: 780
118		}
119		if _, err := api.GetReference(gotObj); err != nil {
120			t.Errorf("Unable to construct reference: %v", err)
171		}
172		if _, err := api.GetReference(gotObj); err != nil {
173			t.Errorf("Unable to construct reference: %v", err)
349				}
350				if _, err := api.GetReference(gotObj); err != nil {
351					t.Errorf("%s: Unable to construct reference: %v", name, err)
示例4:
watch_test.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 776
118		}
119		if _, err := api.GetReference(gotObj); err != nil {
120			t.Errorf("Unable to construct reference: %v", err)
171		}
172		if _, err := api.GetReference(gotObj); err != nil {
173			t.Errorf("Unable to construct reference: %v", err)
346				}
347				if _, err := api.GetReference(gotObj); err != nil {
348					t.Errorf("%s: Unable to construct reference: %v", name, err)
示例5:
watch_test.go开发语言: Go项目名称: amygdala代码行数: 528
93		}
94		if _, err := api.GetReference(gotObj); err != nil {
95			t.Errorf("Unable to construct reference: %v", err)
159		t.Logf("obj: %#v", gotObj)
160		if _, err := api.GetReference(gotObj); err != nil {
161			t.Errorf("Unable to construct reference: %v", err)
示例6:
watch_test.go开发语言: Go项目名称: ashumeow代码行数: 286
82		}
83		if _, err := api.GetReference(gotObj); err != nil {
84			t.Errorf("Unable to construct reference: %v", err)
149		t.Logf("obj: %#v", gotObj)
150		if _, err := api.GetReference(gotObj); err != nil {
151			t.Errorf("Unable to construct reference: %v", err)
示例7:
persistent_volumes_test.go开发语言: Go项目名称: cjcullen代码行数: 1172
264	claim := claims[rand.Intn(maxClaims-1)]
265	claimRef, err := api.GetReference(claim)
266	if err != nil {
767			[]api.PersistentVolumeAccessMode{api.ReadWriteOnce}, api.PersistentVolumeReclaimRetain)
768		claimRef, err := api.GetReference(newPVC)
769		if err != nil {
示例8:
persistent_volumes_test.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 1177
263	claim := claims[rand.Intn(maxClaims-1)]
264	claimRef, err := api.GetReference(claim)
265	if err != nil {
766			[]api.PersistentVolumeAccessMode{api.ReadWriteOnce}, api.PersistentVolumeReclaimRetain)
767		claimRef, err := api.GetReference(newPVC)
768		if err != nil {
示例9:
ref.go开发语言: Go项目名称: kubernetes代码行数: 53
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*/
示例10:
kubelet.go开发语言: Go项目名称: kubernetes代码行数: 1747
1032
1033	ref, err := api.GetReference(pod)
1034	if err != nil {

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