ManageIQ/kubeclient

KUBERNETES_EXEC_INFO should be passed to exec plugin

blowfishpro opened this issue · 2 comments

Some exec plugins (e.g. aws eks get-token) use the info in this environment variable to determine what to return (including the api version which is checked by kubeclient. I believe it should take the form of a JSON string containing an ExecCredtial resource (see explanation here)

cben commented

One of the things it wants is spec.interactive, should be true if plugin has access to stdin where a user may respond.
I see we currently run plugin with Open3.capture3 which always pipes stdin, but suppose we change that to pass through stdin of the Ruby app using kubeclient. How then do we know if plugins can use stdin interactively? 🤔

  • Should kubeclient check whether stdin is a tty?
  • Do we need a new API? [possibly defaulting to whether stdin is a tty]

[I don't plan to work on this myself, PRs are always welcome]

I believe kubectl does check whether stdin is interactive to decide whether the exec plugin in question is compatible with the current environment.

I believe you can call Open3.capture3('command', stdin: :close) to force it to not be passed.

I guess the other option would be to look for /dev/tty(not sure what the windows equivalent might be) and pass that if available and requested ... that might cover some situations where stdin isn't available for interactivity (due to e.g. piping in a shell).

I have started poking at the code for this although I haven't had much time to dedicate to it. There are some other considerations around exec plugins that have made themselves apparent too though.