Merge pull request #122447 from ardaguclu/fix-debug-attach

Initialize default attach func regardless of the value of flag
This commit is contained in:
Kubernetes Prow Robot 2023-12-22 10:31:21 +01:00 committed by GitHub
commit 5104e65661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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