Initialize default attach func regardless of the value of flag

Kubernetes-commit: acbbaddada4cf302134962b1d7fd9fb2c0bdba37
This commit is contained in:
Arda Güçlü 2023-12-22 09:50:48 +03:00 committed by Kubernetes Publisher
parent 7ee7011bb3
commit bd6c3274b0
1 changed files with 9 additions and 8 deletions

View File

@ -213,14 +213,15 @@ 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
}
}
// 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
}
// Environment