cli

package
v0.0.0-...-ebdf71b Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthFailed   = errors.New("authentication failed")
	ErrNoPeer       = fmt.Errorf("%w: no peer in context", ErrAuthFailed)
	ErrNoTLSInfo    = fmt.Errorf("%w: no TLSInfo auth info", ErrAuthFailed)
	ErrNoClientCert = fmt.Errorf("%w: no client certificate in auth info", ErrAuthFailed)
	ErrNoCNInCert   = fmt.Errorf("%w: no CN in client certificate", ErrAuthFailed)
)

Functions

func CNToUser

func CNToUser(ctx context.Context) (context.Context, error)

func ProcSelfArgMaker

func ProcSelfArgMaker(jd job.JobDescription) (cmd string, args []string)

ProcSelfArgMaker returns a command line to run the job in a container. This runs ourself as "/proc/self/exe rc ..."

Types

type CmdList

type CmdList struct {
	All       bool `short:"a" help:"List all user's jobs"`
	Completed bool `short:"c" help:"List completed as well as running jobs"`
	// contains filtered or unexported fields
}

CmdList is a kong struct describing the flags and arguments for the `jobber list` subcommand.

func (*CmdList) Close

func (c *CmdList) Close() error

func (*CmdList) Run

func (cmd *CmdList) Run() error

Run is the entrypoint for the `jobber list` cli command. It packages the command line arguments into a `ListRequest` message and calls the `JobExecutor.List()` method.

It is called by kong after parsing the command line.

type CmdLogs

type CmdLogs struct {
	Follow       bool   `short:"f" help:"Stream logs continuously as they are produced"`
	NoTimestamps bool   `short:"T" help:"Do not output timestamps on lines"`
	JobID        string `arg:"" help:"ID of job to fetch logs from"`
	// contains filtered or unexported fields
}

CmdLogs is a kong struct describing the flags and arguments for the `jobber logs` subcommand.

func (*CmdLogs) Close

func (c *CmdLogs) Close() error

func (*CmdLogs) Run

func (cmd *CmdLogs) Run() error

Run is the entrypoint for the `jobber logs` cli command. It packages the command line arguments into a `LogsRequest` message and calls the `JobExecutor.Logs()` method.

It is called by kong after parsing the command line.

type CmdRun

type CmdRun struct {
	Detach       bool `short:"d" help:"Detach from output when running" xor:"ts"`
	NoTimestamps bool `short:"T" help:"Do not output timestamps on lines" xor:"ts"`

	job.JobSpec
	// contains filtered or unexported fields
}

CmdRun is a kong struct describing the flags and arguments for the `jobber run` subcommand.

func (*CmdRun) Close

func (c *CmdRun) Close() error

func (*CmdRun) Run

func (cmd *CmdRun) Run() error

Run is the entrypoint for the `jobber run` cli command. It packages the command line arguments into a `RunRequest` message and calls the `JobExecutor.Run()` method. If the detach flag is not specified, it calls the `JobExecutor.Logs()` method after a successful run to stream back the logs of the run command.

It is called by kong after parsing the command line.

type CmdRunContainer

type CmdRunContainer struct {
	job.JobSpec
	ID string `required:"" help:"job id"`
}

CmdRunContainer is a hidden entrypoint for the jobber server to be able to run a child process in the correct namespaces so it can first set up those namespaces and cgroups.

func (*CmdRunContainer) Run

func (cmd *CmdRunContainer) Run() error

CmdRunContainer implements `jobber rc` to execute part 2 of the container running process - setting up the cgroup(s) and namespace(s) and execing the job's command.

type CmdRunJob

type CmdRunJob struct {
	job.JobSpec
	ID string `required:"" help:"job id"`
}

CmdRunJob is a hidden entrypoint just for testing the container runner without needing the while jobber server. It is not intended to be user- facing.

func (*CmdRunJob) Run

func (cmd *CmdRunJob) Run() error

CmdRunJob is an internal command for directly running a container. It is not part of the server proper. It is for development testing only.

type CmdServe

type CmdServe struct {
	Listen string   `short:"l" default:":8443" help:"TCP listen address"`
	Admin  []string `help:"admin users with full privileges"`

	TLSCert string `name:"tls-cert" default:"certs/server.crt" help:"TLS server cert"`
	TLSKey  string `name:"tls-key" default:"certs/server.key" help:"TLS server key"`
	CACert  string `name:"ca-cert" default:"certs/ca.crt" help:"CA for authenticating users"`
}

CmdServe is a kong struct describing the flags and arguments for the `jobber serve` subcommand.

func (*CmdServe) Run

func (cmd *CmdServe) Run() error

Run is the entrypoint for the `jobber serve` cli command. It starts a grpc server and serves a fake implementation of the JobExecutor service. gRPC server reflection is enabled on the gRPC server.

type CmdShutdown

type CmdShutdown struct {
	// contains filtered or unexported fields
}

func (*CmdShutdown) Close

func (c *CmdShutdown) Close() error

func (*CmdShutdown) Run

func (cmd *CmdShutdown) Run() error

type CmdStatus

type CmdStatus struct {
	JobID string `arg:"" help:"ID of job to get status of"`
	// contains filtered or unexported fields
}

CmdStatus is a kong struct describing the flags and arguments for the `jobber status` subcommand.

func (*CmdStatus) Close

func (c *CmdStatus) Close() error

func (*CmdStatus) Run

func (cmd *CmdStatus) Run() error

Run is the entrypoint for the `jobber status` cli command. It packages the command line arguments into a `StatusRequest` message and calls the `JobExecutor.Status()` method.

It is called by kong after parsing the command line.

type CmdStop

type CmdStop struct {
	Cleanup bool   `short:"c" help:"Remove job from jobber server after stopping. Can be used on already stopped job"`
	JobID   string `arg:"" help:"ID of job to stop"`
	// contains filtered or unexported fields
}

CmdStop is a kong struct describing the flags and arguments for the `jobber stop` subcommand.

func (*CmdStop) Close

func (c *CmdStop) Close() error

func (*CmdStop) Run

func (cmd *CmdStop) Run() error

Run is the entrypoint for the `jobber stop` cli command. It packages the command line arguments into a `StopRequest` message and calls the `JobExecutor.Stop()` method.

It is called by kong after parsing the command line.

Jump to

Keyboard shortcuts

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