courier

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAnalyzeInterval = 10 * time.Second

Functions

func Analyze

func Analyze(ctx context.Context, region, profile string, assumeRoleConfig *sdk.AssumeRoleConfig, metrics []Metric, data interface{}) error

func CreateOrUpdateCourierALB

func CreateOrUpdateCourierALB(d api.Lister, schema *ALBSchema, metricSchema *MetricSchema) error

func CreateOrUpdateCourierRoute53Record

func CreateOrUpdateCourierRoute53Record(d api.Getter, mSchema *MetricSchema) error

func DeleteCourierALB

func DeleteCourierALB(d api.Lister, schema *ALBSchema, metricSchema *MetricSchema) error

func DoGradualTrafficShift

func DoGradualTrafficShift(ctx context.Context, svc elbv2iface.ELBV2API, l ListenerStatus, p int, opts CanaryOpts) error

func ListerStatusToTemplateData

func ListerStatusToTemplateData(l ListenerStatus) interface{}

func SetDesiredTGTrafficPercentage

func SetDesiredTGTrafficPercentage(svc elbv2iface.ELBV2API, l ListenerStatus, p int) error

Types

type ALB

type ALB struct {
}

func (*ALB) Apply

func (a *ALB) Apply(d *CourierALB) error

func (*ALB) Delete

func (a *ALB) Delete(d *CourierALB) error

type ALBAttachment

type ALBAttachment struct {
	NodeGroupName string
	Weght         int
	ListenerARN   string

	NodePort int
	Protocol string

	// ALB Listener Rule settings
	Priority     int
	Hosts        []string
	PathPatterns []string
	Methods      []string
	SourceIPs    []string
	Headers      map[string][]string
	QueryStrings map[string]string
	Metrics      []Metric
}

type ALBSchema

type ALBSchema struct {
	Address                   string
	ListenerARN               string
	Priority                  string
	Destination               string
	DestinationTargetGroupARN string
	DestinationWeight         string
	StepWeight                string
	StepInterval              string

	Hosts        string
	PathPatterns string
	Methods      string
	SourceIPs    string
	Headers      string
	QueryStrings string
}

type Analyzer

type Analyzer struct {
	MetricProvider
	Query string
	Min   *float64
	Max   *float64
}

func MetricsToAnalyzers

func MetricsToAnalyzers(region, profile string, assumeRoleConfig *sdk.AssumeRoleConfig, ms []Metric) ([]*Analyzer, error)

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(data interface{}) error

type CanaryOpts

type CanaryOpts struct {
	CanaryAdvancementInterval time.Duration
	CanaryAdvancementStep     int
	Region                    string
	ClusterName               string
}

type CourierALB

type CourierALB struct {
	Address          string
	ListenerARN      string
	Priority         int
	ListenerRule     *ListenerRule
	Region           string
	Profile          string
	Destinations     []Destination
	StepWeight       int
	StepInterval     time.Duration
	Metrics          []Metric
	Session          *session.Session
	AssumeRoleConfig *sdk.AssumeRoleConfig
}

func ReadCourierALB

func ReadCourierALB(d api.Lister, schema *ALBSchema, metricSchema *MetricSchema) (*CourierALB, error)

type Destination

type Destination struct {
	TargetGroupARN string
	Weight         int
}

type DestinationRecordSet

type DestinationRecordSet struct {
	SetIdentifier string
	Weight        int
}

type ListenerRule

type ListenerRule struct {
	ListenerARN  string
	Priority     int
	Hosts        []string
	PathPatterns []string
	Methods      []string
	SourceIPs    []string
	Headers      map[string][]string
	QueryStrings map[string]string
	Destinations []Destination
}

func ReadListenerRule

func ReadListenerRule(m api.Lister, schema *ALBSchema) (*ListenerRule, error)

type ListenerStatus

type ListenerStatus struct {
	Listener       *elbv2.Listener
	Rule           *elbv2.Rule
	ALBAttachments []ALBAttachment

	DesiredTG  *elbv2.TargetGroup
	CurrentTG  *elbv2.TargetGroup
	DeletedTGs *elbv2.TargetGroup

	// Common listener rule settings
	RulePriority int64
	Hosts        []string
	PathPatterns []string
	Methods      []string
	SourceIPs    []string
	Headers      map[string][]string
	QueryStrings map[string]string
	Metrics      []Metric
}

type Metric

type Metric struct {
	Provider   string
	Address    string
	Query      string
	Max        *float64
	Min        *float64
	Interval   time.Duration
	AWSRegion  string
	AWSProfile string
}

func LoadMetrics

func LoadMetrics(metrics []interface{}, schema *MetricSchema) ([]Metric, error)

func ReadMetrics

func ReadMetrics(d api.Getter, schema *MetricSchema) ([]Metric, error)

type MetricProvider

type MetricProvider interface {
	Execute(string) (float64, error)
}

type MetricSchema

type MetricSchema struct {
	DatadogMetric      string
	CloudWatchMetric   string
	Min, Max, Interval string
	Address            string
	Query              string
	AWSProfile         string
	AWSRegion          string
}

type Route53RecordSetRouter

type Route53RecordSetRouter struct {
	Service                   *route53.Route53
	HostedZoneID              string
	RecordName                string
	Destinations              []DestinationRecordSet
	CanaryAdvancementInterval time.Duration
	CanaryAdvancementStep     int
}

func (*Route53RecordSetRouter) TrafficShift

func (r *Route53RecordSetRouter) TrafficShift(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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