-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recover expansion failure #106154
Recover expansion failure #106154
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -430,6 +430,9 @@ type PersistentVolumeClaimSpec struct { | |
// +optional | ||
Selector *metav1.LabelSelector | ||
// Resources represents the minimum resources required | ||
// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements | ||
// that are lower than previous value but must still be higher than capacity recorded in the | ||
// status field of the claim. | ||
// +optional | ||
Resources ResourceRequirements | ||
// VolumeName is the binding reference to the PersistentVolume backing this | ||
|
@@ -486,6 +489,26 @@ const ( | |
PersistentVolumeClaimFileSystemResizePending PersistentVolumeClaimConditionType = "FileSystemResizePending" | ||
) | ||
|
||
// +enum | ||
type PersistentVolumeClaimResizeStatus string | ||
|
||
const ( | ||
// When expansion is complete, the empty string is set by resize controller or kubelet. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this also the status in the beginning when nothing has happened yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a PVC has not been expanded before, then this field will be |
||
PersistentVolumeClaimNoExpansionInProgress PersistentVolumeClaimResizeStatus = "" | ||
// State set when resize controller starts expanding the volume in control-plane | ||
PersistentVolumeClaimControllerExpansionInProgress PersistentVolumeClaimResizeStatus = "ControllerExpansionInProgress" | ||
// State set when expansion has failed in resize controller with a terminal error. | ||
// Transient errors such as timeout should not set this status and should leave ResizeStatus | ||
// unmodified, so as resize controller can resume the volume expansion. | ||
PersistentVolumeClaimControllerExpansionFailed PersistentVolumeClaimResizeStatus = "ControllerExpansionFailed" | ||
// State set when resize controller has finished expanding the volume but further expansion is needed on the node. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe mention kubelet has not yet started node expansion to differentiate from NodeExpansionInProgress? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that current comment is accurate, in the sense that resize controller in control-plane is finished with the work but mentioning the fact that "kubelet has not yet started node expansion" borders into an implementation detail which is subject to change and I am not comfortable putting it in API docs. What do you think? |
||
PersistentVolumeClaimNodeExpansionPending PersistentVolumeClaimResizeStatus = "NodeExpansionPending" | ||
// State set when kubelet starts expanding the volume. | ||
PersistentVolumeClaimNodeExpansionInProgress PersistentVolumeClaimResizeStatus = "NodeExpansionInProgress" | ||
// State set when expansion has failed in kubelet with a terminal error. Transient errors don't set NodeExpansionFailed. | ||
PersistentVolumeClaimNodeExpansionFailed PersistentVolumeClaimResizeStatus = "NodeExpansionFailed" | ||
) | ||
|
||
// PersistentVolumeClaimCondition represents the current condition of PV claim | ||
type PersistentVolumeClaimCondition struct { | ||
Type PersistentVolumeClaimConditionType | ||
|
@@ -513,6 +536,24 @@ type PersistentVolumeClaimStatus struct { | |
Capacity ResourceList | ||
// +optional | ||
Conditions []PersistentVolumeClaimCondition | ||
// The storage resource within AllocatedResources tracks the capacity allocated to a PVC. It may | ||
// be larger than the actual capacity when a volume expansion operation is requested. | ||
// For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. | ||
// If allocatedResources is not set, PVC.spec.resources alone is used for quota calculation. | ||
// If a volume expansion capacity request is lowered, allocatedResources is only | ||
// lowered if there are no expansion operations in progress and if the actual volume capacity | ||
// is equal or lower than the requested capacity. | ||
jsafrane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// This is an alpha field and requires enabling RecoverVolumeExpansionFailure feature. | ||
// +featureGate=RecoverVolumeExpansionFailure | ||
// +optional | ||
AllocatedResources ResourceList | ||
// ResizeStatus stores status of resize operation. | ||
// ResizeStatus is not set by default but when expansion is complete resizeStatus is set to empty | ||
// string by resize controller or kubelet. | ||
// This is an alpha field and requires enabling RecoverVolumeExpansionFailure feature. | ||
// +featureGate=RecoverVolumeExpansionFailure | ||
// +optional | ||
ResizeStatus *PersistentVolumeClaimResizeStatus | ||
} | ||
|
||
// PersistentVolumeAccessMode defines various access modes for PV. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also update comments on the PVC.spec.capacity field with the new feature-gated behavior for shrinking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated