loadbalancers

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 35 Imported by: 32

Documentation

Index

Constants

View Source
const FakeCertQuota = 15
View Source
const SslCertificateMissing = "SslCertificateMissing"
View Source
const (
	// Every target https proxy accepts upto 10 ssl certificates.
	TargetProxyCertLimit = 10
)

Variables

This section is empty.

Functions

func Equal added in v1.9.0

func Equal(fr1, fr2 *composite.ForwardingRule) bool

func GCEResourceName

func GCEResourceName(ingAnnotations map[string]string, resourceName string) string

GCEResourceName retrieves the name of the gce resource created for this Ingress, of the given resource type, by inspecting the map of ingress annotations.

func GetCertHash added in v1.1.0

func GetCertHash(contents string) string

func GetLBAnnotations

func GetLBAnnotations(l7 *L7, existing map[string]string, backendSyncer backends.Syncer) (map[string]string, error)

GetLBAnnotations returns the annotations of an l7. This includes it's current status.

func InsertForwardingRuleHook added in v1.9.0

func InsertForwardingRuleHook(ctx context.Context, key *meta.Key, obj *compute.ForwardingRule, m *cloud.MockForwardingRules) (b bool, e error)

func InsertGlobalForwardingRuleHook added in v1.7.0

func InsertGlobalForwardingRuleHook(ctx context.Context, key *meta.Key, obj *compute.ForwardingRule, m *cloud.MockGlobalForwardingRules) (b bool, e error)

Types

type L4 added in v1.9.0

type L4 struct {
	Service        *corev1.Service
	ServicePort    utils.ServicePort
	NamespacedName types.NamespacedName
	// contains filtered or unexported fields
}

Many of the functions in this file are re-implemented from gce_loadbalancer_internal.go L4 handles the resource creation/deletion/update for a given L4 ILB service.

func NewL4Handler added in v1.9.0

func NewL4Handler(service *corev1.Service, cloud *gce.Cloud, scope meta.KeyType, namer *namer.Namer, recorder record.EventRecorder, lock *sync.Mutex, collector metrics.L4ILBMetricsCollector) *L4

NewL4Handler creates a new L4Handler for the given L4 service.

func (*L4) CreateKey added in v1.9.0

func (l *L4) CreateKey(name string) (*meta.Key, error)

CreateKey generates a meta.Key for a given GCE resource name.

func (*L4) EnsureInternalLoadBalancer added in v1.9.0

func (l *L4) EnsureInternalLoadBalancer(nodeNames []string, svc *corev1.Service) (*corev1.LoadBalancerStatus, error)

EnsureInternalLoadBalancer ensures that all GCE resources for the given loadbalancer service have been created. It returns a LoadBalancerStatus with the updated ForwardingRule IP address.

func (*L4) EnsureInternalLoadBalancerDeleted added in v1.9.0

func (l *L4) EnsureInternalLoadBalancerDeleted(svc *corev1.Service) error

EnsureInternalLoadBalancerDeleted performs a cleanup of all GCE resources for the given loadbalancer service.

func (*L4) GetFRName added in v1.9.0

func (l *L4) GetFRName() string

GetFRName returns the name of the forwarding rule for the given ILB service. This appends the protocol to the forwarding rule name, which will help supporting multiple protocols in the same ILB service.

type L7

type L7 struct {
	// contains filtered or unexported fields
}

L7 represents a single L7 loadbalancer.

func (*L7) Cleanup

func (l *L7) Cleanup(versions *features.ResourceVersions) error

Cleanup deletes resources specific to this l7 in the right order. forwarding rule -> target proxy -> url map This leaves backends and health checks, which are shared across loadbalancers.

func (*L7) CreateKey added in v1.7.0

func (l *L7) CreateKey(name string) (*meta.Key, error)

CreateKey creates a meta.Key for use with composite types

func (*L7) GetIP

func (l *L7) GetIP() string

GetIP returns the ip associated with the forwarding rule for this l7.

func (*L7) Regional added in v1.7.0

func (l *L7) Regional() bool

Regional returns true if the l7 scope is regional

func (*L7) RuntimeInfo added in v1.2.2

func (l *L7) RuntimeInfo() *L7RuntimeInfo

RuntimeInfo returns the L7RuntimeInfo associated with the L7 load balancer.

func (*L7) String added in v1.8.0

func (l *L7) String() string

String returns the name of the loadbalancer. Warning: This should be used only for logging and should not be used to retrieve/ delete gce resource names.

func (*L7) UrlMap

func (l *L7) UrlMap() *composite.UrlMap

UrlMap returns the UrlMap associated with the L7 load balancer.

func (*L7) Versions added in v1.7.0

func (l *L7) Versions() *features.ResourceVersions

Versions returns the struct listing the versions for every resource

type L7RuntimeInfo

