mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Add a function to record volume size in dsow
This commit is contained in:
parent
10f91a9951
commit
2e54686f1b
@ -124,6 +124,11 @@ type DesiredStateOfWorld interface {
|
||||
|
||||
// MarkVolumeAttachability updates the volume's attachability for a given volume
|
||||
MarkVolumeAttachability(volumeName v1.UniqueVolumeName, attachable bool)
|
||||
|
||||
// UpdatePersistentVolumeSize updates persistentVolumeSize in desired state of the world
|
||||
// so as it can be compared against actual size and volume expansion performed
|
||||
// if necessary
|
||||
UpdatePersistentVolumeSize(volumeName v1.UniqueVolumeName, size resource.Quantity)
|
||||
}
|
||||
|
||||
// VolumeToMount represents a volume that is attached to this node and needs to
|
||||
@ -359,6 +364,19 @@ func (dsw *desiredStateOfWorld) DeletePodFromVolume(
|
||||
}
|
||||
}
|
||||
|
||||
// UpdatePersistentVolumeSize updates last known PV size. This is used for volume expansion and
|
||||
// should be only used for persistent volumes.
|
||||
func (dsw *desiredStateOfWorld) UpdatePersistentVolumeSize(volumeName v1.UniqueVolumeName, size resource.Quantity) {
|
||||
dsw.Lock()
|
||||
defer dsw.Unlock()
|
||||
|
||||
vol, volExists := dsw.volumesToMount[volumeName]
|
||||
if volExists {
|
||||
vol.persistentVolumeSize = size
|
||||
dsw.volumesToMount[volumeName] = vol
|
||||
}
|
||||
}
|
||||
|
||||
func (dsw *desiredStateOfWorld) VolumeExists(
|
||||
volumeName v1.UniqueVolumeName) bool {
|
||||
dsw.RLock()
|
||||
|
Loading…
Reference in New Issue
Block a user