Documentation
¶
Index ¶
Constants ¶
const ( // TypePrefix is the grpc type prefix TypePrefix = "type.googleapis.com/envoy.api.v2." // ClusterType is used for cluster discovery. Typically first request received ClusterType = TypePrefix + "Cluster" // EndpointType is used for EDS and ADS endpoint discovery. Typically second request. EndpointType = TypePrefix + "ClusterLoadAssignment" // ListenerType is sent after clusters and endpoints. ListenerType = TypePrefix + "Listener" // RouteType is sent after listeners. RouteType = TypePrefix + "RouteConfiguration" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶ added in v0.3.0
type Endpoint struct { IP string // IP address of the endpoint Region string // Region of the IP (europe-west2) Zone string // zone/AZ of the IP (europe-west2-b) }
Endpoint is the representation of an endpoint and what will be sent to internal consumers
type EndpointsState ¶ added in v0.3.0
type EndpointsState struct {
Endpoints []Endpoint
}
EndpointsState is the list of every known endpoint at a moment. This type aims at making output less misleading It is the "state of the world" as the AggregatedResources stream send them by opposition to sending the diff
type PilotClient ¶
type PilotClient interface { AddWatch(host string, namespace string, port string) (chan EndpointsState, error) Shutdown() RefreshFromRemote() error EdszHandler(w http.ResponseWriter, req *http.Request) IsConnected() (bool, uint32) }
PilotClient is a client to a Pilot Service Discovery Server
func NewPilotClient ¶
func NewPilotClient(ctx context.Context, options PilotClientOptions) (PilotClient, error)
NewPilotClient starts a subscription (gRPC stream) to pilot. When using several gRPC connections, we do not want to open multiple subscriptions to pilot. Therefore, we open only one connection to pilot and use channels for intra-app communication
type PilotClientOptions ¶
type PilotClientOptions struct { // PilotURL is a valid <hostname>:<port> connection string PilotURL string // IP is the IP address of the application running this library IP string // AppName is the application name of the application running this library AppName string // Namespace is the Kubernetes namespace in which the application using this library is running Namespace string // DialOpts are the grpc DialOptions to dial Pilot Server DialOptions []grpc.DialOption // Backoff mechanism is copied from gRPC // Initial retry is at random(0, initialBackoffMS). // In general, the nth attempt will occur at random(0, min(InitialBackoff*BackoffMultiplier**(n-1), MaxBackoff)). // InitialBackOff is the duration. Default to 1 second InitialBackoff time.Duration // MaxBackOff is the maximum duration between 2 connection attempts in case of Pilot disconnection. Default to 2 minutes MaxBackoff time.Duration // BackoffMultiplier is the progression multiplier between initial and max backoff. Default to 1.6 BackoffMultiplier float64 }
PilotClientOptions is a struct gathering every option required to start a PilotClient
func (PilotClientOptions) Validate ¶
func (o PilotClientOptions) Validate() (PilotClientOptions, error)
Validate set defaults & check constraints on PilotClientOptions in case of nil error, the option struct is ready to be safely used by a Pilot client