Documentation ¶
Index ¶
- Constants
- Variables
- func NewRequest(key, value int) []byte
- func TestJoin(t *testing.T, s1 *Server, other ...*Server)
- func TrackLeader(b backend.SystemView, f func(ctx context.Context))
- type Config
- type EnvoyClient
- func (e *EnvoyClient) Close() error
- func (e *EnvoyClient) DeltaAggregatedResources(envoydisc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
- func (e *EnvoyClient) EmitStats(period time.Duration, stopCh <-chan struct{})
- func (e *EnvoyClient) IsEnabled() bool
- func (e *EnvoyClient) RegisterEgressAddress(name string, addr string, port int)
- func (e *EnvoyClient) RegisterIngressAddress(name string, port int)
- func (e *EnvoyClient) Resolve(addr *net.TCPAddr) *net.TCPAddr
- func (e *EnvoyClient) StreamAggregatedResources(stream envoydisc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
- type EnvoyConfig
- type Proxy
- type ProxyType
- type RPCType
- type RaftLayer
- type Server
- func (s *Server) IsLeader() bool
- func (s *Server) Join(peers []string) (int, error)
- func (s *Server) Leader() string
- func (s *Server) LeaderCh() chan bool
- func (s *Server) Leave() error
- func (s *Server) Members() []serf.Member
- func (s *Server) Peers() (reply []string)
- func (s *Server) RPC(method string, args interface{}, reply interface{}) error
- func (s *Server) RPCRemote(server string, method string, args interface{}, reply interface{}) error
- func (s *Server) ReconcileCh() chan serf.Member
- func (s *Server) RegisterRPC(rcvr interface{})
- func (s *Server) Resolve(addr *net.TCPAddr) *net.TCPAddr
- func (s *Server) Shutdown() error
- type SetRequest
- type SimpleFSM
- type State
- type Status
- type Telemetry
Constants ¶
const ( // ClusterType is the TypeURL for Cluster discovery responses. ClusterType = typePrefix + "Cluster" // ListenerType is the TypeURL for Listener discovery responses. ListenerType = typePrefix + "Listener" )
Variables ¶
var ConsulBootstrapLimit = 10
ConsulBootstrapLimit is the maximum members to expect in a consul datacenter
var DiscoverBootstrapLimit = 10
DiscoverBootstrapLimit is the limit of attempts for the serf agent to try to join a cluster
Functions ¶
func NewRequest ¶
func TrackLeader ¶
func TrackLeader(b backend.SystemView, f func(ctx context.Context))
TrackLeader is a helper function that runs a callback when the node is set as the leadedr
Types ¶
type Config ¶
type Config struct { NodeName string ServiceName string DataDir string RPCAddr *net.TCPAddr RetryJoin []string AdvertiseAddr *net.IPAddr SerfConfig *serf.Config ConsulConfig *consul.Config RaftConfig *raft.Config BootstrapExpected int32 LogOutput io.Writer Backend backend.Backend Telemetry *Telemetry Envoy *EnvoyConfig }
Config for the cluster server
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a cluster server config with default values
type EnvoyClient ¶
type EnvoyClient struct { IngressPorts []Proxy EgressPorts []Proxy // contains filtered or unexported fields }
EnvoyClient is the control plane for envoy
func NewEnvoyClient ¶
func NewEnvoyClient(logger hclog.Logger, addr net.IP, config *EnvoyConfig) (*EnvoyClient, error)
NewEnvoyClient creates a new envoy proxy
func (*EnvoyClient) DeltaAggregatedResources ¶
func (e *EnvoyClient) DeltaAggregatedResources(envoydisc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
DeltaAggregatedResources implements envoydisc.AggregatedDiscoveryServiceServer
func (*EnvoyClient) EmitStats ¶
func (e *EnvoyClient) EmitStats(period time.Duration, stopCh <-chan struct{})
EmitStats emits the stats of the envoy proxy
func (*EnvoyClient) IsEnabled ¶
func (e *EnvoyClient) IsEnabled() bool
IsEnabled returns true if Envoy is enabled.
func (*EnvoyClient) RegisterEgressAddress ¶
func (e *EnvoyClient) RegisterEgressAddress(name string, addr string, port int)
RegisterEgressAddress registers an egress entry for an address and a port
func (*EnvoyClient) RegisterIngressAddress ¶
func (e *EnvoyClient) RegisterIngressAddress(name string, port int)
RegisterIngressAddress registers an egress entry for a port. Since we are building a proxy we expect the destiny address to bind to localhost.
func (*EnvoyClient) Resolve ¶
func (e *EnvoyClient) Resolve(addr *net.TCPAddr) *net.TCPAddr
Resolve resolves a proxy address
func (*EnvoyClient) StreamAggregatedResources ¶
func (e *EnvoyClient) StreamAggregatedResources(stream envoydisc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
StreamAggregatedResources implements envoydisc.AggregatedDiscoveryServiceServer
type EnvoyConfig ¶
type EnvoyConfig struct { // Enabled is set to true to enable the envoy proxy Enabled bool `hcl:"enabled"` // AdminPort is the port for the envoy admin rest-api AdminPort int `hcl:"admin_port"` // GRPCPort is the port for the grpc control plane GRPCPort int `hcl:"grpc_port"` // Bianry is the path to the envoy binary Binary string `hcl:"binary"` // BaseID is used to differentiate different envoy instances on the same machine BaseID int `hcl:"base_id"` }
EnvoyConfig is the envoy configuration
func DefaultEnvoyConfig ¶
func DefaultEnvoyConfig() *EnvoyConfig
DefaultEnvoyConfig is the default envoy configuration
func (*EnvoyConfig) IsEnabled ¶
func (e *EnvoyConfig) IsEnabled() bool
IsEnabled returns true if Envoy is enabled.
type Proxy ¶
type Proxy struct { Label string // name of the proxy Addr string // addr for an egress proxy Value int // the port envoy binds To int // the port the proxy forwards to }
Proxy is a reference for a proxy in envoy.
type RPCType ¶
type RPCType byte
RPCType represents different types of rpc to be used
const ( // RPCRaft is the Raft rpc type RPCRaft RPCType = 0x02 )
type RaftLayer ¶
type RaftLayer struct {
// contains filtered or unexported fields
}
RaftLayer implements the raft.StreamLayer to handle the raft connections inside the rpc stream.
func NewRaftLayer ¶
NewRaftLayer creates a new raft layer.
type Server ¶
type Server struct { Config *Config // Serf Serf *serf.Serf EventCh chan serf.Event // Raft Raft *raft.Raft LeaderChAux chan bool Agent *consul.Agent ReconcileChAux chan serf.Member InmemSink *metrics.InmemSink // contains filtered or unexported fields }
Server is a cloud-cluster server which handles a serf, raft and a consul agent instances
func (*Server) ReconcileCh ¶
func (*Server) RegisterRPC ¶
func (s *Server) RegisterRPC(rcvr interface{})
type SetRequest ¶
type SetRequest struct {
Key, Value int
}