Skip to content

Commit

Permalink
add flag --enable_online_fs_expansion: control whether pods that refe…
Browse files Browse the repository at this point in the history
…rence 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]>
  • Loading branch information
zhiyong.huang committed Dec 10, 2021
1 parent 809bfcd commit 60ad4b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/controller/vitessshard/reconcile_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ func (r *ReconcileVitessShard) reconcileDisk(ctx context.Context, vts *planetsca

// If disk size has changed and the changes are all ready, mark the shard as ready to cascade. Otherwise, skip this.
if anythingChanged {
rollout.Cascade(vts)
if !*onlineFileSystemExpansion {
rollout.Cascade(vts)
}
err := r.client.Update(ctx, vts)
if err != nil {
return resultBuilder.Error(err)
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller/vitessshard/reconcile_tablets.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ func (r *ReconcileVitessShard) reconcileTablets(ctx context.Context, vts *planet
UpdateRollingRecreate: func(key client.ObjectKey, obj runtime.Object) {
newObj := obj.(*corev1.Pod)
tablet := tabletMap[key]
r.updatePVCFilesystemResizeAnnotation(ctx, tablet, newObj)
if !*onlineFileSystemExpansion {
r.updatePVCFilesystemResizeAnnotation(ctx, tablet, newObj)
}
vttablet.UpdatePod(newObj, tablet)
},
Status: func(key client.ObjectKey, obj runtime.Object) {
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/vitessshard/vitessshard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
var (
maxConcurrentReconciles = flag.Int("vitessshard_concurrent_reconciles", 10, "the maximum number of different vitessshards to reconcile concurrently")
resyncPeriod = flag.Duration("vitessshard_resync_period", 30*time.Second, "reconcile vitessshards with this period even if no Kubernetes events occur")
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")
)

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

0 comments on commit 60ad4b5

Please sign in to comment.