Add comment about why AttachFunc be overridable

Kubernetes-commit: fa37bebcd4b239cc5ad8eb3899d9868b015b34de
This commit is contained in:
Arda Güçlü 2023-08-28 08:36:32 +03:00 committed by Kubernetes Publisher
parent 1e115c1960
commit 53768a14a7
1 changed files with 5 additions and 0 deletions

View File

@ -213,6 +213,11 @@ func (o *DebugOptions) Complete(restClientGetter genericclioptions.RESTClientGet
attachFlag := cmd.Flags().Lookup("attach")
if !attachFlag.Changed && o.Interactive {
o.Attach = true
// Downstream tools may want to use their own customized
// attach function to do extra work or use attach command
// with different flags instead of the static one defined in
// handleAttachPod. But if this function is not set explicitly,
// we fall back to default.
if o.AttachFunc == nil {
o.AttachFunc = o.handleAttachPod
}