Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HostIP = os.Getenv("HOST_IP")
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func NewAgent ¶
func NewAgent(proxy Proxy, terminationDrainDuration, minDrainDuration time.Duration, localhost string, adminPort, statusPort, prometheusPort int, exitOnZeroActiveConnections bool, ) *Agent
NewAgent creates a new proxy agent for the proxy start-up and clean-up functions.
func (*Agent) DisableDraining ¶
func (a *Agent) DisableDraining()
func (*Agent) Run ¶
Run starts the envoy and waits until it terminates. There are a few exit paths:
- Envoy exits. In this case, we simply log and exit.
- /quitquitquit (on agent, not Envoy) is called. We will set skipDrain and cancel the context, which triggers us to exit immediately.
- SIGTERM. We will drain, wait termination drain duration, then exit. This is the standard pod shutdown; SIGTERM arrives when pod shutdown starts. If the pod's terminationGracePeriod is shorter than our drain duration (rare), we may be a SIGKILL.
- /drain + SIGTERM. This is the shutdown when using Kubernetes native sidecars. /drain is called when the pod shutdown starts. We start draining, forever. Once the app containers shutdown, we get a SIGTERM. We have no use to run anymore, so shutdown immediately. If somehow we do not shutdown from the SIGTERM fast enough, we may get a SIGKILL later.
type Proxy ¶
type Proxy interface { // Run command with an abort channel Run(<-chan error) error // Drains the envoy process. Drain(skipExit bool) error // Cleanup command for cleans up the proxy. Cleanup() // UpdateConfig writes a new config file UpdateConfig(config []byte) error }
Proxy defines command interface for a proxy
func NewProxy ¶
func NewProxy(cfg ProxyConfig) Proxy
NewProxy creates an instance of the proxy control commands
type ProxyConfig ¶
type ProxyConfig struct { LogLevel string ComponentLogLevel string NodeIPs []string Sidecar bool LogAsJSON bool OutlierLogPath string BinaryPath string ConfigPath string ConfigCleanup bool AdminPort int32 DrainDuration *durationpb.Duration Concurrency int32 // For unit testing, in combination with NoEnvoy prevents agent.Run from blocking TestOnly bool AgentIsRoot bool }
Envoy binary flags
Click to show internal directories.
Click to hide internal directories.