tg

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeregistrationDelayTimeoutSecondsKey = "deregistration_delay.timeout_seconds"
	SlowStartDurationSecondsKey          = "slow_start.duration_seconds"
	StickinessEnabledKey                 = "stickiness.enabled"
	StickinessTypeKey                    = "stickiness.type"
	StickinessLbCookieDurationSecondsKey = "stickiness.lb_cookie.duration_seconds"
	LoadBalancingAlgorithmTypeKey        = "load_balancing.algorithm.type"

	DeregistrationDelayTimeoutSeconds = 300
	SlowStartDurationSeconds          = 0
	StickinessEnabled                 = false
	StickinessType                    = "lb_cookie"
	StickinessLbCookieDurationSeconds = 86400
	LoadBalancingAlgorithmType        = "round_robin"
)

Variables

This section is empty.

Functions

func ExtractTargetGroupBackends added in v1.1.6

func ExtractTargetGroupBackends(ingress *extensions.Ingress) ([]extensions.IngressBackend, []string, error)

ExtractTargetGroupBackends returns backends for Ingress. Backends can be either k8s service based or targetGroupArns referencing targetGroups created out side of k8s.

func IsInvalidAttribute

func IsInvalidAttribute(e error) bool

IsInvalidAttribute checks if the err is from an invalid attribute

func NewInvalidAttribute

func NewInvalidAttribute(name string) error

NewInvalidAttribute returns a new InvalidAttribute error

Types

type Attributes

type Attributes struct {
	// DeregistrationDelayTimeoutSeconds: deregistration_delay.timeout_seconds - The amount of time, in seconds,
	// for Elastic Load Balancing to wait before changing the state of a deregistering
	// target from draining to unused. The range is 0-3600 seconds. The default
	// value is 300 seconds.
	DeregistrationDelayTimeoutSeconds int64

	// SlowStartDurationSeconds: slow_start.duration_seconds - The time period, in seconds, during which
	// a newly registered target receives a linearly increasing share of the
	// traffic to the target group. After this time period ends, the target receives
	// its full share of traffic. The range is 30-900 seconds (15 minutes). Slow
	// start mode is disabled by default.
	SlowStartDurationSeconds int64

	// StickinessEnabled: stickiness.enabled - Indicates whether sticky sessions are enabled.
	// The value is true or false. The default is false.
	StickinessEnabled bool

	// StickinessType: stickiness.type - The type of sticky sessions. The possible value is
	// lb_cookie.
	StickinessType string

	// StickinessLbCookieDurationSeconds: stickiness.lb_cookie.duration_seconds - The time period, in seconds,
	// during which requests from a client should be routed to the same target.
	// After this time period expires, the load balancer-generated cookie is
	// considered stale. The range is 1 second to 1 week (604800 seconds). The
	// default value is 1 day (86400 seconds).
	StickinessLbCookieDurationSeconds int64

	// LoadBalancingAlgorithmType: load_balancing.algorithm.type - The load balancing algorithm determines
	// how the load balancer selects targets when routing requests. The value is round_robin or
	// least_outstanding_requests. The default is round_robin.
	LoadBalancingAlgorithmType string
}

Attributes represents the desired state of attributes for a target group.

func NewAttributes

func NewAttributes(attrs []*elbv2.TargetGroupAttribute) (a *Attributes, err error)

type AttributesController

type AttributesController interface {
	// Reconcile ensures the target group attributes in AWS matches the state specified by the ingress configuration.
	Reconcile(ctx context.Context, tgArn string, attributes []*elbv2.TargetGroupAttribute) error
}

AttributesController provides functionality to manage Attributes

func NewAttributesController

func NewAttributesController(cloud aws.CloudAPI) AttributesController

NewAttributesController constructs a new attributes controller

type Controller

type Controller interface {
	// Reconcile ensures an targetGroup exists for specified backend of ingress.
	Reconcile(ctx context.Context, ingress *extensions.Ingress, backend extensions.IngressBackend) (TargetGroup, error)
	StopReconcilingPodConditionStatus(tgArn string)
}

Controller manages a single targetGroup for specific ingress & ingressBackend.

func NewController

func NewController(cloud aws.CloudAPI, store store.Storer, nameTagGen NameTagGenerator, tagsController tags.Controller, endpointResolver backend.EndpointResolver, client client.Client) Controller

type GroupController

type GroupController interface {
	// Reconcile ensures AWS an targetGroup exists for each backend in ingress.
	Reconcile(ctx context.Context, ingress *extensions.Ingress) (TargetGroupGroup, error)

	// GC will delete unused targetGroups matched by tag selector
	GC(ctx context.Context, tgGroup TargetGroupGroup) error

	// Delete will delete all targetGroups created for ingress
	Delete(ctx context.Context, ingressKey types.NamespacedName) error
}

GroupController manages all target groups for one ingress.

func NewGroupController

func NewGroupController(
	cloud aws.CloudAPI,
	store store.Storer,
	nameTagGen NameTagGenerator,
	tagsController tags.Controller,
	endpointResolver backend.EndpointResolver,
	client client.Client) GroupController

NewGroupController creates an GroupController

type InvalidAttribute

type InvalidAttribute struct {
	Name string
}

InvalidAttribute error

func (InvalidAttribute) Error

func (e InvalidAttribute) Error() string

type MockAttributesController

type MockAttributesController struct {
	mock.Mock
}

MockAttributesController is an autogenerated mock type for the AttributesController type

func (*MockAttributesController) Reconcile

func (_m *MockAttributesController) Reconcile(ctx context.Context, tgArn string, attributes []*elbv2.TargetGroupAttribute) error

