Documentation
¶
Index ¶
- type AWSConfig
- type AWSTargetGroup
- func (tg *AWSTargetGroup) AddTargets(ctx context.Context, targets []*Target) error
- func (tg *AWSTargetGroup) GetTargets(ctx context.Context) ([]*Target, error)
- func (tg *AWSTargetGroup) RemoveTargets(ctx context.Context, targets []*Target) error
- func (tg *AWSTargetGroup) TargetToTargetDescription(targets []*Target) []*elbv2.TargetDescription
- type Config
- type ConsulConfig
- type ConsulSource
- type K8sConfig
- type K8sEndpointsConfig
- type K8sEndpointsSource
- type LockOptions
- type Locker
- type SyncConfig
- type Syncer
- type Target
- type TargetDestination
- type TargetSource
- type TargetSourceLocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSConfig ¶
type AWSConfig struct { TargetGroupARN string `yaml:"target_group_arn"` AvailabilityZone string `yaml:"availability_zone"` }
AWSConfig holds the configuration for the aws destination
type AWSTargetGroup ¶
type AWSTargetGroup struct {
// contains filtered or unexported fields
}
AWSTargetGroup is a TargetDestination implementation for AWS target groups
func NewAWSTargetGroup ¶
func NewAWSTargetGroup(cfg *AWSConfig) (*AWSTargetGroup, error)
NewAWSTargetGroup returns a new AWS target group destination
func (*AWSTargetGroup) AddTargets ¶
func (tg *AWSTargetGroup) AddTargets(ctx context.Context, targets []*Target) error
AddTargets simply adds the targets described
func (*AWSTargetGroup) GetTargets ¶
func (tg *AWSTargetGroup) GetTargets(ctx context.Context) ([]*Target, error)
GetTargets returns the current set of targets at the destination
func (*AWSTargetGroup) RemoveTargets ¶
func (tg *AWSTargetGroup) RemoveTargets(ctx context.Context, targets []*Target) error
RemoveTargets simply removes the targets described
func (*AWSTargetGroup) TargetToTargetDescription ¶
func (tg *AWSTargetGroup) TargetToTargetDescription(targets []*Target) []*elbv2.TargetDescription
TargetToTargetDescription translates the `Target` struct into an ec2 `TargetDescription`
type Config ¶
type Config struct { ConsulConfig `yaml:"consul"` AWSConfig `yaml:"aws"` K8sEndpointsConfig `yaml:"k8s_enpoints"` SyncConfig `yaml:"syncer"` }
Config for the targetsync
func ConfigFromFile ¶
ConfigFromFile Loads a config file from `path`
type ConsulConfig ¶
type ConsulConfig struct { ClientConfig *consulApi.Config `yaml:"client"` ServiceName string `yaml:"service_name"` Tag string `yaml:"tag"` }
ConsulConfig holds the configuration for the consul source
type ConsulSource ¶
type ConsulSource struct {
// contains filtered or unexported fields
}
ConsulSource is an implementation for talkint to consul for both `TargetSource` and `Locker`
func NewConsulSource ¶
func NewConsulSource(cfg *ConsulConfig) (*ConsulSource, error)
NewConsulSource returns a new ConsulSource
func (*ConsulSource) Lock ¶
func (s *ConsulSource) Lock(ctx context.Context, opts *LockOptions) (<-chan bool, error)
Lock to implement the Locker interface
type K8sEndpointsConfig ¶
type K8sEndpointsSource ¶
type K8sEndpointsSource struct {
// contains filtered or unexported fields
}
func NewK8sEndpointsSource ¶
func NewK8sEndpointsSource(cfg *K8sEndpointsConfig) (*K8sEndpointsSource, error)
func (*K8sEndpointsSource) Lock ¶
func (s *K8sEndpointsSource) Lock(ctx context.Context, opts *LockOptions) (<-chan bool, error)
type LockOptions ¶
LockOptions holds the options for locking/leader-election
type Locker ¶
type Locker interface { // Lock will acquire the lock defined in `LockOptions` and return a channel // which will respond with whether we are the leader Lock(context.Context, *LockOptions) (<-chan bool, error) }
Locker is an interface for locking/leader-election
type SyncConfig ¶
type SyncConfig struct { LockOptions `yaml:"lock_options"` RemoveDelay time.Duration `yaml:"remove_delay"` }
SyncConfig holds options for the Syncer
func (SyncConfig) Validate ¶
func (c SyncConfig) Validate() error
type Syncer ¶
type Syncer struct { Config *SyncConfig LocalAddr string Locker Locker Src TargetSource Dst TargetDestination Started bool }
Syncer is the struct that uses the various interfaces to actually do the sync TODO: metrics
type TargetDestination ¶
type TargetDestination interface { // GetTargets returns the current set of targets at the destination GetTargets(context.Context) ([]*Target, error) // AddTargets simply adds the targets described AddTargets(context.Context, []*Target) error // RemoveTargets simply removes the targets described RemoveTargets(context.Context, []*Target) error }
TargetDestination is a place to apply targets to (e.g. TargetGroup)
type TargetSource ¶
TargetSource is an interface for getting targets for a given config TODO: plugin etc.
type TargetSourceLocker ¶
type TargetSourceLocker interface { Locker TargetSource }