Commit 9dc06e85 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26807 from pmorie/wrap-volumes

Automatic merge from submit-queue Wrap comments in pkg/volume Supercedes #25300, line wrap some huge comments in `pkg/volume`.
parents c1392ec5 029b97d5
...@@ -27,20 +27,23 @@ import ( ...@@ -27,20 +27,23 @@ import (
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
) )
// Volume represents a directory used by pods or hosts on a node. // Volume represents a directory used by pods or hosts on a node. All method
// All method implementations of methods in the volume interface must be idempotent. // implementations of methods in the volume interface must be idempotent.
type Volume interface { type Volume interface {
// GetPath returns the path to which the volume should be // GetPath returns the path to which the volume should be mounted for the
// mounted for the pod. // pod.
GetPath() string GetPath() string
// MetricsProvider embeds methods for exposing metrics (e.g. used,available space). // MetricsProvider embeds methods for exposing metrics (e.g.
// used, available space).
MetricsProvider MetricsProvider
} }
// MetricsProvider exposes metrics (e.g. used,available space) related to a Volume. // MetricsProvider exposes metrics (e.g. used,available space) related to a
// Volume.
type MetricsProvider interface { type MetricsProvider interface {
// GetMetrics returns the Metrics for the Volume. Maybe expensive for some implementations. // GetMetrics returns the Metrics for the Volume. Maybe expensive for
// some implementations.
GetMetrics() (*Metrics, error) GetMetrics() (*Metrics, error)
} }
...@@ -50,14 +53,16 @@ type Metrics struct { ...@@ -50,14 +53,16 @@ type Metrics struct {
// Note: For block devices this maybe more than the total size of the files. // Note: For block devices this maybe more than the total size of the files.
Used *resource.Quantity Used *resource.Quantity
// Capacity represents the total capacity (bytes) of the volume's underlying storage. // Capacity represents the total capacity (bytes) of the volume's
// For Volumes that share a filesystem with the host (e.g. emptydir, hostpath) this is the size // underlying storage. For Volumes that share a filesystem with the host
// of the underlying storage, and will not equal Used + Available as the fs is shared. // (e.g. emptydir, hostpath) this is the size of the underlying storage,
// and will not equal Used + Available as the fs is shared.
Capacity *resource.Quantity Capacity *resource.Quantity
// Available represents the storage space available (bytes) for the Volume. // Available represents the storage space available (bytes) for the
// For Volumes that share a filesystem with the host (e.g. emptydir, hostpath), this is the available // Volume. For Volumes that share a filesystem with the host (e.g.
// space on the underlying storage, and is shared with host processes and other Volumes. // emptydir, hostpath), this is the available space on the underlying
// storage, and is shared with host processes and other Volumes.
Available *resource.Quantity Available *resource.Quantity
} }
...@@ -103,13 +108,14 @@ type Unmounter interface { ...@@ -103,13 +108,14 @@ type Unmounter interface {
// Recycler provides methods to reclaim the volume resource. // Recycler provides methods to reclaim the volume resource.
type Recycler interface { type Recycler interface {
Volume Volume
// Recycle reclaims the resource. Calls to this method should block until the recycling task is complete. // Recycle reclaims the resource. Calls to this method should block until
// Any error returned indicates the volume has failed to be reclaimed. A nil return indicates success. // the recycling task is complete. Any error returned indicates the volume
// has failed to be reclaimed. A nil return indicates success.
Recycle() error Recycle() error
} }
// Provisioner is an interface that creates templates for PersistentVolumes and can create the volume // Provisioner is an interface that creates templates for PersistentVolumes
// as a new resource in the infrastructure provider. // and can create the volume as a new resource in the infrastructure provider.
type Provisioner interface { type Provisioner interface {
// Provision creates the resource by allocating the underlying volume in a // Provision creates the resource by allocating the underlying volume in a
// storage system. This method should block until completion and returns // storage system. This method should block until completion and returns
...@@ -117,9 +123,10 @@ type Provisioner interface { ...@@ -117,9 +123,10 @@ type Provisioner interface {
Provision() (*api.PersistentVolume, error) Provision() (*api.PersistentVolume, error)
} }
// Deleter removes the resource from the underlying storage provider. Calls to this method should block until // Deleter removes the resource from the underlying storage provider. Calls
// the deletion is complete. Any error returned indicates the volume has failed to be reclaimed. // to this method should block until the deletion is complete. Any error
// A nil return indicates success. // returned indicates the volume has failed to be reclaimed. A nil return
// indicates success.
type Deleter interface { type Deleter interface {
Volume Volume
// This method should block until completion. // This method should block until completion.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment