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

2022-03-03

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

示例1:
events_test.go开发语言: Go项目名称: ddysher代码行数: 221
36				},
37				InvolvedObject: api.ObjectReference{
38					Namespace: "bar",
48				},
49				InvolvedObject: api.ObjectReference{
50					Namespace: "aoeu-_-aoeu",
60				},
61				InvolvedObject: api.ObjectReference{
62					APIVersion: "v1",
72				},
73				InvolvedObject: api.ObjectReference{
74					APIVersion: "v1",
84				},
85				InvolvedObject: api.ObjectReference{
86					APIVersion: "extensions/v1beta1",
示例2:
events_test.go开发语言: Go项目名称: detiber代码行数: 221
36				},
37				InvolvedObject: api.ObjectReference{
38					Namespace: "bar",
48				},
49				InvolvedObject: api.ObjectReference{
50					Namespace: "aoeu-_-aoeu",
60				},
61				InvolvedObject: api.ObjectReference{
62					APIVersion: "v1",
72				},
73				InvolvedObject: api.ObjectReference{
74					APIVersion: "v1",
84				},
85				InvolvedObject: api.ObjectReference{
86					APIVersion: "extensions/v1beta1",
示例3:
storage_test.go开发语言: Go项目名称: ddysher代码行数: 898
496		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
497		Target:     api.ObjectReference{Name: "machine"},
498	}, false)
522		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
523		Target:     api.ObjectReference{Name: "machine"},
524	}, false)
570		},
571		Target: api.ObjectReference{Name: "machine"},
572	}, false)
605		},
606		Target: api.ObjectReference{Name: "machine"},
607	}
631		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
632		Target:     api.ObjectReference{Name: "machine"},
633	}, false)
示例4:
storage_test.go开发语言: Go项目名称: detiber代码行数: 898
496		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
497		Target:     api.ObjectReference{Name: "machine"},
498	}, false)
522		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
523		Target:     api.ObjectReference{Name: "machine"},
524	}, false)
570		},
571		Target: api.ObjectReference{Name: "machine"},
572	}, false)
605		},
606		Target: api.ObjectReference{Name: "machine"},
607	}
631		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceDefault, Name: "foo"},
632		Target:     api.ObjectReference{Name: "machine"},
633	}, false)
示例5:
event_test.go开发语言: Go项目名称: amygdala代码行数: 886
149				},
150				InvolvedObject: api.ObjectReference{
151					Kind:       "Pod",
163			},
164			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
165			expectUpdate: false,
177				},
178				InvolvedObject: api.ObjectReference{
179					Kind:       "Pod",
190			},
191			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
192			expectUpdate: false,
204				},
205				InvolvedObject: api.ObjectReference{
206					Kind:       "Pod",
示例6:
util_test.go开发语言: Go项目名称: abhgupta代码行数: 289
37		{Spec: api.PersistentVolumeSpec{
38			ClaimRef: &api.ObjectReference{Namespace: "claimrefns", Name: "claimrefname"},
39			PersistentVolumeSource: api.PersistentVolumeSource{
42		{Spec: api.PersistentVolumeSpec{
43			ClaimRef: &api.ObjectReference{Namespace: "claimrefns", Name: "claimrefname"},
44			PersistentVolumeSource: api.PersistentVolumeSource{
48		{Spec: api.PersistentVolumeSpec{
49			ClaimRef: &api.ObjectReference{Namespace: "claimrefns", Name: "claimrefname"},
50			PersistentVolumeSource: api.PersistentVolumeSource{
55		{Spec: api.PersistentVolumeSpec{
56			ClaimRef: &api.ObjectReference{Namespace: "claimrefns", Name: "claimrefname"},
57			PersistentVolumeSource: api.PersistentVolumeSource{
61		{Spec: api.PersistentVolumeSpec{
62			ClaimRef: &api.ObjectReference{Namespace: "claimrefns", Name: "claimrefname"},
63			PersistentVolumeSource: api.PersistentVolumeSource{
示例7:
endpoints_controller_test.go开发语言: Go项目名称: amygdala代码行数: 563
188		Subsets: []api.EndpointSubset{{
189			Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod0", Namespace: ns}}},
190			Ports:     []api.EndpointPort{{Port: 8080, Protocol: "TCP"}},
230		Subsets: []api.EndpointSubset{{
231			Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod0", Namespace: ns}}},
232			Ports:     []api.EndpointPort{{Port: 8080, Protocol: "UDP"}},
268		Subsets: []api.EndpointSubset{{
269			Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod0", Namespace: ns}}},
270			Ports:     []api.EndpointPort{{Port: 8080, Protocol: "TCP"}},
306		Subsets: []api.EndpointSubset{{
307			NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod0", Namespace: ns}}},
308			Ports:             []api.EndpointPort{{Port: 8080, Protocol: "TCP"}},
344		Subsets: []api.EndpointSubset{{
345			Addresses:         []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod0", Namespace: ns}}},
346			NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.5", TargetRef: &api.ObjectReference{Kind: "Pod", Name: "pod1", Namespace: ns}}},
示例8:
tokens_controller_test.go开发语言: Go项目名称: amygdala代码行数: 561
43// emptySecretReferences is used by a service account without any secrets
44func emptySecretReferences() []api.ObjectReference {
45	return []api.ObjectReference{}
49func missingSecretReferences() []api.ObjectReference {
50	return []api.ObjectReference{{Name: "missing-secret-1"}}
51}
53// regularSecretReferences is used by a service account that references secrets which are not ServiceAccountTokens
54func regularSecretReferences() []api.ObjectReference {
55	return []api.ObjectReference{{Name: "regular-secret-1"}}
58// tokenSecretReferences is used by a service account that references a ServiceAccountToken secret
59func tokenSecretReferences() []api.ObjectReference {
60	return []api.ObjectReference{{Name: "token-secret-1"}}
63// addTokenSecretReference adds a reference to the ServiceAccountToken that will be created
64func addTokenSecretReference(refs []api.ObjectReference) []api.ObjectReference {
65	return append(refs, api.ObjectReference{Name: "default-token-fplln"})
示例9:
event_test.go开发语言: Go项目名称: cjcullen代码行数: 914
146				},
147				InvolvedObject: api.ObjectReference{
148					Kind:       "Pod",
160			},
161			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
162			expectUpdate: false,
174				},
175				InvolvedObject: api.ObjectReference{
176					Kind:       "Pod",
187			},
188			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
189			expectUpdate: false,
201				},
202				InvolvedObject: api.ObjectReference{
203					Kind:       "Pod",
示例10:
event_test.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 914
146				},
147				InvolvedObject: api.ObjectReference{
148					Kind:       "Pod",
160			},
161			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
162			expectUpdate: false,
174				},
175				InvolvedObject: api.ObjectReference{
176					Kind:       "Pod",
187			},
188			expectLog:    `Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
189			expectUpdate: false,
201				},
202				InvolvedObject: api.ObjectReference{
203					Kind:       "Pod",

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