Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/oc/cli/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ type DebugOptions struct {
FullCmdName string
Image string

// IsNode is set after we see the object we're debugging. We use it to be able to print pertinent advice.
IsNode bool

resource.FilenameOptions
genericclioptions.IOStreams
}
Expand Down Expand Up @@ -426,6 +429,9 @@ func (o *DebugOptions) RunDebug() error {
} else {
fmt.Fprintf(o.ErrOut, "Starting pod/%s ...\n", pod.Name)
}
if o.IsNode {
fmt.Fprintf(o.ErrOut, "To directly access the host PATH, try `chroot /host /bin/bash`\n")
}

ctx, cancel := context.WithTimeout(context.Background(), o.Timeout)
defer cancel()
Expand Down Expand Up @@ -737,6 +743,7 @@ func containerNames(pod *corev1.Pod) []string {
func (o *DebugOptions) approximatePodTemplateForObject(object runtime.Object) (*corev1.PodTemplateSpec, error) {
switch t := object.(type) {
case *corev1.Node:
o.IsNode = true
if len(o.NodeName) > 0 {
return nil, fmt.Errorf("you may not set --node-name when debugging a node")
}
Expand Down