process

package
v1.14.16-dcf8320c8c4e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthCheck

type HealthCheck struct {
	url.URL

	// HealthCheckPollInterval is the interval which will be used for polling the
	// endpoint described by Host, Port, and Path.
	//
	// If left empty it will default to 100 Milliseconds.
	PollInterval time.Duration
}

HealthCheck describes the information needed to health-check a process via some health-check URL.

type ListenAddr

type ListenAddr struct {
	Address string
	Port    string
}

ListenAddr represents some listening address and port.

func (*ListenAddr) HostPort

func (l *ListenAddr) HostPort() string

HostPort returns the joined host-port pair for this address.

func (*ListenAddr) URL

func (l *ListenAddr) URL(scheme string, path string) *url.URL

URL returns a URL for this address with the given scheme and subpath.

type State

type State struct {
	Cmd *exec.Cmd

	// HealthCheck describes how to check if this process is up.  If we get an http.StatusOK,
	// we assume the process is ready to operate.
	//
	// For example, the /healthz endpoint of the k8s API server, or the /health endpoint of etcd.
	HealthCheck *HealthCheck

	Dir  string
	Args []string
	Env  []string

	StopTimeout  time.Duration
	StartTimeout time.Duration

	Path string
	// contains filtered or unexported fields
}

State define the state of the process.

func (*State) CheckFlag

func (ps *State) CheckFlag(flag string) (bool, error)

CheckFlag checks the help output of this command for the presence of the given flag, specified without the leading `--` (e.g. `CheckFlag("insecure-port")` checks for `--insecure-port`), returning true if the flag is present.

func (*State) Exited

func (ps *State) Exited() (bool, error)

Exited returns true if the process exited, and may also return an error (as per Cmd.Wait) if the process did not exit with error code 0.

func (*State) Init

func (ps *State) Init(name string) error

Init sets up this process, configuring binary paths if missing, initializing temporary directories, etc.

This defaults all defaultable fields.

func (*State) Start

func (ps *State) Start(ctx context.Context, stdout io.Writer, stderr io.Writer) (err error)

Start starts the apiserver, waits for it to come up, and returns an error, if occurred.

func (*State) Stop

func (ps *State) Stop() error

Stop stops this process gracefully, waits for its termination.

Directories

Path Synopsis
Package flock is copied from k8s.io/kubernetes/pkg/util/flock to avoid importing k8s.io/kubernetes as a dependency.
Package flock is copied from k8s.io/kubernetes/pkg/util/flock to avoid importing k8s.io/kubernetes as a dependency.

Jump to

Keyboard shortcuts

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