当前位置: 首页>>代码示例>>Golang>>正文


Golang volume.NewMetricsDu函数代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/volume.NewMetricsDu函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMetricsDu函数的具体用法?Golang NewMetricsDu怎么用?Golang NewMetricsDu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewMetricsDu函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewBuilder

func (plugin *hostPathPlugin) NewBuilder(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Builder, error) {
	if spec.Volume != nil && spec.Volume.HostPath != nil {
		path := spec.Volume.HostPath.Path
		return &hostPathBuilder{
			hostPath: &hostPath{path: path, MetricsProvider: volume.NewMetricsDu(path)},
			readOnly: false,
		}, nil
	} else {
		path := spec.PersistentVolume.Spec.HostPath.Path
		return &hostPathBuilder{
			hostPath: &hostPath{path: path, MetricsProvider: volume.NewMetricsDu(path)},
			readOnly: spec.ReadOnly,
		}, nil
	}
}
开发者ID:jsravn,项目名称:kubernetes,代码行数:15,代码来源:host_path.go

示例2: newDeleter

func newDeleter(spec *volume.Spec, host volume.VolumeHost) (volume.Deleter, error) {
	if spec.PersistentVolume != nil && spec.PersistentVolume.Spec.HostPath == nil {
		return nil, fmt.Errorf("spec.PersistentVolumeSource.HostPath is nil")
	}
	path := spec.PersistentVolume.Spec.HostPath.Path
	return &hostPathDeleter{spec.Name(), path, host, volume.NewMetricsDu(path)}, nil
}
开发者ID:jsravn,项目名称:kubernetes,代码行数:7,代码来源:host_path.go

示例3: newCleanerInternal

func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UID, mounter mount.Interface, mountDetector mountDetector) (volume.Cleaner, error) {
	ed := &emptyDir{
		pod:             &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}},
		volName:         volName,
		medium:          api.StorageMediumDefault, // might be changed later
		mounter:         mounter,
		mountDetector:   mountDetector,
		plugin:          plugin,
		MetricsProvider: volume.NewMetricsDu(GetPath(podUID, volName, plugin.host)),
	}
	return ed, nil
}
开发者ID:erinboyd,项目名称:origin,代码行数:12,代码来源:empty_dir.go

示例4: NewUnmounter

func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) {
	return &secretVolumeUnmounter{
		&secretVolume{
			volName,
			podUID,
			plugin,
			plugin.host.GetMounter(),
			plugin.host.GetWriter(),
			volume.NewCachedMetrics(volume.NewMetricsDu(getPath(podUID, volName, plugin.host))),
		},
	}, nil
}
开发者ID:40a,项目名称:bootkube,代码行数:12,代码来源:secret.go

示例5: newRecycler

func newRecycler(spec *volume.Spec, host volume.VolumeHost, config volume.VolumeConfig) (volume.Recycler, error) {
	if spec.PersistentVolume == nil || spec.PersistentVolume.Spec.HostPath == nil {
		return nil, fmt.Errorf("spec.PersistentVolumeSource.HostPath is nil")
	}
	path := spec.PersistentVolume.Spec.HostPath.Path
	return &hostPathRecycler{
		name:            spec.Name(),
		path:            path,
		host:            host,
		config:          config,
		timeout:         volume.CalculateTimeoutForVolume(config.RecyclerMinimumTimeout, config.RecyclerTimeoutIncrement, spec.PersistentVolume),
		MetricsProvider: volume.NewMetricsDu(path),
	}, nil
}
开发者ID:jsravn,项目名称:kubernetes,代码行数:14,代码来源:host_path.go

示例6: newMounterInternal

func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, mounter mount.Interface, mountDetector mountDetector, opts volume.VolumeOptions) (volume.Mounter, error) {
	medium := api.StorageMediumDefault
	if spec.Volume.EmptyDir != nil { // Support a non-specified source as EmptyDir.
		medium = spec.Volume.EmptyDir.Medium
	}
	return &emptyDir{
		pod:             pod,
		volName:         spec.Name(),
		medium:          medium,
		mounter:         mounter,
		mountDetector:   mountDetector,
		plugin:          plugin,
		MetricsProvider: volume.NewMetricsDu(getPath(pod.UID, spec.Name(), plugin.host)),
	}, nil
}
开发者ID:eljefedelrodeodeljefe,项目名称:kubernetes,代码行数:15,代码来源:empty_dir.go

示例7: NewMounter

func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
	return &secretVolumeMounter{
		secretVolume: &secretVolume{
			spec.Name(),
			pod.UID,
			plugin,
			plugin.host.GetMounter(),
			plugin.host.GetWriter(),
			volume.NewCachedMetrics(volume.NewMetricsDu(getPath(pod.UID, spec.Name(), plugin.host))),
		},
		source: *spec.Volume.Secret,
		pod:    *pod,
		opts:   &opts,
	}, nil
}
开发者ID:40a,项目名称:bootkube,代码行数:15,代码来源:secret.go

示例8: NewBuilder

func (plugin *secretPlugin) NewBuilder(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Builder, error) {
	return &secretVolumeBuilder{
		secretVolume: &secretVolume{
			spec.Name(),
			pod.UID,
			plugin,
			plugin.host.GetMounter(),
			plugin.host.GetWriter(),
			volume.NewCachedMetrics(volume.NewMetricsDu(getPathFromHost(plugin.host, pod.UID, spec.Name()))),
		},
		secretName: spec.Volume.Secret.SecretName,
		pod:        *pod,
		opts:       &opts,
	}, nil
}
开发者ID:ethernetdan,项目名称:kubernetes,代码行数:15,代码来源:secret.go

示例9: NewCleaner

func (plugin *hostPathPlugin) NewCleaner(volName string, podUID types.UID) (volume.Cleaner, error) {
	return &hostPathCleaner{&hostPath{
		path:            "",
		MetricsProvider: volume.NewMetricsDu(""),
	}}, nil
}
开发者ID:jsravn,项目名称:kubernetes,代码行数:6,代码来源:host_path.go


注:本文中的k8s/io/kubernetes/pkg/volume.NewMetricsDu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。