Reconcile provides a mock function with given fields: ctx, tgArn, attributes

type MockController

type MockController struct {
	mock.Mock
}

MockController is an autogenerated mock type for the Controller type

func (*MockController) Reconcile

func (_m *MockController) Reconcile(ctx context.Context, ingress *v1beta1.Ingress, backend v1beta1.IngressBackend) (TargetGroup, error)

Reconcile provides a mock function with given fields: ctx, ingress, backend

func (*MockController) StopReconcilingPodConditionStatus added in v1.1.6

func (_m *MockController) StopReconcilingPodConditionStatus(_a0 string)

type MockNameTagGenerator

type MockNameTagGenerator struct {
	mock.Mock
}

MockNameTagGenerator is an autogenerated mock type for the NameTagGenerator type

func (*MockNameTagGenerator) NameTG

func (_m *MockNameTagGenerator) NameTG(namespace string, ingressName string, serviceName string, servicePort string, targetType string, protocol string) string

NameTG provides a mock function with given fields: namespace, ingressName, serviceName, servicePort, targetType, protocol

func (*MockNameTagGenerator) TagTG

func (_m *MockNameTagGenerator) TagTG(namespace string, ingressName string, serviceName string, servicePort string) map[string]string

TagTG provides a mock function with given fields: namespace, ingressName, serviceName, servicePort

func (*MockNameTagGenerator) TagTGGroup

func (_m *MockNameTagGenerator) TagTGGroup(namespace string, ingressName string) map[string]string

TagTGGroup provides a mock function with given fields: namespace, ingressName

type MockTargetsController

type MockTargetsController struct {
	mock.Mock
}

MockTargetsController is an autogenerated mock type for the TargetsController type

func (*MockTargetsController) Reconcile

func (_m *MockTargetsController) Reconcile(_a0 context.Context, _a1 *Targets) error

Reconcile provides a mock function with given fields: _a0, _a1

func (*MockTargetsController) StopReconcilingPodConditionStatus added in v1.1.6

func (_m *MockTargetsController) StopReconcilingPodConditionStatus(_a0 string)

type NameGenerator

type NameGenerator interface {
	// NameTG generates name for targetGroups.
	// Note: targetType & protocol is included here to ensure we'll create new targetGroups if one of them changed(they cannot be modified)
	NameTG(namespace string, ingressName string, serviceName, servicePort string,
		targetType string, protocol string) string
}

NameGenerator provides name generation functionality for tg package.

type NameTagGenerator

type NameTagGenerator interface {
	NameGenerator
	TagGenerator
}

NameTagGenerator is combination of NameGenerator and TagGenerator

type TagGenerator

type TagGenerator interface {
	// TagTGGroup generates tags for the group of targetGroups created for a single ingress.
	TagTGGroup(namespace string, ingressName string) map[string]string

	// TagTG generates tags for a targetGroup inside a TGGroup.
	// NOTE: The final set of tags been applied to targetGroup is union of tags generated by TagTGs & TagTG.
	TagTG(namespace string, ingressName string, serviceName string, servicePort string) map[string]string
}

TagGenerator provides tag generation functionality for tg package.

type TargetGroup

type TargetGroup struct {
	Arn        string
	TargetType string
	Targets    []*elbv2.TargetDescription
}

TargetGroup provides information about AWS targetGroup created.

type TargetGroupGroup

type TargetGroupGroup struct {
	// targetGroups created for serviceBackends.
	TGByBackend map[extensions.IngressBackend]TargetGroup
	// contains filtered or unexported fields
}

TargetGroupGroup represents an collection of targetGroups for a single ingress in AWS

type TargetHealthController added in v1.1.6

type TargetHealthController interface {
	// Reconcile ensures the target group targets in AWS matches the targets configured in the ingress backend.
	SyncTargetsForReconciliation(ctx context.Context, t *Targets, desiredTargets []*elbv2.TargetDescription) error
	RemovePodConditions(ctx context.Context, t *Targets, targets []*elbv2.TargetDescription) error
	StopReconcilingPodConditionStatus(tgArn string)
}

TargetHealthController provides functionality to reconcile pod condition status from target health of targets in a target group

func NewTargetHealthController added in v1.1.6

func NewTargetHealthController(cloud aws.CloudAPI, store store.Storer, endpointResolver backend.EndpointResolver, client client.Client) TargetHealthController

NewTargetHealthController constructs a new target health controller

type Targets

type Targets struct {
	// TgArn is the ARN of the target group
	TgArn string

	// Targets are the targets for the target group
	Targets []*elbv2.TargetDescription

	// TargetType is the type of targets, either ip or instance
	TargetType string

	// Ingress is the ingress for the targets
	Ingress *extensions.Ingress

	// Backend is the ingress backend for the targets
	Backend *extensions.IngressBackend
}

Targets contains the targets for a target group.

func NewTargets

func NewTargets(targetType string, ingress *extensions.Ingress, backend *extensions.IngressBackend) *Targets

NewTargets returns a new Targets pointer

type TargetsController

type TargetsController interface {
	// Reconcile ensures the target group targets in AWS matches the targets configured in the ingress backend.
	Reconcile(context.Context, *Targets) error
	StopReconcilingPodConditionStatus(tgArn string)
}

TargetsController provides functionality to manage targets

func NewTargetsController

func NewTargetsController(cloud aws.CloudAPI, endpointResolver backend.EndpointResolver, healthController TargetHealthController) TargetsController

NewTargetsController constructs a new target group targets controller

Jump to

Keyboard shortcuts

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