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

2022-03-03

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

示例1:
validation_test.go开发语言: Go项目名称: kubernetes代码行数: 2544
407			Image: "image",
408			Resources: api.ResourceRequirements{
409				Limits: api.ResourceList{
488				Image: "image",
489				Resources: api.ResourceRequirements{
490					Limits: api.ResourceList{
500				Image: "image",
501				Resources: api.ResourceRequirements{
502					Limits: getResourceLimits("-10", "0"),
510				Image: "image",
511				Resources: api.ResourceRequirements{
512					Limits: getResourceLimits("0", "-10"),
583					WorkingDir: "/tmp",
584					Resources: api.ResourceRequirements{
585						Limits: api.ResourceList{
示例2:
priorities_test.go开发语言: Go项目名称: kubernetes代码行数: 367
60			{
61				Resources: api.ResourceRequirements{
62					Limits: api.ResourceList{
67			{
68				Resources: api.ResourceRequirements{
69					Limits: api.ResourceList{
78			{
79				Resources: api.ResourceRequirements{
80					Limits: api.ResourceList{
86			{
87				Resources: api.ResourceRequirements{
88					Limits: api.ResourceList{
示例3:
validation_test.go开发语言: Go项目名称: ddysher代码行数: 10226
545				},
546				Resources: api.ResourceRequirements{
547					Requests: api.ResourceList{
569				},
570				Resources: api.ResourceRequirements{
571					Requests: api.ResourceList{
580				AccessModes: []api.PersistentVolumeAccessMode{"fakemode"},
581				Resources: api.ResourceRequirements{
582					Requests: api.ResourceList{
594				},
595				Resources: api.ResourceRequirements{
596					Requests: api.ResourceList{
604			claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
605				Resources: api.ResourceRequirements{
606					Requests: api.ResourceList{
示例4:
validation_test.go开发语言: Go项目名称: detiber代码行数: 10071
545				},
546				Resources: api.ResourceRequirements{
547					Requests: api.ResourceList{
569				},
570				Resources: api.ResourceRequirements{
571					Requests: api.ResourceList{
580				AccessModes: []api.PersistentVolumeAccessMode{"fakemode"},
581				Resources: api.ResourceRequirements{
582					Requests: api.ResourceList{
594				},
595				Resources: api.ResourceRequirements{
596					Requests: api.ResourceList{
604			claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
605				Resources: api.ResourceRequirements{
606					Requests: api.ResourceList{
示例5:
pods_test.go开发语言: Go项目名称: ddysher代码行数: 258
37					InitContainers: []api.Container{{
38						Resources: api.ResourceRequirements{
39							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("2m")},
50					Containers: []api.Container{{
51						Resources: api.ResourceRequirements{
52							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("2m")},
63					InitContainers: []api.Container{{
64						Resources: api.ResourceRequirements{
65							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
77					Containers: []api.Container{{
78						Resources: api.ResourceRequirements{
79							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
112					InitContainers: []api.Container{{
113						Resources: api.ResourceRequirements{
114							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
示例6:
pods_test.go开发语言: Go项目名称: detiber代码行数: 258
37					InitContainers: []api.Container{{
38						Resources: api.ResourceRequirements{
39							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("2m")},
50					Containers: []api.Container{{
51						Resources: api.ResourceRequirements{
52							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("2m")},
63					InitContainers: []api.Container{{
64						Resources: api.ResourceRequirements{
65							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
77					Containers: []api.Container{{
78						Resources: api.ResourceRequirements{
79							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
112					InitContainers: []api.Container{{
113						Resources: api.ResourceRequirements{
114							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
示例7:
pods_test.go开发语言: Go项目名称: abhgupta代码行数: 384
42					InitContainers: []api.Container{{
43						Resources: api.ResourceRequirements{
44							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
56					Containers: []api.Container{{
57						Resources: api.ResourceRequirements{
58							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
98					InitContainers: []api.Container{{
99						Resources: api.ResourceRequirements{
100							Requests: api.ResourceList{api.ResourceCPU: resource.MustParse("1m")},
117					InitContainers: []api.Container{{
118						Resources: api.ResourceRequirements{
119							Requests: api.ResourceList{api.ResourceMemory: resource.MustParse("1m")},
136					InitContainers: []api.Container{{
137						Resources: api.ResourceRequirements{
138							Requests: api.ResourceList{api.ResourceEphemeralStorage: resource.MustParse("32Mi")},
示例8:
validation_test.go开发语言: Go项目名称: amygdala代码行数: 5291
390				},
391				Resources: api.ResourceRequirements{
392					Requests: api.ResourceList{
401				AccessModes: []api.PersistentVolumeAccessMode{"fakemode"},
402				Resources: api.ResourceRequirements{
403					Requests: api.ResourceList{
415				},
416				Resources: api.ResourceRequirements{
417					Requests: api.ResourceList{
425			claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
426				Resources: api.ResourceRequirements{
427					Requests: api.ResourceList{
446				},
447				Resources: api.ResourceRequirements{
448					Requests: api.ResourceList{
示例9:
admission_test.go开发语言: Go项目名称: ddysher代码行数: 663
57
58func getResourceRequirements(requests, limits api.ResourceList) api.ResourceRequirements {
59	res := api.ResourceRequirements{}
134
135func validPod(name string, numContainers int, resources api.ResourceRequirements) api.Pod {
136	pod := api.Pod{
150
151func validPodInit(pod api.Pod, resources ...api.ResourceRequirements) api.Pod {
152	for i := 0; i < len(resources); i++ {
163	limitRange := validLimitRange()
164	expected := api.ResourceRequirements{
165		Requests: getComputeResourceList("50m", "5Mi"),
211	pod = validPodInit(validPod("limit-memory", 1, input), input)
212	expected = api.ResourceRequirements{
213		Requests: api.ResourceList{
示例10:
admission_test.go开发语言: Go项目名称: detiber代码行数: 663
57
58func getResourceRequirements(requests, limits api.ResourceList) api.ResourceRequirements {
59	res := api.ResourceRequirements{}
134
135func validPod(name string, numContainers int, resources api.ResourceRequirements) api.Pod {
136	pod := api.Pod{
150
151func validPodInit(pod api.Pod, resources ...api.ResourceRequirements) api.Pod {
152	for i := 0; i < len(resources); i++ {
163	limitRange := validLimitRange()
164	expected := api.ResourceRequirements{
165		Requests: getComputeResourceList("50m", "5Mi"),
211	pod = validPodInit(validPod("limit-memory", 1, input), input)
212	expected = api.ResourceRequirements{
213		Requests: api.ResourceList{

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