mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Merge pull request #129027 from Phaow/dev
Fix: typos for volume package
This commit is contained in:
commit
29273b23bc
@ -37,7 +37,7 @@ type metricsBlock struct {
|
|||||||
device string
|
device string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMetricsStatfs creates a new metricsBlock with the device node of the
|
// NewMetricsBlock creates a new metricsBlock with the device node of the
|
||||||
// Volume.
|
// Volume.
|
||||||
func NewMetricsBlock(device string) MetricsProvider {
|
func NewMetricsBlock(device string) MetricsProvider {
|
||||||
return &metricsBlock{device}
|
return &metricsBlock{device}
|
||||||
|
@ -23,7 +23,11 @@ import (
|
|||||||
const (
|
const (
|
||||||
// ErrCodeNotSupported code for NotSupported Errors.
|
// ErrCodeNotSupported code for NotSupported Errors.
|
||||||
ErrCodeNotSupported int = iota + 1
|
ErrCodeNotSupported int = iota + 1
|
||||||
|
|
||||||
|
// ErrCodeNoPathDefined code for NoPathDefined Errors.
|
||||||
ErrCodeNoPathDefined
|
ErrCodeNoPathDefined
|
||||||
|
|
||||||
|
// ErrCodeFsInfoFailed code for FsInfoFailed Errors.
|
||||||
ErrCodeFsInfoFailed
|
ErrCodeFsInfoFailed
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ type metricsStatFS struct {
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMetricsStatfs creates a new metricsStatFS with the Volume path.
|
// NewMetricsStatFS creates a new metricsStatFS with the Volume path.
|
||||||
func NewMetricsStatFS(path string) MetricsProvider {
|
func NewMetricsStatFS(path string) MetricsProvider {
|
||||||
return &metricsStatFS{path}
|
return &metricsStatFS{path}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,10 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/volume/util/subpath"
|
"k8s.io/kubernetes/pkg/volume/util/subpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ProbeOperation represents a type of operation for probing volume plugins.
|
||||||
type ProbeOperation uint32
|
type ProbeOperation uint32
|
||||||
|
|
||||||
|
// ProbeEvent represents an event triggered during a volume plugin probe operation.
|
||||||
type ProbeEvent struct {
|
type ProbeEvent struct {
|
||||||
Plugin VolumePlugin // VolumePlugin that was added/updated/removed. if ProbeEvent.Op is 'ProbeRemove', Plugin should be nil
|
Plugin VolumePlugin // VolumePlugin that was added/updated/removed. if ProbeEvent.Op is 'ProbeRemove', Plugin should be nil
|
||||||
PluginName string
|
PluginName string
|
||||||
@ -52,17 +55,22 @@ type ProbeEvent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Common parameter which can be specified in StorageClass to specify the desired FSType
|
// VolumeParameterFSType is a common parameter which can be specified in StorageClass to specify the desired FSType
|
||||||
// Provisioners SHOULD implement support for this if they are block device based
|
// Provisioners SHOULD implement support for this if they are block device based
|
||||||
// Must be a filesystem type supported by the host operating system.
|
// Must be a filesystem type supported by the host operating system.
|
||||||
// Ex. "ext4", "xfs", "ntfs". Default value depends on the provisioner
|
// Ex. "ext4", "xfs", "ntfs". Default value depends on the provisioner
|
||||||
VolumeParameterFSType = "fstype"
|
VolumeParameterFSType = "fstype"
|
||||||
|
|
||||||
|
// ProbeAddOrUpdate represents an operation where a probe is added or updated.
|
||||||
ProbeAddOrUpdate ProbeOperation = 1 << iota
|
ProbeAddOrUpdate ProbeOperation = 1 << iota
|
||||||
|
|
||||||
|
// ProbeRemove represents an operation to remove a probe.
|
||||||
|
// This operation is used to indicate that a previously added probe should be removed.
|
||||||
ProbeRemove
|
ProbeRemove
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNoPluiginMatched = errors.New("no volume plugin matched")
|
// ErrNoPluginMatched is used to return when no volume plugin matches the requested type.
|
||||||
|
var ErrNoPluginMatched = errors.New("no volume plugin matched")
|
||||||
|
|
||||||
// VolumeOptions contains option information about a volume.
|
// VolumeOptions contains option information about a volume.
|
||||||
type VolumeOptions struct {
|
type VolumeOptions struct {
|
||||||
@ -108,6 +116,7 @@ type NodeResizeOptions struct {
|
|||||||
OldSize resource.Quantity
|
OldSize resource.Quantity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DynamicPluginProber is an interface that defines methods for probing dynamic volume plugins.
|
||||||
type DynamicPluginProber interface {
|
type DynamicPluginProber interface {
|
||||||
Init() error
|
Init() error
|
||||||
|
|
||||||
@ -653,7 +662,7 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(matchedPluginNames) == 0 {
|
if len(matchedPluginNames) == 0 {
|
||||||
return nil, ErrNoPluiginMatched
|
return nil, ErrNoPluginMatched
|
||||||
}
|
}
|
||||||
if len(matchedPluginNames) > 1 {
|
if len(matchedPluginNames) > 1 {
|
||||||
return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ","))
|
return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ","))
|
||||||
@ -730,7 +739,7 @@ func (pm *VolumePluginMgr) FindPersistentPluginBySpec(spec *Spec) (PersistentVol
|
|||||||
return nil, fmt.Errorf("no persistent volume plugin matched")
|
return nil, fmt.Errorf("no persistent volume plugin matched")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindPersistentPluginByName fetches a persistent volume plugin by name. If
|
// FindPersistentPluginByName fetches a recyclable persistent volume plugin by name. If
|
||||||
// no plugin is found, returns error.
|
// no plugin is found, returns error.
|
||||||
func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
@ -743,7 +752,7 @@ func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVo
|
|||||||
return nil, fmt.Errorf("no persistent volume plugin matched")
|
return nil, fmt.Errorf("no persistent volume plugin matched")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindRecyclablePluginByName fetches a persistent volume plugin by name. If
|
// FindRecyclablePluginBySpec fetches a recyclable persistent volume plugin by spec. If
|
||||||
// no plugin is found, returns error.
|
// no plugin is found, returns error.
|
||||||
func (pm *VolumePluginMgr) FindRecyclablePluginBySpec(spec *Spec) (RecyclableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindRecyclablePluginBySpec(spec *Spec) (RecyclableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginBySpec(spec)
|
volumePlugin, err := pm.FindPluginBySpec(spec)
|
||||||
@ -756,7 +765,7 @@ func (pm *VolumePluginMgr) FindRecyclablePluginBySpec(spec *Spec) (RecyclableVol
|
|||||||
return nil, fmt.Errorf("no recyclable volume plugin matched")
|
return nil, fmt.Errorf("no recyclable volume plugin matched")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindProvisionablePluginByName fetches a persistent volume plugin by name. If
|
// FindProvisionablePluginByName fetches a provisionable persistent volume plugin by name. If
|
||||||
// no plugin is found, returns error.
|
// no plugin is found, returns error.
|
||||||
func (pm *VolumePluginMgr) FindProvisionablePluginByName(name string) (ProvisionableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindProvisionablePluginByName(name string) (ProvisionableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
@ -769,7 +778,7 @@ func (pm *VolumePluginMgr) FindProvisionablePluginByName(name string) (Provision
|
|||||||
return nil, fmt.Errorf("no provisionable volume plugin matched")
|
return nil, fmt.Errorf("no provisionable volume plugin matched")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindDeletablePluginBySpec fetches a persistent volume plugin by spec. If
|
// FindDeletablePluginBySpec fetches a provisionable persistent volume plugin by spec. If
|
||||||
// no plugin is found, returns error.
|
// no plugin is found, returns error.
|
||||||
func (pm *VolumePluginMgr) FindDeletablePluginBySpec(spec *Spec) (DeletableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindDeletablePluginBySpec(spec *Spec) (DeletableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginBySpec(spec)
|
volumePlugin, err := pm.FindPluginBySpec(spec)
|
||||||
@ -782,7 +791,7 @@ func (pm *VolumePluginMgr) FindDeletablePluginBySpec(spec *Spec) (DeletableVolum
|
|||||||
return nil, fmt.Errorf("no deletable volume plugin matched")
|
return nil, fmt.Errorf("no deletable volume plugin matched")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindDeletablePluginByName fetches a persistent volume plugin by name. If
|
// FindDeletablePluginByName fetches a deleteable persistent volume plugin by name. If
|
||||||
// no plugin is found, returns error.
|
// no plugin is found, returns error.
|
||||||
func (pm *VolumePluginMgr) FindDeletablePluginByName(name string) (DeletableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindDeletablePluginByName(name string) (DeletableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
@ -829,7 +838,7 @@ func (pm *VolumePluginMgr) FindAttachablePluginByName(name string) (AttachableVo
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindDeviceMountablePluginBySpec fetches a persistent volume plugin by spec.
|
// FindDeviceMountablePluginBySpec fetches a devicemountable persistent volume plugin by spec.
|
||||||
func (pm *VolumePluginMgr) FindDeviceMountablePluginBySpec(spec *Spec) (DeviceMountableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindDeviceMountablePluginBySpec(spec *Spec) (DeviceMountableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginBySpec(spec)
|
volumePlugin, err := pm.FindPluginBySpec(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -845,7 +854,7 @@ func (pm *VolumePluginMgr) FindDeviceMountablePluginBySpec(spec *Spec) (DeviceMo
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindDeviceMountablePluginByName fetches a devicemountable volume plugin by name.
|
// FindDeviceMountablePluginByName fetches a devicemountable persistent volume plugin by name.
|
||||||
func (pm *VolumePluginMgr) FindDeviceMountablePluginByName(name string) (DeviceMountableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindDeviceMountablePluginByName(name string) (DeviceMountableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -857,7 +866,7 @@ func (pm *VolumePluginMgr) FindDeviceMountablePluginByName(name string) (DeviceM
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindExpandablePluginBySpec fetches a persistent volume plugin by spec.
|
// FindExpandablePluginBySpec fetches an expandable persistent volume plugin by spec.
|
||||||
func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginBySpec(spec)
|
volumePlugin, err := pm.FindPluginBySpec(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -867,7 +876,7 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
|
|||||||
klog.V(4).InfoS("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance", "specName", spec.Name())
|
klog.V(4).InfoS("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance", "specName", spec.Name())
|
||||||
return &noopExpandableVolumePluginInstance{spec}, nil
|
return &noopExpandableVolumePluginInstance{spec}, nil
|
||||||
}
|
}
|
||||||
if errors.Is(err, ErrNoPluiginMatched) {
|
if errors.Is(err, ErrNoPluginMatched) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
klog.V(4).InfoS("FindExpandablePluginBySpec -> err", "specName", spec.Name(), "err", err)
|
klog.V(4).InfoS("FindExpandablePluginBySpec -> err", "specName", spec.Name(), "err", err)
|
||||||
@ -880,7 +889,7 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindExpandablePluginBySpec fetches a persistent volume plugin by name.
|
// FindExpandablePluginByName fetches an expandable persistent volume plugin by name.
|
||||||
func (pm *VolumePluginMgr) FindExpandablePluginByName(name string) (ExpandableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindExpandablePluginByName(name string) (ExpandableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -919,7 +928,7 @@ func (pm *VolumePluginMgr) FindMapperPluginByName(name string) (BlockVolumePlugi
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindNodeExpandablePluginBySpec fetches a persistent volume plugin by spec
|
// FindNodeExpandablePluginBySpec fetches a node expandable persistent volume plugin by spec
|
||||||
func (pm *VolumePluginMgr) FindNodeExpandablePluginBySpec(spec *Spec) (NodeExpandableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindNodeExpandablePluginBySpec(spec *Spec) (NodeExpandableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginBySpec(spec)
|
volumePlugin, err := pm.FindPluginBySpec(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -931,7 +940,7 @@ func (pm *VolumePluginMgr) FindNodeExpandablePluginBySpec(spec *Spec) (NodeExpan
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindNodeExpandablePluginByName fetches a persistent volume plugin by name
|
// FindNodeExpandablePluginByName fetches a node expandable persistent volume plugin by name
|
||||||
func (pm *VolumePluginMgr) FindNodeExpandablePluginByName(name string) (NodeExpandableVolumePlugin, error) {
|
func (pm *VolumePluginMgr) FindNodeExpandablePluginByName(name string) (NodeExpandableVolumePlugin, error) {
|
||||||
volumePlugin, err := pm.FindPluginByName(name)
|
volumePlugin, err := pm.FindPluginByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -945,6 +954,9 @@ func (pm *VolumePluginMgr) FindNodeExpandablePluginByName(name string) (NodeExpa
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run starts the volume plugin manager, initializing and running the necessary
|
||||||
|
// tasks for managing volume plugins. This method is typically called to begin
|
||||||
|
// the plugin management lifecycle.
|
||||||
func (pm *VolumePluginMgr) Run(stopCh <-chan struct{}) {
|
func (pm *VolumePluginMgr) Run(stopCh <-chan struct{}) {
|
||||||
kletHost, ok := pm.Host.(KubeletVolumeHost)
|
kletHost, ok := pm.Host.(KubeletVolumeHost)
|
||||||
if ok {
|
if ok {
|
||||||
@ -1007,7 +1019,7 @@ func NewPersistentVolumeRecyclerPodTemplate() *v1.Pod {
|
|||||||
return pod
|
return pod
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check validity of recycle pod template
|
// ValidateRecyclerPodTemplate checks validity of recycle pod template
|
||||||
// List of checks:
|
// List of checks:
|
||||||
// - at least one volume is defined in the recycle pod template
|
// - at least one volume is defined in the recycle pod template
|
||||||
// If successful, returns nil
|
// If successful, returns nil
|
||||||
|
@ -24,6 +24,8 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/volume/util/types"
|
"k8s.io/kubernetes/pkg/volume/util/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SetVolumeOwnership sets the ownership of a volume to the specified user and group.
|
||||||
|
// It typically modifies the user and group ownership of the volume's file system.
|
||||||
func SetVolumeOwnership(mounter Mounter, dir string, fsGroup *int64, fsGroupChangePolicy *v1.PodFSGroupChangePolicy, completeFunc func(types.CompleteFuncParam)) error {
|
func SetVolumeOwnership(mounter Mounter, dir string, fsGroup *int64, fsGroupChangePolicy *v1.PodFSGroupChangePolicy, completeFunc func(types.CompleteFuncParam)) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user