envoy

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 81 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBootstrapConfig added in v0.5.0

func GenerateBootstrapConfig(host string, port uint32) (string, error)

GenerateBootstrapConfig returns the json serialized representation of an envoy bootstrap object that can be passed as the configuration file to an envoy proxy so it can connect to the discovery service.

func GenerateTlsCertificateSdsConfig added in v0.5.0

func GenerateTlsCertificateSdsConfig(host string, port uint32) (string, error)

func NewSecret

func NewSecret(name, privateKey, certificateChain string) *auth.Secret

NewSecret generates a new envoy api secret struct from the given params

func ResourcesToJSON added in v0.4.1

func ResourcesToJSON(pb proto.Message) ([]byte, error)

ResourcesToJSON serializes a protobuf message into a json string

Types

type B64JSON added in v0.4.1

type B64JSON struct{}

func (B64JSON) Unmarshal added in v0.4.1

func (s B64JSON) Unmarshal(str string, res xds_cache_types.Resource) error

type Callbacks

type Callbacks struct {
	OnError       func(nodeID, previousVersion, msg string) error
	SnapshotCache *cache.SnapshotCache
}

Callbacks is a type that implements go-control-plane/pkg/server/Callbacks

func (*Callbacks) OnFetchRequest

func (cb *Callbacks) OnFetchRequest(ctx context.Context, req *v2.DiscoveryRequest) error

OnFetchRequest implements go-control-plane/pkg/server/Callbacks.OnFetchRequest OnFetchRequest is called for each Fetch request. Returning an error will end processing of the request and respond with an error.

func (*Callbacks) OnFetchResponse

func (cb *Callbacks) OnFetchResponse(req *v2.DiscoveryRequest, resp *v2.DiscoveryResponse)

OnFetchResponse implements go-control-plane/pkg/server/Callbacks.OnFetchRequest OnFetchResponse is called immediately prior to sending a response.

func (*Callbacks) OnStreamClosed

func (cb *Callbacks) OnStreamClosed(id int64)

OnStreamClosed implements go-control-plane/pkg/server/Callbacks.OnStreamClosed OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID.

func (*Callbacks) OnStreamOpen

func (cb *Callbacks) OnStreamOpen(ctx context.Context, id int64, typ string) error

OnStreamOpen implements go-control-plane/pkg/server/Callbacks.OnStreamOpen Returning an error will end processing and close the stream. OnStreamClosed will still be called.

func (*Callbacks) OnStreamRequest

func (cb *Callbacks) OnStreamRequest(id int64, req *v2.DiscoveryRequest) error

OnStreamRequest implements go-control-plane/pkg/server/Callbacks.OnStreamRequest OnStreamRequest is called once a request is received on a stream. Returning an error will end processing and close the stream. OnStreamClosed will still be called.

func (*Callbacks) OnStreamResponse

func (cb *Callbacks) OnStreamResponse(id int64, req *v2.DiscoveryRequest, rsp *v2.DiscoveryResponse)

OnStreamResponse implements go-control-plane/pkgserver/Callbacks.OnStreamResponse OnStreamResponse is called immediately prior to sending a response on a stream.

type JSON added in v0.4.1

type JSON struct{}

func (JSON) Marshal added in v0.4.1

func (s JSON) Marshal(res xds_cache_types.Resource) (string, error)

func (JSON) Unmarshal added in v0.4.1

func (s JSON) Unmarshal(str string, res xds_cache_types.Resource) error

type ResourceMarshaller added in v0.4.1

type ResourceMarshaller interface {
	Marshal(xds_cache_types.Resource) (string, error)
}

type ResourceUnmarshaller added in v0.4.1

type ResourceUnmarshaller interface {
	Unmarshal(string, xds_cache_types.Resource) error
}

type Resources added in v0.4.1

type Resources struct {
	Clusters  []*envoyapi.Cluster  `protobuf:"bytes,2,rep,name=clusters,json=clusters" json:"clusters"`
	Listeners []*envoyapi.Listener `protobuf:"bytes,4,rep,name=listeners,json=listeners" json:"listeners"`
}

Resources is a struct that holds the different envoy resources types so it can be deserialized directly from the yaml representation

func YAMLtoResources added in v0.4.1

func YAMLtoResources(data []byte) (*Resources, error)

YAMLtoResources -> DeserializeYAML([]byte(configMap.Data["config.yaml"]))

func (*Resources) ProtoMessage added in v0.4.1

func (*Resources) ProtoMessage()

ProtoMessage is noop function for resFromFile to implement protobuf interface

func (*Resources) Reset added in v0.4.1

func (m *Resources) Reset()

Reset is noop function for resFromFile to implement protobuf interface

func (*Resources) String added in v0.4.1

func (m *Resources) String() string

String is noop function for resFromFile to implement protobuf interface

type XdsServer

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

XdsServer is a type that holds configuration and runtime objects for the envoy xds server

func NewXdsServer

func NewXdsServer(ctx context.Context, adsPort uint, tlsConfig *tls.Config,
	callbacks *Callbacks) *XdsServer

NewXdsServer creates a new XdsServer object fron the given params

func (*XdsServer) GetSnapshotCache

func (xdss *XdsServer) GetSnapshotCache() *cache.SnapshotCache

GetSnapshotCache returns the xds_cache.SnapshotCache

func (*XdsServer) Start added in v0.4.1

func (xdss *XdsServer) Start(stopCh <-chan struct{}) error

Start starts an xDS server at the given port.

type YAML added in v0.4.1

type YAML struct{}

func (YAML) Unmarshal added in v0.4.1

func (s YAML) Unmarshal(str string, res xds_cache_types.Resource) error

Jump to

Keyboard shortcuts

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