aws

package
v1.3.0-rc3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AWSLoadBalancerV2TagKeyResourceID = "ingress.k8s.aws/resource"

AWSLoadBalancerV2TagKeyResourceID is the tag applied to an AWS resource by the AWS Load Balancer controller, to associate it to the corresponding kubernetes resource. This is used by the rollout controller to identify the correct TargetGroups associated with the LoadBalancer. For AWS target group service references, the format is: <namespace>/<ingress-name>-<service-name>:<port> Example: ingress.k8s.aws/resource: default/alb-rollout-ingress-alb-rollout-stable:80 See: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/#resource-tags https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/da8951f80521651e0a1ffe1361c011d6baad7706/pkg/deploy/tracking/provider.go#L19

Variables

NewClient instantiates a new AWS Client. It is declared as a variable to allow mocking

Functions

func BuildTargetGroupResourceID added in v1.1.0

func BuildTargetGroupResourceID(namespace string, ingressName string, serviceName string, servicePort int32) string

BuildTargetGroupResourceID returns the AWS TargetGroup ResourceID Adapted from https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/57c8ce344fe09089fa2e20b0aa9fc0972696bc05/pkg/ingress/model_build_target_group.go#L398-L400

func FakeNewClientFunc added in v1.1.0

func FakeNewClientFunc(elbClient ELBv2APIClient) func() (Client, error)

func GetTargetGroupBindingsGVR added in v1.1.0

func GetTargetGroupBindingsGVR() (schema.GroupVersionResource, error)

Types

type Client

type Client interface {
	GetTargetGroupHealth(ctx context.Context, targetGroupARN string) ([]elbv2types.TargetHealthDescription, error)
	GetTargetGroupMetadata(ctx context.Context, loadBalancerARN string) ([]TargetGroupMeta, error)
	FindLoadBalancerByDNSName(ctx context.Context, dnsName string) (*elbv2types.LoadBalancer, error)
}

func DefaultNewClientFunc added in v1.1.0

func DefaultNewClientFunc() (Client, error)

type ClientAdapter added in v1.1.0

type ClientAdapter struct {
	ELBV2 ELBv2APIClient
	// contains filtered or unexported fields
}

ClientAdapter implements the Client interface

func (*ClientAdapter) FindLoadBalancerByDNSName added in v1.1.0

func (c *ClientAdapter) FindLoadBalancerByDNSName(ctx context.Context, dnsName string) (*elbv2types.LoadBalancer, error)

func (*ClientAdapter) GetTargetGroupHealth added in v1.1.0

func (c *ClientAdapter) GetTargetGroupHealth(ctx context.Context, targetGroupARN string) ([]elbv2types.TargetHealthDescription, error)

GetTargetGroupHealth returns health descriptions of registered targets in a target group. A TargetHealthDescription is an IP:port pair, along with its health status.

func (*ClientAdapter) GetTargetGroupMetadata added in v1.1.0

func (c *ClientAdapter) GetTargetGroupMetadata(ctx context.Context, loadBalancerARN string) ([]TargetGroupMeta, error)

GetTargetGroupMetadata is a convenience to retrieve the target groups of a load balancer along with relevant metadata (tags, and traffic weights).

type ELBv2APIClient

ELBv2APIClient is an interface that enables mocking of the ELBv2 API

type ServiceReference added in v1.1.0

type ServiceReference struct {
	// Name is the name of the Service.
	Name string `json:"name"`

	// Port is the port of the ServicePort.
	Port intstr.IntOrString `json:"port"`
}

ServiceReference defines reference to a Kubernetes Service and its ServicePort.

type TargetGroupBinding added in v1.1.0

type TargetGroupBinding struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec TargetGroupBindingSpec `json:"spec,omitempty"`
}

TargetGroupBinding is the Schema for the TargetGroupBinding API This is a subset of actual type definition and should only be used for readonly operations https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/v2.2.1/apis/elbv2/v1beta1/targetgroupbinding_types.go

func GetTargetGroupBindingsByService added in v1.1.0

func GetTargetGroupBindingsByService(ctx context.Context, dynamicClient dynamic.Interface, svc corev1.Service) ([]TargetGroupBinding, error)

type TargetGroupBindingSpec added in v1.1.0

type TargetGroupBindingSpec struct {
	// targetGroupARN is the Amazon Resource Name (ARN) for the TargetGroup.
	TargetGroupARN string `json:"targetGroupARN"`

	// targetType is the TargetType of TargetGroup. If unspecified, it will be automatically inferred.
	// +optional
	TargetType *TargetType `json:"targetType,omitempty"`

	// serviceRef is a reference to a Kubernetes Service and ServicePort.
	ServiceRef ServiceReference `json:"serviceRef"`
}

TargetGroupBindingSpec defines the desired state of TargetGroupBinding

type TargetGroupMeta

type TargetGroupMeta struct {
	elbv2types.TargetGroup
	Tags   map[string]string
	Weight *int32
}

TargetGroupMeta is a data type which combines the AWS TargetGroup information along with its tags, and weights

type TargetGroupVerifyResult added in v1.1.0

type TargetGroupVerifyResult struct {
	Service             string
	Verified            bool
	EndpointsRegistered int
	EndpointsTotal      int
}

TargetGroupVerifyResult returns metadata when a target group is verified.

func VerifyTargetGroupBinding added in v1.1.0

func VerifyTargetGroupBinding(ctx context.Context, logCtx *log.Entry, awsClnt Client, tgb TargetGroupBinding, endpoints *corev1.Endpoints, svc *corev1.Service) (*TargetGroupVerifyResult, error)

VerifyTargetGroupBinding verifies if the underlying AWS TargetGroup has all Pod IPs and ports from the given service (the K8s Endpoints list) registered to the TargetGroup. NOTE: a previous version of this method used to additionally verify that all registered targets were "healthy" (in addition to registered), but the health of registered targets is actually irrelevant for our purposes of verifying the service label change was reflected in the LB. Returns nil if the verification is not applicable (e.g. target type is not IP)

type TargetType added in v1.1.0

type TargetType string

TargetType is the targetType of your ELBV2 TargetGroup.

* with `instance` TargetType, nodes with nodePort for your service will be registered as targets * with `ip` TargetType, Pods with containerPort for your service will be registered as targets

const (
	TargetTypeInstance TargetType = "instance"
	TargetTypeIP       TargetType = "ip"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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