Skip to content

Commit 1a8a0c3

Browse files
committed
Add a warning if user is running against older version of kube
1 parent 2d33cd9 commit 1a8a0c3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/controller/expand_and_recover.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,20 @@ func (ctrl *resizeController) expandAndRecover(pvc *v1.PersistentVolumeClaim, pv
130130
newSize = *allocatedSize
131131
}
132132
default:
133-
// It is impossible for ResizeStatus to be empty and allocatedSize to be not nil but somehow
133+
// Usually it is impossible for ResizeStatus to be empty and allocatedSize to be not nil but somehow
134134
// if we do end up in this state, it is safest to resume expansion to last recorded size in
135135
// allocatedSize variable.
136+
// This can also happen if external-resizer is running with a version of api-server
137+
// which has volume recovery feature disabled.
136138
if resizeStatus == "" && allocatedSize != nil {
137139
newSize = *allocatedSize
138140
} else {
141+
klog.Warningf("external-resizer may be running with older version of kubernetes api-server, please upgrade to k8s version 1.32")
142+
// Usually resize operations are idempotent and it should be safe to reque resize here, but skipping expansion of already
143+
// expanded volumes saves some CPU cycles and helps in keeping e2es happy when running against older versions of kube-apiserver
144+
if util.HasFileSystemResizePendingCondition(pvc) {
145+
return pvc, pv, nil, false
146+
}
139147
newSize = pvcSpecSize
140148
}
141149
}

0 commit comments

Comments
 (0)