Merge pull request #120344 from rohitssingh/disable_force_detach

Add a flag to disable force detach behavior in kube-controller-manager
This commit is contained in:
Kubernetes Prow Robot
2024-02-22 13:02:38 -08:00
committed by GitHub
11 changed files with 225 additions and 47 deletions

View File

@@ -389,6 +389,7 @@ func startPersistentVolumeAttachDetachController(ctx context.Context, controller
GetDynamicPluginProber(controllerContext.ComponentConfig.PersistentVolumeBinderController.VolumeConfiguration),
controllerContext.ComponentConfig.AttachDetachController.DisableAttachDetachReconcilerSync,
controllerContext.ComponentConfig.AttachDetachController.ReconcilerSyncLoopPeriod.Duration,
controllerContext.ComponentConfig.AttachDetachController.DisableForceDetachOnTimeout,
attachdetach.DefaultTimerConfig,
)
if attachDetachControllerErr != nil {

View File

@@ -37,6 +37,7 @@ func (o *AttachDetachControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.BoolVar(&o.DisableAttachDetachReconcilerSync, "disable-attach-detach-reconcile-sync", false, "Disable volume attach detach reconciler sync. Disabling this may cause volumes to be mismatched with pods. Use wisely.")
fs.DurationVar(&o.ReconcilerSyncLoopPeriod.Duration, "attach-detach-reconcile-sync-period", o.ReconcilerSyncLoopPeriod.Duration, "The reconciler sync wait time between volume attach detach. This duration must be larger than one second, and increasing this value from the default may allow for volumes to be mismatched with pods.")
fs.BoolVar(&o.DisableForceDetachOnTimeout, "disable-force-detach-on-timeout", false, "Prevent force detaching volumes based on maximum unmount time and node status. If this flag is set to true, the non-graceful node shutdown feature must be used to recover from node failure. See https://k8s.io/docs/storage-disable-force-detach-on-timeout/.")
}
// ApplyTo fills up AttachDetachController config with options.
@@ -47,6 +48,7 @@ func (o *AttachDetachControllerOptions) ApplyTo(cfg *attachdetachconfig.AttachDe
cfg.DisableAttachDetachReconcilerSync = o.DisableAttachDetachReconcilerSync
cfg.ReconcilerSyncLoopPeriod = o.ReconcilerSyncLoopPeriod
cfg.DisableForceDetachOnTimeout = o.DisableForceDetachOnTimeout
return nil
}