util

package
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 18 Imported by: 7

Documentation

Index

Constants

View Source
const (
	VolumeResizing           = "Resizing"
	VolumeResizeFailed       = "VolumeResizeFailed"
	VolumeResizeSuccess      = "VolumeResizeSuccessful"
	VolumeModify             = "VolumeModify"
	VolumeModifyFailed       = "VolumeModifyFailed"
	VolumeModifySuccess      = "VolumeModifySuccessful"
	FileSystemResizeRequired = "FileSystemResizeRequired"
)

These constants are PVC condition types related to resize operation.

View Source
const (
	// If CSI migration is enabled, the value will be CSI driver name
	// Otherwise, it will be in-tree storage plugin name
	VolumeResizerKey = "volume.kubernetes.io/storage-resizer"
)

Variables

View Source
var (

	// AnnPreResizeCapacity annotation is added to a PV when expanding volume.
	// Its value is status capacity of the PVC prior to the volume expansion
	// Its value will be set by the external-resizer when it deems that filesystem resize is required after resizing volume.
	// Its value will be used by pv_controller to determine pvc's status capacity when binding pvc and pv.
	AnnPreResizeCapacity = "volume.alpha.kubernetes.io/pre-resize-capacity"
)

Functions

func GetObjectKey added in v1.10.0

func GetObjectKey(obj interface{}) (string, error)

func GetPVCPatchData added in v1.0.0

func GetPVCPatchData(oldPVC, newPVC *v1.PersistentVolumeClaim, addResourceVersionCheck bool) ([]byte, error)

func GetPatchData added in v1.0.0

func GetPatchData(oldObj, newObj interface{}) ([]byte, error)

func HasFileSystemResizePendingCondition

func HasFileSystemResizePendingCondition(pvc *v1.PersistentVolumeClaim) bool

HasFileSystemResizePendingCondition returns true if a pvc has a FileSystemResizePending condition. This means the controller side resize operation is finished, and kubelet side operation is in progress.

func IsDelayRetryError added in v1.12.0

func IsDelayRetryError(err error) bool

func IsFinalError added in v1.10.0

func IsFinalError(err error) bool

func IsInfeasibleError added in v1.12.0

func IsInfeasibleError(err error) bool

IsInfeasibleError returns true for grpc errors that are considered terminal in a way that they indicate CSI operation as infeasible. This function is a subset of final errors. All infeasible errors are also final errors

func MergeModifyVolumeConditionsOfPVC added in v1.10.0

func MergeModifyVolumeConditionsOfPVC(oldConditions, newConditions []v1.PersistentVolumeClaimCondition) []v1.PersistentVolumeClaimCondition

MergeModifyVolumeConditionsOfPVC updates pvc with requested modify volume conditions leaving other conditions untouched.

func MergeResizeConditionsOfPVC

func MergeResizeConditionsOfPVC(oldConditions, newConditions []v1.PersistentVolumeClaimCondition, keepOldResizeConditions bool) []v1.PersistentVolumeClaimCondition

MergeResizeConditionsOfPVC updates pvc with requested resize conditions leaving other conditions untouched.

func PatchClaim added in v1.10.0

func PatchClaim(kubeClient kubernetes.Interface, oldPVC, newPVC *v1.PersistentVolumeClaim, addResourceVersionCheck bool) (*v1.PersistentVolumeClaim, error)

Patches a given PVC with changes from newPVC. If addResourceVersionCheck is true then a version check is added to the patch to ensure that we are not patching old(and possibly outdated) PVC objects.

func PatchPersistentVolume added in v1.10.0

func PatchPersistentVolume(kubeClient kubernetes.Interface, oldPV, newPV *v1.PersistentVolume) (*v1.PersistentVolume, error)

func SanitizeName

func SanitizeName(name string) string

SanitizeName changes any name to a sanitized name which can be accepted by kubernetes.

Types

type DelayRetryError added in v1.12.0

type DelayRetryError struct {
	// contains filtered or unexported fields
}

func NewDelayRetryError added in v1.12.0

func NewDelayRetryError(msg string, tryAfter time.Duration) *DelayRetryError

func (*DelayRetryError) Error added in v1.12.0

func (e *DelayRetryError) Error() string

func (*DelayRetryError) TryAfter added in v1.12.0

func (e *DelayRetryError) TryAfter() time.Duration

type SlowSet added in v1.12.0

type SlowSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SlowSet is a set of API objects that should be synced at slower rate. Key is typically the object namespace + name and value is timestamp when the object was added to the set.

func NewSlowSet added in v1.12.0

func NewSlowSet(retTime time.Duration) *SlowSet

func (*SlowSet) Add added in v1.12.0

func (s *SlowSet) Add(key string) bool

func (*SlowSet) Contains added in v1.12.0

func (s *SlowSet) Contains(key string) bool

func (*SlowSet) Remove added in v1.12.0

func (s *SlowSet) Remove(key string)

func (*SlowSet) Run added in v1.12.0

func (s *SlowSet) Run(stopCh <-chan struct{})

func (*SlowSet) TimeRemaining added in v1.12.0

func (s *SlowSet) TimeRemaining(key string) time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL