package attach
import "k8s.io/kubectl/pkg/cmd/attach"
Index ¶
- func DefaultAttachFunc(o *AttachOptions, containerToAttach *corev1.Container, raw bool, sizeQueue remotecommand.TerminalSizeQueue) func() error
- func NewCmdAttach(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
- type AttachOptions
- func NewAttachOptions(streams genericiooptions.IOStreams) *AttachOptions
- func (o *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- func (o *AttachOptions) GetContainerName(pod *corev1.Pod) (string, error)
- func (o *AttachOptions) Run() error
- func (o *AttachOptions) Validate() error
- type DefaultRemoteAttach
- type RemoteAttach
Functions ¶
func DefaultAttachFunc ¶
func DefaultAttachFunc(o *AttachOptions, containerToAttach *corev1.Container, raw bool, sizeQueue remotecommand.TerminalSizeQueue) func() error
DefaultAttachFunc is the default AttachFunc used
func NewCmdAttach ¶
NewCmdAttach returns the attach Cobra command
Types ¶
type AttachOptions ¶
type AttachOptions struct { exec.StreamOptions // whether to disable use of standard error when streaming output from tty DisableStderr bool CommandName string Pod *corev1.Pod AttachFunc func(*AttachOptions, *corev1.Container, bool, remotecommand.TerminalSizeQueue) func() error Resources []string Builder func() *resource.Builder AttachablePodFn polymorphichelpers.AttachablePodForObjectFunc Attach RemoteAttach GetPodTimeout time.Duration Config *restclient.Config // contains filtered or unexported fields }
AttachOptions declare the arguments accepted by the Attach command
func NewAttachOptions ¶
func NewAttachOptions(streams genericiooptions.IOStreams) *AttachOptions
NewAttachOptions creates the options for attach
func (*AttachOptions) Complete ¶
Complete verifies command line arguments and loads data from the command environment
func (*AttachOptions) GetContainerName ¶
func (o *AttachOptions) GetContainerName(pod *corev1.Pod) (string, error)
GetContainerName returns the name of the container to attach to, with a fallback.
func (*AttachOptions) Run ¶
func (o *AttachOptions) Run() error
Run executes a validated remote execution against a pod.
func (*AttachOptions) Validate ¶
func (o *AttachOptions) Validate() error
Validate checks that the provided attach options are specified.
type DefaultRemoteAttach ¶
type DefaultRemoteAttach struct{}
DefaultRemoteAttach is the standard implementation of attaching
func (*DefaultRemoteAttach) Attach ¶
func (*DefaultRemoteAttach) Attach(url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
Attach executes attach to a running container
type RemoteAttach ¶
type RemoteAttach interface { Attach(url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error }
RemoteAttach defines the interface accepted by the Attach command - provided for test stubbing
Source Files ¶
attach.go
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 23 packages
- Last checked
- 5 days ago –
Tools for package owners.