supervisor

package
v0.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package supervisor is the executor server's TLS and command supervision.

Index

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

func ServerTLSConfig(certDir, trustDir string) (*tls.Config, error)

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

func SuperviseCommand(control io.Reader, status, stdout, stderr *os.File) error

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.

func (*CommandSupervisor) Start

func (s *CommandSupervisor) Start(
	ctx context.Context, command string, stdout, stderr io.Writer,
) (commands.Process, error)

Start implements commands.Runner.

type WorkspaceHealth

type WorkspaceHealth struct {
	*health.Server
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL