Documentation ¶
Index ¶
- func AsSha256(o interface{}) string
- func Contains(sl []string, str string) bool
- func GenerateSnapshot(node *core.Node, mapping Mapping) (*cache.Snapshot, error)
- func KubernetesEndpointWatch(ctx context.Context, fn func(watch.EventType, Slice)) error
- func Namespace() string
- func Run(ctx context.Context, config *viper.Viper, d Discovery)
- func RunManagementServer(ctx context.Context, server xds.Server, port uint, maxConcurrentStreams uint32)
- type Callbacks
- func (cb *Callbacks) OnDeltaStreamClosed(id int64)
- func (cb *Callbacks) OnDeltaStreamOpen(ctx context.Context, id int64, typ string) error
- func (cb *Callbacks) OnFetchRequest(ctx context.Context, req *discoveryv3.DiscoveryRequest) error
- func (cb *Callbacks) OnFetchResponse(req *discoveryv3.DiscoveryRequest, resp *discoveryv3.DiscoveryResponse)
- func (cb *Callbacks) OnStreamClosed(id int64)
- func (cb *Callbacks) OnStreamDeltaRequest(id int64, req *discoveryv3.DeltaDiscoveryRequest) error
- func (cb *Callbacks) OnStreamDeltaResponse(id int64, req *discoveryv3.DeltaDiscoveryRequest, ...)
- func (cb *Callbacks) OnStreamOpen(ctx context.Context, id int64, typ string) error
- func (cb *Callbacks) OnStreamRequest(id int64, req *discoveryv3.DiscoveryRequest) error
- func (cb *Callbacks) OnStreamResponse(ctx context.Context, id int64, req *discoveryv3.DiscoveryRequest, ...)
- func (cb *Callbacks) Report()
- type Discovery
- type DiscoveryImpl
- type Endpoint
- type FilterCache
- func (fc *FilterCache) CreateDeltaWatch(req *cache.DeltaRequest, ss stream.StreamState, resp chan cache.DeltaResponse) (cancel func())
- func (fc *FilterCache) CreateWatch(req *cache.Request, ss stream.StreamState, resp chan cache.Response) (cancel func())
- func (fc *FilterCache) Fetch(ctx context.Context, req *cache.Request) (cache.Response, error)
- type Mapping
- type MockDiscovery
- type Paths
- type Port
- type Slice
- type Topology
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsSha256 ¶
func AsSha256(o interface{}) string
https://blog.8bitzen.com/posts/22-08-2019-how-to-hash-a-struct-in-go
func GenerateSnapshot ¶
GenerateSnapshot creates snapshot for each service
func KubernetesEndpointWatch ¶
func Namespace ¶
func Namespace() string
Namespace provides some Kubernetes Magic: inside kubernetes the /var/run directory is populated with useful information Source: https://github.com/kubernetes/kubernetes/pull/63707#issuecomment-539648137
Types ¶
type Callbacks ¶
type Callbacks struct { Signal chan struct{} Fetches int Requests int // contains filtered or unexported fields }
Callbacks for XD Server
func (*Callbacks) OnDeltaStreamClosed ¶
OnDeltaStreamClosed is called immediately prior to closing an xDS stream with a stream ID.
func (*Callbacks) OnDeltaStreamOpen ¶
OnDeltaStreamOpen is called once an incremental xDS stream is open with a stream ID and the type URL (or "" for ADS). Returning an error will end processing and close the stream. OnStreamClosed will still be called.
func (*Callbacks) OnFetchRequest ¶
func (cb *Callbacks) OnFetchRequest(ctx context.Context, req *discoveryv3.DiscoveryRequest) error
OnFetchRequest type
func (*Callbacks) OnFetchResponse ¶
func (cb *Callbacks) OnFetchResponse(req *discoveryv3.DiscoveryRequest, resp *discoveryv3.DiscoveryResponse)
OnFetchResponse type
func (*Callbacks) OnStreamClosed ¶
OnStreamClosed type
func (*Callbacks) OnStreamDeltaRequest ¶
func (cb *Callbacks) OnStreamDeltaRequest(id int64, req *discoveryv3.DeltaDiscoveryRequest) error
OnStreamDeltaRequest 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) OnStreamDeltaResponse ¶
func (cb *Callbacks) OnStreamDeltaResponse(id int64, req *discoveryv3.DeltaDiscoveryRequest, resp *discoveryv3.DeltaDiscoveryResponse)
OnStreamDelatResponse is called immediately prior to sending a response on a stream.
func (*Callbacks) OnStreamOpen ¶
OnStreamOpen type
func (*Callbacks) OnStreamRequest ¶
func (cb *Callbacks) OnStreamRequest(id int64, req *discoveryv3.DiscoveryRequest) error
OnStreamRequest type
func (*Callbacks) OnStreamResponse ¶
func (cb *Callbacks) OnStreamResponse(ctx context.Context, id int64, req *discoveryv3.DiscoveryRequest, resp *discoveryv3.DiscoveryResponse)
OnStreamResponse type
type DiscoveryImpl ¶
type DiscoveryImpl struct { sync.Mutex Fn func(context.Context, func(t watch.EventType, s Slice)) error // contains filtered or unexported fields }
DiscoveryImpl is a generic discovery layer that hooks to Fn. It generates and emits zoned mappings, by inspecting the Slice's Endpoint information.
func (*DiscoveryImpl) Emit ¶
func (d *DiscoveryImpl) Emit(m Mapping)
func (*DiscoveryImpl) Start ¶
func (d *DiscoveryImpl) Start(ctx context.Context, upstreamServices []string) error
func (*DiscoveryImpl) Watch ¶
func (d *DiscoveryImpl) Watch() <-chan Mapping
Watch always emits the last computed value first, so the consumer can start immediately
type FilterCache ¶
func (*FilterCache) CreateDeltaWatch ¶
func (fc *FilterCache) CreateDeltaWatch(req *cache.DeltaRequest, ss stream.StreamState, resp chan cache.DeltaResponse) (cancel func())
func (*FilterCache) CreateWatch ¶
func (fc *FilterCache) CreateWatch(req *cache.Request, ss stream.StreamState, resp chan cache.Response) (cancel func())
type MockDiscovery ¶
type MockDiscovery struct { DiscoveryImpl // contains filtered or unexported fields }
MockDiscovery 'discovers' from a file like mapping.yaml