Skip to content

Commit ca6549d

Browse files
huangzhiyongzhiyong.huang
authored and
zhiyong.huang
committed
add flag --enable_online_fs_expansion: control whether pods that reference the resized volume need to be restarted.
Kubernetes v1.11 also introduces an alpha feature called online file system expansion. This feature enables file system expansion while a volume is still in-use by a pod. Because this feature is alpha, it requires enabling the feature gate, ExpandInUsePersistentVolumes. It is supported by the in-tree volume plugins GCE-PD, AWS-EBS, Cinder, and Ceph RBD. When this feature is enabled, pod referencing the resized volume do not need to be restarted. Instead, the file system will automatically be resized while in use as part of volume expansion. File system expansion does not happen until a pod references the resized volume, so if no pods referencing the volume are running file system expansion will not happen. Signed-off-by: zhiyong.huang <[email protected]>
1 parent 809bfcd commit ca6549d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

pkg/controller/vitessshard/reconcile_disk.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ func (r *ReconcileVitessShard) reconcileDisk(ctx context.Context, vts *planetsca
105105

106106
// If disk size has changed and the changes are all ready, mark the shard as ready to cascade. Otherwise, skip this.
107107
if anythingChanged {
108-
rollout.Cascade(vts)
108+
if !*onlineFileSystemExpansion {
109+
rollout.Cascade(vts)
110+
}
109111
err := r.client.Update(ctx, vts)
110112
if err != nil {
111113
return resultBuilder.Error(err)

pkg/controller/vitessshard/reconcile_tablets.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ func (r *ReconcileVitessShard) reconcileTablets(ctx context.Context, vts *planet
182182
UpdateRollingRecreate: func(key client.ObjectKey, obj runtime.Object) {
183183
newObj := obj.(*corev1.Pod)
184184
tablet := tabletMap[key]
185-
r.updatePVCFilesystemResizeAnnotation(ctx, tablet, newObj)
185+
if !*onlineFileSystemExpansion {
186+
r.updatePVCFilesystemResizeAnnotation(ctx, tablet, newObj)
187+
}
186188
vttablet.UpdatePod(newObj, tablet)
187189
},
188190
Status: func(key client.ObjectKey, obj runtime.Object) {

pkg/controller/vitessshard/vitessshard_controller.go

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const (
5050
var (
5151
maxConcurrentReconciles = flag.Int("vitessshard_concurrent_reconciles", 10, "the maximum number of different vitessshards to reconcile concurrently")
5252
resyncPeriod = flag.Duration("vitessshard_resync_period", 30*time.Second, "reconcile vitessshards with this period even if no Kubernetes events occur")
53+
onlineFileSystemExpansion = flag.Bool("enable_online_fs_expansion", true, "if true, pod referencing the resized volume do not need to be restarted, but provided that the volume plug-in supports, such as GCE-PD, AWS-EBS, Cinder, and Ceph RBD")
5354
)
5455

5556
var log = logrus.WithField("controller", "VitessShard")

0 commit comments

Comments
 (0)