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

2022-03-03

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

示例1:
executor_kubernetes.go开发语言: Go项目名称: gitlab-ci-multi-runner代码行数: 563
207
208func (s *executor) getVolumeMounts() (mounts []api.VolumeMount) {
209	path := strings.Split(s.Build.BuildDir, "/")
211
212	mounts = append(mounts, api.VolumeMount{
213		Name:      "repo",
217	for _, mount := range s.Config.Kubernetes.Volumes.HostPaths {
218		mounts = append(mounts, api.VolumeMount{
219			Name:      mount.Name,
225	for _, mount := range s.Config.Kubernetes.Volumes.Secrets {
226		mounts = append(mounts, api.VolumeMount{
227			Name:      mount.Name,
233	for _, mount := range s.Config.Kubernetes.Volumes.PVCs {
234		mounts = append(mounts, api.VolumeMount{
235			Name:      mount.Name,
示例2:
executor_kubernetes_test.go开发语言: Go项目名称: gitlab-ci-multi-runner代码行数: 1525
84
85		Expected []api.VolumeMount
86	}{
96			},
97			Expected: []api.VolumeMount{
98				{Name: "repo"},
122			},
123			Expected: []api.VolumeMount{
124				{Name: "repo"},
152			},
153			Expected: []api.VolumeMount{
154				{Name: "repo"},
示例3:
validation_test.go开发语言: Go项目名称: kubernetes代码行数: 2544
286
287	successCase := []api.VolumeMount{
288		{Name: "abc", MountPath: "/foo"},
295
296	errorCases := map[string][]api.VolumeMount{
297		"empty name":      {{Name: "", MountPath: "/foo"}},
444		"unknown volume name": {
445			{Name: "abc", Image: "image", VolumeMounts: []api.VolumeMount{{Name: "anything", MountPath: "/foo"}},
446				ImagePullPolicy: "IfNotPresent"},
599					},
600					VolumeMounts: []api.VolumeMount{
601						{Name: "vol1", MountPath: "/foo"},
示例4:
validation_test.go开发语言: Go项目名称: kubernetes代码行数: 826
160
161	successCase := []api.VolumeMount{
162		{Name: "abc", MountPath: "/foo"},
169
170	errorCases := map[string][]api.VolumeMount{
171		"empty name":      {{Name: "", MountPath: "/foo"}},
226		"unknown volume name": {
227			{Name: "abc", Image: "image", VolumeMounts: []api.VolumeMount{{Name: "anything", MountPath: "/foo"}}},
228		},
332					},
333					VolumeMounts: []api.VolumeMount{
334						{Name: "vol1", MountPath: "/foo"},
示例5:
admission_test.go开发语言: Go项目名称: ddysher代码行数: 789
181	tests := map[string]struct {
182		orig       []api.VolumeMount
183		mod        []api.VolumeMount
184		result     []api.VolumeMount
185		shouldFail bool
187		"empty original": {
188			mod: []api.VolumeMount{
189				{
193			},
194			result: []api.VolumeMount{
195				{
202		"good merge": {
203			mod: []api.VolumeMount{
204				{
示例6:
manifests.go开发语言: Go项目名称: detiber代码行数: 546
64	volumes := []api.Volume{k8sVolume()}
65	volumeMounts := []api.VolumeMount{k8sVolumeMount()}
66
110			Command:       getSchedulerCommand(cfg, false),
111			VolumeMounts:  []api.VolumeMount{k8sVolumeMount()},
112			LivenessProbe: componentProbe(10251, "/healthz", api.URISchemeHTTP),
122			Command:       getEtcdCommand(cfg),
123			VolumeMounts:  []api.VolumeMount{certsVolumeMount(), etcdVolumeMount(cfg.Etcd.DataDir), k8sVolumeMount()},
124			Image:         images.GetCoreImage(images.KubeEtcdImage, cfg, kubeadmapi.GlobalEnvParams.EtcdImage),
163
164func newVolumeMount(name, path string) api.VolumeMount {
165	return api.VolumeMount{
180
181func etcdVolumeMount(dataDir string) api.VolumeMount {
182	return api.VolumeMount{
示例7:
admission_test.go开发语言: Go项目名称: detiber代码行数: 721
181	tests := map[string]struct {
182		orig       []api.VolumeMount
183		mod        []api.VolumeMount
184		result     []api.VolumeMount
185		shouldFail bool
187		"empty original": {
188			mod: []api.VolumeMount{
189				{
193			},
194			result: []api.VolumeMount{
195				{
202		"good merge": {
203			mod: []api.VolumeMount{
204				{
示例8:
admission.go开发语言: Go项目名称: ddysher代码行数: 449
398	// Create the prototypical VolumeMount
399	volumeMount := api.VolumeMount{
400		Name:      tokenVolumeName,
示例9:
admission.go开发语言: Go项目名称: detiber代码行数: 449
398	// Create the prototypical VolumeMount
399	volumeMount := api.VolumeMount{
400		Name:      tokenVolumeName,
示例10:
admission_test.go开发语言: Go项目名称: abhgupta代码行数: 831
181	tests := map[string]struct {
182		orig       []api.VolumeMount
183		mod        []api.VolumeMount
184		result     []api.VolumeMount
185		shouldFail bool
187		"empty original": {
188			mod: []api.VolumeMount{
189				{
193			},
194			result: []api.VolumeMount{
195				{
202		"good merge": {
203			mod: []api.VolumeMount{
204				{

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