Documentation
¶
Overview ¶
Package exec runs an interactive shell in a container, proxied through this process.
This is the first genuinely destructive capability kubeside has, which is why the guardrails and the permission resolver landed before it. Nothing here decides whether a session may start: the caller checks the environment's write policy and asks the cluster for pods/exec, and only then opens a session.
The browser never talks to an apiserver. Keystrokes arrive over the local websocket, cross into a SPDY stream here, and the credentials stay in this process, exactly as every other read does.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCommand = []string{"/bin/sh", "-c", "command -v bash >/dev/null 2>&1 && exec bash || exec sh"}
DefaultCommand is the shell to run when nobody named one.
bash first, sh second, in one invocation: an alpine container has no bash, and failing on it would send the developer back to a terminal for the one thing they came here to avoid.
The test has to come before the exec, not after it. A failed exec replaces the shell with nothing and exits 127; it never reaches an "||" branch, which is precisely how the first version of this failed against an alpine image.
Functions ¶
Types ¶
type Executor ¶
Executor runs one session against a cluster. Keeping it an interface lets the plumbing be tested without an apiserver, which matters more here than anywhere else in the product.
type KubeExecutor ¶
type KubeExecutor struct {
// RESTConfig returns the config for one context, which is where credential
// plugins run.
RESTConfig func(contextName string) (*rest.Config, error)
}
KubeExecutor runs the session against a cluster, the same mechanism kubectl exec uses. Credentials stay in this process: the browser never holds one.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is one running shell.
func (*Session) Close ¶
func (s *Session) Close()
Close ends the session. Closing the tab must end the shell in the cluster, not leave one running with nobody attached.
type Size ¶
Size is a terminal window. A shell that does not know it wraps every line wrongly, which makes a terminal unusable rather than merely ugly.