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
Update Exec and Portforward client to use pod subresource #7715
Conversation
@smarterclayton ptal |
doStdin := (e.stdin != nil) | ||
doStdout := (e.stdout != nil) | ||
doStderr := (!e.tty && e.stderr != nil) | ||
|
||
if doStdin { | ||
e.req.Param(api.ExecStdinParam, "1") | ||
e.req.Param("stdin", "true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where'd these constants go? Deleted? If so, you should be creating an api.ExecOptions and then converting it to the desired API version, then converting it to a map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton they weren't deleted, just not applicable anymore. They were for the internal endpoint. I will use the api.ExecOptions object to do the conversion.
Updated parameter conversion for exec |
Moved conversion code under pkg/conversion |
func RunPortForward(f *cmdutil.Factory, cmd *cobra.Command, args []string) error { | ||
podName := cmdutil.GetFlagString(cmd, "pod") | ||
if len(podName) == 0 { | ||
type portForwardCmd struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this abstraction? Seems overly complex, not sure what you're trying to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only reason is to test... abstract out call to portforward.New(...) and following call to that object's ForwardPorts method. I'll think of a way to simplify it.
complexity reduced |
return fw.ForwardPorts() | ||
} | ||
|
||
func runPortForward(f *cmdutil.Factory, cmd *cobra.Command, args []string, fw portForwarder) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no longer public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be. It's only used by the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our pattern is that all of these are public.
JSON struct tags are used as parameter names, fields that do not have the omitempty marker are always included.
reverted to public functions |
LGTM |
Update Exec and Portforward client to use pod subresource
Switches cli cmd for portfoward and exec to use /pods/[name]/exec and /pod/[name]/portforward