Skip to content
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

add flag --enable_online_fs_expansion: control whether pods that refe… #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move this check to the beginning of reconcileDisk where it checks vts.Spec.UpdateStrategy.Type and just return resultBuilder.Result() because I don't think this function provides any value when using 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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should make this behavior opt-in because we have no way to know that this will work in a given environment, right? That would mean making the default false. I would recommend:

onlineFileSystemExpansion = flag.Bool("enable_online_fs_expansion", false, "if true, pods referencing the resized volume do not need to be restarted; you must ensure that the CSI driver(s) in use support online resizing, e.g. GCE-PD, AWS-EBS, Cinder, or Ceph RBD")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can at least wait 2 releases before changing the default

)

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