Documentation
¶
Overview ¶
Package supervisor is the executor server's TLS and command supervision.
Index ¶
- func EnableCommandExecution() error
- func ServerKeepalive(k kubernetes.ExecutorKeepalive) []grpc.ServerOption
- func ServerTLSConfig(certDir, trustDir string) (*tls.Config, error)
- func SuperviseCommand(control io.Reader, status, stdout, stderr *os.File) error
- type CommandSupervisor
- type WorkspaceHealth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableCommandExecution ¶
func EnableCommandExecution() error
EnableCommandExecution makes this process a Linux child subreaper. It must be called by the dedicated executor helper before it starts any other process.
func ServerKeepalive ¶
func ServerKeepalive(k kubernetes.ExecutorKeepalive) []grpc.ServerOption
ServerKeepalive closes a connection, cancelling its calls, when a ping goes unanswered.
func ServerTLSConfig ¶
ServerTLSConfig returns a mutual TLS configuration presenting the key pair in certDir and admitting only clients that chain to the CA bundle in trustDir and carry its client URI. The trust directory is reread for every handshake.
func SuperviseCommand ¶
SuperviseCommand is the per-command helper process. It reads a length-prefixed command from control, runs it with output on stdout and stderr, and stops it when control yields another byte or ends. It writes "started" and then "exit <code> <confirmed>" lines to status, or "noshell" or "failed" when the command never started. The command can neither inherit status nor reopen it through /proc.
Types ¶
type CommandSupervisor ¶
type CommandSupervisor struct {
// contains filtered or unexported fields
}
CommandSupervisor runs each command under its own helper process, a subreaper, so every process a command starts stays attributable to it while other commands run.
func NewCommandSupervisor ¶
func NewCommandSupervisor(helper, env []string, dir string) *CommandSupervisor
NewCommandSupervisor runs helper, an argv whose process calls SuperviseCommand, with env in dir.
func (*CommandSupervisor) ReapOrphans ¶
func (s *CommandSupervisor) ReapOrphans(ctx context.Context, interval time.Duration)
ReapOrphans kills and reaps, every interval until ctx ends, each child of this process that is not a helper. Orphans arrive here when a helper is killed and this process is a subreaper or PID 1.
type WorkspaceHealth ¶
WorkspaceHealth is a gRPC health server that reports the server and its services SERVING only while the workspace accepts a new file in time.
func NewWorkspaceHealth ¶
func NewWorkspaceHealth(root string, services ...string) *WorkspaceHealth
NewWorkspaceHealth reports root and services NOT_SERVING until Run's first check.
func (*WorkspaceHealth) Run ¶
func (h *WorkspaceHealth) Run(ctx context.Context)
Run checks the workspace every interval until ctx ends. A check blocked past its timeout is abandoned, and no other starts until it returns, so stuck storage holds at most one goroutine.