Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent client from looking up specific node in oc debug #17028

Merged
Merged
Show file tree
Hide file tree
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
15 changes: 0 additions & 15 deletions pkg/oc/cli/cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,6 @@ func (o *DebugOptions) Complete(cmd *cobra.Command, f *clientcmd.Factory, args [
}
}

// if a nodeName was specified, ensure node exists
if len(o.NodeName) > 0 {
r := f.NewBuilder(true).
NamespaceParam(cmdNamespace).
SingleResourceType().
ResourceTypeOrNameArgs(true, []string{"nodes", o.NodeName}...).
Flatten().
Do()

_, err := r.Infos()
if err != nil {
return err
}
}

config, err := f.ClientConfig()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ os::cmd::expect_success_and_text "oc debug -t dc/test-deployment-config -o yaml"
os::cmd::expect_success_and_not_text "oc debug --tty=false dc/test-deployment-config -o yaml" 'tty'
os::cmd::expect_success_and_not_text "oc debug dc/test-deployment-config -o yaml -- /bin/env" 'stdin'
os::cmd::expect_success_and_not_text "oc debug dc/test-deployment-config -o yaml -- /bin/env" 'tty'
os::cmd::expect_failure_and_text "oc debug dc/test-deployment-config --node-name=invalid -- /bin/env" 'nodes "invalid" not found'
os::cmd::expect_failure_and_text "oc debug dc/test-deployment-config --node-name=invalid -- /bin/env" 'on node "invalid"'
# Does not require a real resource on the server
os::cmd::expect_success_and_not_text "oc debug -T -f examples/hello-openshift/hello-pod.json -o yaml" 'tty'
os::cmd::expect_success_and_text "oc debug -f examples/hello-openshift/hello-pod.json --keep-liveness --keep-readiness -o yaml" ''
Expand Down