Documentation ¶
Index ¶
- Constants
- Variables
- func AESLicense(cmd *cobra.Command, args []string) error
- func AESLogin(cmd *cobra.Command, args []string) error
- func DaemonWorks() bool
- func DisplayVersion() string
- func DoLogin(kubeinfo *k8s.KubeInfo, context, namespace, hostname string, ...) error
- func GetExe() string
- func GetFreePort() (int, error)
- func IsServerRunning() bool
- func LaunchDaemon(ccmd *cobra.Command, _ []string) error
- func MainViaDaemon() error
- func NewCmdUsage(cmd *cobra.Command, groups []CmdGroup) func(*cobra.Command) error
- func NewLoggingWriter(l *log.Logger) io.Writer
- func Notify(p *supervisor.Process, message string)
- func RunAsDaemon(dns, fallback string) error
- func RunAsTeleproxyBridge(context, namespace string) error
- func RunAsTeleproxyIntercept(dns, fallback string) error
- func SetUpLogging() supervisor.Logger
- func SetVersion(v string)
- func WaitForSignal(p *supervisor.Process) error
- type ClientMessage
- type CmdGroup
- type Daemon
- func (d *Daemon) AddIntercept(p *supervisor.Process, out *Emitter, ii *InterceptInfo) error
- func (d *Daemon) ClearIntercepts(p *supervisor.Process) error
- func (d *Daemon) Connect(p *supervisor.Process, out *Emitter, rai *RunAsInfo, ...) error
- func (d *Daemon) Disconnect(p *supervisor.Process, out *Emitter) error
- func (d *Daemon) GetRootCommand(p *supervisor.Process, out *Emitter, data *ClientMessage) *cobra.Command
- func (d *Daemon) ListIntercepts(_ *supervisor.Process, out *Emitter) error
- func (d *Daemon) MakeNetOverride(p *supervisor.Process) error
- func (d *Daemon) RemoveIntercept(p *supervisor.Process, out *Emitter, name string) error
- func (d *Daemon) Status(_ *supervisor.Process, out *Emitter) error
- type DaemonFormatter
- type Emitter
- func (out *Emitter) Err() error
- func (out *Emitter) Print(a ...interface{})
- func (out *Emitter) Printf(format string, a ...interface{})
- func (out *Emitter) Println(a ...interface{})
- func (out *Emitter) Send(key string, value interface{})
- func (out *Emitter) SendExit(code int)
- func (out *Emitter) SetKV()
- type Intercept
- type InterceptInfo
- func (ii *InterceptInfo) Acquire(_ *supervisor.Process, tm *TrafficManager) (int, error)
- func (ii *InterceptInfo) PreviewURL(hostname string) (url string)
- func (ii *InterceptInfo) Release(_ *supervisor.Process, tm *TrafficManager, port int) error
- func (ii *InterceptInfo) Retain(_ *supervisor.Process, tm *TrafficManager, port int) error
- type KCluster
- func (c *KCluster) Context() string
- func (c *KCluster) GetKubectlArgs(args ...string) []string
- func (c *KCluster) GetKubectlArgsNoNamespace(args ...string) []string
- func (c *KCluster) GetKubectlCmd(p *supervisor.Process, args ...string) *supervisor.Cmd
- func (c *KCluster) GetKubectlCmdNoNamespace(p *supervisor.Process, args ...string) *supervisor.Cmd
- func (c *KCluster) RAI() *RunAsInfo
- func (c *KCluster) Server() string
- func (c *KCluster) SetBridgeCheck(isBridgeOkay func() bool)
- type LoginClaimsV1
- type Resource
- type ResourceBase
- type RunAsInfo
- type Scout
- type ScoutMeta
- type TrafficManager
Constants ¶
const ExitPrefix = "-- exit "
ExitPrefix is the token used by the daemon ot tell the client to exit with the specified status
const SecretName = "ambassador-internal"
Variables ¶
var DaemonHelp = `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
` + logfile + `
to troubleshoot problems.
`
var Version = "(unknown version)"
Functions ¶
func DaemonWorks ¶
func DaemonWorks() bool
DaemonWorks returns whether the daemon can function on this platform
func DisplayVersion ¶
func DisplayVersion() string
DisplayVersion returns a printable version for `edgectl`
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use. Similar to telepresence.utilities.find_free_port()
func IsServerRunning ¶
func IsServerRunning() bool
func MainViaDaemon ¶
func MainViaDaemon() error
func NewCmdUsage ¶
NewCmdUsage constructs a cobra UsageFunc for a command based on the command groups passed in. Requires that the command has exactly the subcommands mentioned in the groups, panicking otherwise.
func NewLoggingWriter ¶
NewLoggingWriter returns an io.Writer that logs each write line-by-line blindly passing through non-UTF-8 and over-long lines.
func Notify ¶
func Notify(p *supervisor.Process, message string)
Notify displays a desktop banner notification to the user
func RunAsDaemon ¶
RunAsDaemon is the main function when executing as the daemon
func RunAsTeleproxyBridge ¶
RunAsTeleproxyBridge is the main function when executing as teleproxy bridge
func RunAsTeleproxyIntercept ¶
RunAsTeleproxyIntercept is the main function when executing as teleproxy intercept
func SetUpLogging ¶
func SetUpLogging() supervisor.Logger
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 ClientMessage ¶
type ClientMessage struct { Args []string RAI *RunAsInfo APIVersion int ClientVersion string InstallID string }
ClientMessage contains everything the daemon needs to process a user's command
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon represents the state of the Edge Control Daemon
func (*Daemon) AddIntercept ¶
func (d *Daemon) AddIntercept(p *supervisor.Process, out *Emitter, ii *InterceptInfo) error
AddIntercept adds one intercept
func (*Daemon) ClearIntercepts ¶
func (d *Daemon) ClearIntercepts(p *supervisor.Process) error
ClearIntercepts removes all intercepts
func (*Daemon) Connect ¶
func (d *Daemon) Connect( p *supervisor.Process, out *Emitter, rai *RunAsInfo, context, namespace, managerNs string, kargs []string, installID string, isCI bool, ) error
Connect the daemon to a cluster
func (*Daemon) Disconnect ¶
func (d *Daemon) Disconnect(p *supervisor.Process, out *Emitter) error
Disconnect from the connected cluster
func (*Daemon) GetRootCommand ¶
func (d *Daemon) GetRootCommand(p *supervisor.Process, out *Emitter, data *ClientMessage) *cobra.Command
func (*Daemon) ListIntercepts ¶
func (d *Daemon) ListIntercepts(_ *supervisor.Process, out *Emitter) error
ListIntercepts lists active intercepts
func (*Daemon) MakeNetOverride ¶
func (d *Daemon) MakeNetOverride(p *supervisor.Process) error
MakeNetOverride sets up the network override resource for the daemon
func (*Daemon) RemoveIntercept ¶
RemoveIntercept removes one intercept by name
type DaemonFormatter ¶
type DaemonFormatter struct {
TimestampFormat string
}
DaemonFormatter formats log messages for the Edge Control Daemon
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter provides a convenient way to send data to the client and handle errors in one spot.
func NewEmitter ¶
NewEmitter returns a new Emitter to write to conn
func (*Emitter) Print ¶
func (out *Emitter) Print(a ...interface{})
Print formats using the default formats for its operands and writes to the client. Errors are collected and returned by Err().
func (*Emitter) Printf ¶
Printf formats according to a format specifier and writes to the client. Errors are collected and returned by Err().
func (*Emitter) Println ¶
func (out *Emitter) Println(a ...interface{})
Println formats using the default formats for its operands and writes to the client, ending output with a newline. Errors are collected and returned by Err().
func (*Emitter) Send ¶
Send a key/value pair to the client if the Emitter is in key/value mode. Errors are collected and returned by Err().
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, out *Emitter, tm *TrafficManager, cluster *KCluster, ii *InterceptInfo) (*Intercept, error)
MakeIntercept acquires an intercept and returns a Resource handle for it
type InterceptInfo ¶
type InterceptInfo struct { Name string // Name of the intercept (user/logging) Namespace string // Namespace in which to create the Intercept mapping Deployment string // Name of the deployment being intercepted Prefix string // Prefix to intercept (default /) Patterns map[string]string TargetHost string TargetPort int }
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) GetKubectlArgs ¶
GetKubectlArgs returns the kubectl command arguments to run a kubectl command with this cluster, including the namespace argument.
func (*KCluster) GetKubectlArgsNoNamespace ¶
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) SetBridgeCheck ¶
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 LoginClaimsV1 ¶
type LoginClaimsV1 struct { LoginTokenVersion string `json:"login_token_version"` jwt.StandardClaims }
type Resource ¶
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) IsOkay ¶
func (rb *ResourceBase) IsOkay() bool
IsOkay returns whether the resource is okay as far as monitoring is aware
type RunAsInfo ¶
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 GetRunAsInfo ¶
GetRunAsInfo returns an RAI for the current user context
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 Scout ¶
func (*Scout) SetMetadatum ¶
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.