當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。