type L7RuntimeInfo struct {
	// IP is the desired ip of the loadbalancer, eg from a staticIP.
	IP string
	// TLS are the tls certs to use in termination.
	TLS []*TLSCerts
	// TLSName is the name of the preshared cert to use. Multiple certs can be specified as a comma-separated string
	TLSName string
	// Ingress is the processed Ingress API object.
	Ingress *v1beta1.Ingress
	// AllowHTTP will not setup :80, if TLS is nil and AllowHTTP is set,
	// no loadbalancer is created.
	AllowHTTP bool
	// The name of a Global/Regional Static IP. If specified, the IP associated with
	// this name is used in the Forwarding Rules for this loadbalancer.
	// If this is an l7-ILB ingress, the static IP is assumed to be internal
	StaticIPName string
	// UrlMap is our internal representation of a url map.
	UrlMap *utils.GCEURLMap
	// FrontendConfig is the type which encapsulates features for the load balancer.
	FrontendConfig *frontendconfigv1beta1.FrontendConfig
}

L7RuntimeInfo is info passed to this module from the controller runtime.

type L7s

type L7s struct {
	// contains filtered or unexported fields
}

L7s implements LoadBalancerPool.

func (*L7s) Ensure added in v1.5.0

func (l *L7s) Ensure(ri *L7RuntimeInfo) (*L7, error)

Ensure implements LoadBalancerPool.

func (*L7s) FrontendScopeChangeGC added in v1.9.10

func (l *L7s) FrontendScopeChangeGC(ing *v1beta1.Ingress) (*meta.KeyType, error)

FrontendScopeChangeGC returns the scope to GC if the LB has changed scopes (e.g. when a user migrates from ILB to ELB on the same ingress or vice versa.) This only applies to the V2 Naming Scheme TODO(shance): Refactor to avoid calling GCE every sync loop

func (*L7s) GCv1 added in v1.8.0

func (l *L7s) GCv1(names []string) error

GCv1 implements LoadBalancerPool. TODO(shance): Update to handle regional and global LB with same name

func (*L7s) GCv2 added in v1.8.0

func (l *L7s) GCv2(ing *v1beta1.Ingress, scope meta.KeyType) error

GCv2 implements LoadBalancerPool.

func (*L7s) HasUrlMap added in v1.8.0

func (l *L7s) HasUrlMap(ing *v1beta1.Ingress) (bool, error)

HasUrlMap implements LoadBalancerPool.

func (*L7s) Shutdown

func (l *L7s) Shutdown(ings []*v1beta1.Ingress) error

Shutdown implements LoadBalancerPool.

type LoadBalancerPool

type LoadBalancerPool interface {
	// Ensure ensures a loadbalancer and its resources given the RuntimeInfo.
	Ensure(ri *L7RuntimeInfo) (*L7, error)
	// GCv2 garbage collects loadbalancer associated with given ingress using v2 naming scheme.
	GCv2(ing *v1beta1.Ingress, scope meta.KeyType) error
	// GCv1 garbage collects loadbalancers not in the input list using v1 naming scheme.
	GCv1(names []string) error
	// FrontendScopeChangeGC checks if GC is needed for an ingress that has changed scopes
	FrontendScopeChangeGC(ing *v1beta1.Ingress) (*meta.KeyType, error)
	// Shutdown deletes all loadbalancers for given list of ingresses.
	Shutdown(ings []*v1beta1.Ingress) error
	// HasUrlMap returns true if an URL map exists in GCE for given ingress.
	HasUrlMap(ing *v1beta1.Ingress) (bool, error)
}

LoadBalancerPool is an interface to manage the cloud resources associated with a gce loadbalancer.

func NewLoadBalancerPool

func NewLoadBalancerPool(cloud *gce.Cloud, v1NamerHelper namer_util.V1FrontendNamer, recorderProducer events.RecorderProducer, namerFactory namer_util.IngressFrontendNamerFactory) LoadBalancerPool

NewLoadBalancerPool returns a new loadbalancer pool.

  • cloud: implements LoadBalancers. Used to sync L7 loadbalancer resources with the cloud.

type TLSCerts

type TLSCerts struct {
	// Key is private key.
	Key string
	// Cert is a public key.
	Cert string
	// Chain is a certificate chain.
	Chain string
	Name  string
	// md5 hash(first 8 bytes) of the cert contents
	CertHash string
}

TLSCerts encapsulates .pem encoded TLS information.

Directories

Path Synopsis
TODO: (shance) this file should ideally be combined with backends/features This file contains functionality and constants for the L7-ILB feature Since this also currently affects backend resources (since they are alpha-regional instead of ga-global), this feature is also included in pkg/backends/features.go
TODO: (shance) this file should ideally be combined with backends/features This file contains functionality and constants for the L7-ILB feature Since this also currently affects backend resources (since they are alpha-regional instead of ga-global), this feature is also included in pkg/backends/features.go

Jump to

Keyboard shortcuts

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