mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #115304 from gnufied/fix-version-skew-for-older-expansion-controller
Use expansion without recovery if allocatedResource/resizeStatus unset
This commit is contained in:
commit
4d9e8f7695
@ -2103,7 +2103,7 @@ func (og *operationGenerator) expandVolumeDuringMount(volumeToMount VolumeToMoun
|
|||||||
volumePlugin: expandablePlugin,
|
volumePlugin: expandablePlugin,
|
||||||
actualStateOfWorld: actualStateOfWorld,
|
actualStateOfWorld: actualStateOfWorld,
|
||||||
}
|
}
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.RecoverVolumeExpansionFailure) {
|
if og.checkForRecoveryFromExpansion(pvc, volumeToMount) {
|
||||||
nodeExpander := newNodeExpander(resizeOp, og.kubeClient, og.recorder)
|
nodeExpander := newNodeExpander(resizeOp, og.kubeClient, og.recorder)
|
||||||
resizeFinished, err, _ := nodeExpander.expandOnPlugin()
|
resizeFinished, err, _ := nodeExpander.expandOnPlugin()
|
||||||
return resizeFinished, err
|
return resizeFinished, err
|
||||||
@ -2165,7 +2165,8 @@ func (og *operationGenerator) nodeExpandVolume(
|
|||||||
volumePlugin: expandableVolumePlugin,
|
volumePlugin: expandableVolumePlugin,
|
||||||
actualStateOfWorld: actualStateOfWorld,
|
actualStateOfWorld: actualStateOfWorld,
|
||||||
}
|
}
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.RecoverVolumeExpansionFailure) {
|
|
||||||
|
if og.checkForRecoveryFromExpansion(pvc, volumeToMount) {
|
||||||
nodeExpander := newNodeExpander(resizeOp, og.kubeClient, og.recorder)
|
nodeExpander := newNodeExpander(resizeOp, og.kubeClient, og.recorder)
|
||||||
resizeFinished, err, _ := nodeExpander.expandOnPlugin()
|
resizeFinished, err, _ := nodeExpander.expandOnPlugin()
|
||||||
return resizeFinished, err
|
return resizeFinished, err
|
||||||
@ -2177,6 +2178,26 @@ func (og *operationGenerator) nodeExpandVolume(
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (og *operationGenerator) checkForRecoveryFromExpansion(pvc *v1.PersistentVolumeClaim, volumeToMount VolumeToMount) bool {
|
||||||
|
resizeStatus := pvc.Status.ResizeStatus
|
||||||
|
allocatedResource := pvc.Status.AllocatedResources
|
||||||
|
featureGateStatus := utilfeature.DefaultFeatureGate.Enabled(features.RecoverVolumeExpansionFailure)
|
||||||
|
|
||||||
|
if !featureGateStatus {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Even though RecoverVolumeExpansionFailure feature gate is enabled, it appears that we are running with older version
|
||||||
|
// of resize controller, which will not populate allocatedResource and resizeStatus. This can happen because of version skew
|
||||||
|
// and hence we are going to keep expanding using older logic.
|
||||||
|
if resizeStatus == nil && allocatedResource == nil {
|
||||||
|
_, detailedMsg := volumeToMount.GenerateMsg("MountVolume.NodeExpandVolume running with", "older external resize controller")
|
||||||
|
klog.Warningf(detailedMsg)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// legacyCallNodeExpandOnPlugin is old version of calling node expansion on plugin, which does not support
|
// legacyCallNodeExpandOnPlugin is old version of calling node expansion on plugin, which does not support
|
||||||
// recovery from volume expansion failure
|
// recovery from volume expansion failure
|
||||||
// TODO: Removing this code when RecoverVolumeExpansionFailure feature goes GA.
|
// TODO: Removing this code when RecoverVolumeExpansionFailure feature goes GA.
|
||||||
|
Loading…
Reference in New Issue
Block a user