daemon

package
v1.14.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Help = `The Edge Control Daemon is a long-lived background component that manages
connections and network state.

Launch the Edge Control Daemon:
    sudo edgectl daemon

Examine the Daemon's log output in
    ` + edgectl.Logfile + `
to troubleshoot problems.
`

Functions

func GetFreePort

func GetFreePort() (int, error)

GetFreePort asks the kernel for a free open port that is ready to use. Similar to telepresence.utilities.find_free_port()

func Notify

func Notify(p *supervisor.Process, message string)

Notify displays a desktop banner notification to the user

func RunAsDaemon

func RunAsDaemon(dns, fallback string) error

RunAsDaemon is the main function when executing as the daemon

func RunAsTeleproxyBridge

func RunAsTeleproxyBridge(context, namespace string) error

RunAsTeleproxyBridge is the main function when executing as teleproxy bridge

func RunAsTeleproxyIntercept

func RunAsTeleproxyIntercept(dns, fallback string) error

RunAsTeleproxyIntercept is the main function when executing as teleproxy intercept

func SetUpLogging

func SetUpLogging(ctx context.Context) context.Context

SetUpLogging sets up standard Edge Control Daemon logging

func WaitForSignal

func WaitForSignal(p *supervisor.Process) error

WaitForSignal is a Worker that calls Shutdown if SIGINT or SIGTERM is received.

Types

type DaemonFormatter

type DaemonFormatter struct {
	TimestampFormat string
}

DaemonFormatter formats log messages for the Edge Control Daemon

func (*DaemonFormatter) Format

func (f *DaemonFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format implement logrus.Formatter

type Intercept

type Intercept struct {
	ResourceBase
	// contains filtered or unexported fields
}

Intercept is a Resource handle that represents a live intercept

func MakeIntercept

func MakeIntercept(p *supervisor.Process, tm *TrafficManager, cluster *KCluster, ii *InterceptInfo) (*Intercept, error)

MakeIntercept acquires an intercept and returns a Resource handle for it

type InterceptInfo

type InterceptInfo struct {
	*rpc.InterceptRequest
}

InterceptInfo tracks one intercept operation

func (*InterceptInfo) Acquire

func (ii *InterceptInfo) Acquire(_ *supervisor.Process, tm *TrafficManager) (int, error)

Acquire an intercept from the traffic manager

func (*InterceptInfo) PreviewURL

func (ii *InterceptInfo) PreviewURL(hostname string) (url string)

PreviewURL returns the Service Preview URL for this intercept if it is configured appropriately, or the empty string otherwise.

func (*InterceptInfo) Release

func (ii *InterceptInfo) Release(_ *supervisor.Process, tm *TrafficManager, port int) error

Release the given intercept.

func (*InterceptInfo) Retain

func (ii *InterceptInfo) Retain(_ *supervisor.Process, tm *TrafficManager, port int) error

Retain the given intercept. This likely needs to be called every five seconds or so.

type KCluster

type KCluster struct {
	ResourceBase
	// contains filtered or unexported fields
}

KCluster is a Kubernetes cluster reference

func TrackKCluster

func TrackKCluster(
	p *supervisor.Process, rai *RunAsInfo, context, namespace string, kargs []string,
) (*KCluster, error)

TrackKCluster tracks connectivity to a cluster

func (*KCluster) Context

func (c *KCluster) Context() string

Context returns the cluster's context name

func (*KCluster) GetKubectlArgs

func (c *KCluster) GetKubectlArgs(args ...string) []string

GetKubectlArgs returns the kubectl command arguments to run a kubectl command with this cluster, including the namespace argument.

func (*KCluster) GetKubectlArgsNoNamespace

func (c *KCluster) GetKubectlArgsNoNamespace(args ...string) []string

GetKubectlArgsNoNamespace returns the kubectl command arguments to run a kubectl command with this cluster, but without the namespace argument.

func (*KCluster) GetKubectlCmd

func (c *KCluster) GetKubectlCmd(p *supervisor.Process, args ...string) *supervisor.Cmd

GetKubectlCmd returns a Cmd that runs kubectl with the given arguments and the appropriate environment to talk to the cluster

func (*KCluster) GetKubectlCmdNoNamespace

func (c *KCluster) GetKubectlCmdNoNamespace(p *supervisor.Process, args ...string) *supervisor.Cmd

GetKubectlCmdNoNamespace returns a Cmd that runs kubectl with the given arguments and the appropriate environment to talk to the cluster, but it doesn't supply a namespace arg.

func (*KCluster) RAI

func (c *KCluster) RAI() *RunAsInfo

RAI returns the RunAsInfo for this cluster

func (*KCluster) Server

func (c *KCluster) Server() string

Server returns the cluster's server configuration

func (*KCluster) SetBridgeCheck

func (c *KCluster) SetBridgeCheck(isBridgeOkay func() bool)

SetBridgeCheck sets the callable used to check whether the Teleproxy bridge is functioning. If this is nil/unset, cluster monitoring checks the cluster directly (via kubectl)

type Resource

type Resource interface {
	Name() string
	IsOkay() bool
	Close() error
}

Resource represents one thing managed by edgectl daemon. Examples include network intercepts (via teleproxy intercept) and cluster connectivity.

func CheckedRetryingCommand

func CheckedRetryingCommand(
	p *supervisor.Process, name string, args []string, rai *RunAsInfo,
	check func(*supervisor.Process) error, startGrace time.Duration,
) (Resource, error)

CheckedRetryingCommand launches a command, restarting it repeatedly if it quits, and killing and restarting it if it fails the given check.

type ResourceBase

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

ResourceBase has helpers to create a monitored resource

func (*ResourceBase) Close

func (rb *ResourceBase) Close() error

Close shuts down this resource

func (*ResourceBase) IsOkay

func (rb *ResourceBase) IsOkay() bool

IsOkay returns whether the resource is okay as far as monitoring is aware

func (*ResourceBase) Name

func (rb *ResourceBase) Name() string

Name implements Resource

type RunAsInfo

type RunAsInfo struct {
	Name string
	Cwd  string
	Env  []string
}

RunAsInfo contains the information required to launch a subprocess as the user such that it is likely to function as if the user launched it themselves.

func GuessRunAsInfo

func GuessRunAsInfo(p *supervisor.Process) (*RunAsInfo, error)

GuessRunAsInfo attempts to construct a RunAsInfo for the user logged in at the primary display

func (*RunAsInfo) Command

func (rai *RunAsInfo) Command(p *supervisor.Process, args ...string) *supervisor.Cmd

Command returns a supervisor.Cmd that is configured to run a subprocess as the user in this context.

type TrafficManager

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

TrafficManager is a handle to access the Traffic Manager in a cluster.

func NewTrafficManager

func NewTrafficManager(p *supervisor.Process, cluster *KCluster, managerNs string, installID string, isCI bool) (*TrafficManager, error)

NewTrafficManager returns a TrafficManager resource for the given cluster if it has a Traffic Manager service.

func (*TrafficManager) Close

func (tm *TrafficManager) Close() error

Close implements Resource

func (*TrafficManager) IsOkay

func (tm *TrafficManager) IsOkay() bool

IsOkay implements Resource

func (*TrafficManager) Name

func (tm *TrafficManager) Name() string

Name implements Resource

Jump to

Keyboard shortcuts

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