multicluster

package
v0.7.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelPrefix                                              = "kuadrant.io/"
	ClustersLabelPrefix                                      = "clusters." + LabelPrefix
	MultiClusterIPAddressType       gatewayapiv1.AddressType = LabelPrefix + "MultiClusterIPAddress"
	MultiClusterHostnameAddressType gatewayapiv1.AddressType = LabelPrefix + "MultiClusterHostnameAddress"
)
View Source
const (
	LabelLBAttributeGeoCode = "kuadrant.io/lb-attribute-geo-code"
)

Variables

This section is empty.

Functions

func AddressTypeToMultiCluster

func AddressTypeToMultiCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool)

AddressTypeToMultiCluster returns a multi cluster version of the address type and a bool to indicate that provided address type was converted. If not - original type is returned

func AddressTypeToSingleCluster

func AddressTypeToSingleCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool)

AddressTypeToSingleCluster converts provided multicluster address to single cluster version the bool indicates a successful conversion

Types

type ClusterGateway

type ClusterGateway struct {
	gatewayapiv1.Gateway
	ClusterName string
}

ClusterGateway contains a Gateway as it would be on a single cluster and the name of the cluster.

type ClusterGatewayTarget

type ClusterGatewayTarget struct {
	*ClusterGateway
	Geo    *v1alpha1.GeoCode
	Weight *int
}

ClusterGatewayTarget represents a cluster Gateway with geo and weighting info calculated

func NewClusterGatewayTarget

func NewClusterGatewayTarget(cg ClusterGateway, defaultGeoCode v1alpha1.GeoCode, defaultWeight int, customWeights []*v1alpha1.CustomWeight) (ClusterGatewayTarget, error)

func (*ClusterGatewayTarget) GetGeo

func (*ClusterGatewayTarget) GetName

func (t *ClusterGatewayTarget) GetName() string

func (*ClusterGatewayTarget) GetShortCode

func (t *ClusterGatewayTarget) GetShortCode() string

func (*ClusterGatewayTarget) GetWeight

func (t *ClusterGatewayTarget) GetWeight() int

type GatewayTarget

type GatewayTarget struct {
	Gateway               *gatewayapiv1.Gateway
	ClusterGatewayTargets []ClusterGatewayTarget
	LoadBalancing         *v1alpha1.LoadBalancingSpec
}

GatewayTarget represents a Gateway that is placed on multiple clusters (ClusterGateway).

func NewGatewayTarget

func NewGatewayTarget(gateway *gatewayapiv1.Gateway, clusterGateways []ClusterGateway, loadBalancing *v1alpha1.LoadBalancingSpec) (*GatewayTarget, error)

func (*GatewayTarget) GetDefaultGeo

func (t *GatewayTarget) GetDefaultGeo() v1alpha1.GeoCode

func (*GatewayTarget) GetDefaultWeight

func (t *GatewayTarget) GetDefaultWeight() int

func (*GatewayTarget) GetName

func (t *GatewayTarget) GetName() string

func (*GatewayTarget) GetShortCode

func (t *GatewayTarget) GetShortCode() string

func (*GatewayTarget) GroupTargetsByGeo

func (t *GatewayTarget) GroupTargetsByGeo() map[v1alpha1.GeoCode][]ClusterGatewayTarget

GroupTargetsByGeo groups targets based on Geo Code.

type GatewayWrapper

type GatewayWrapper struct {
	*gatewayapiv1.Gateway
	ClusterID string
}

func NewGatewayWrapper

func NewGatewayWrapper(g *gatewayapiv1.Gateway, clusterID string) *GatewayWrapper

func (*GatewayWrapper) GetClusterGatewayAddresses

func (g *GatewayWrapper) GetClusterGatewayAddresses() map[string][]gatewayapiv1.GatewayStatusAddress

GetClusterGatewayAddresses constructs a map from Status.Addresses of underlying Gateway with key being a cluster and value being an address in the cluster. In case of a single-cluster Gateway the key is the Gateway Name.

func (*GatewayWrapper) GetClusterGatewayLabels

func (g *GatewayWrapper) GetClusterGatewayLabels(clusterName string) map[string]string

GetClusterGatewayLabels parses the labels of the wrapped Gateway and returns a list of labels for the given clusterName. In case of a single-cluster Gateway the wrapped Gateways labels are returned unmodified.

func (*GatewayWrapper) GetClusterGatewayListeners

func (g *GatewayWrapper) GetClusterGatewayListeners(clusterName string) []gatewayapiv1.ListenerStatus

GetClusterGatewayListeners processes the wrapped Gateway and returns a ListenerStatus for the given clusterName. In case of a single-cluster Gateway the wrapped Gateways status listeners are returned unmodified.

func (*GatewayWrapper) GetClusterGateways

func (g *GatewayWrapper) GetClusterGateways() []ClusterGateway

GetClusterGateways parse the wrapped Gateway and returns a list of ClusterGateway resources. In case of a single-cluster Gateway a single ClusterGateway is returned with the unmodified wrapped Gateway and the Gateway name used as values.

func (*GatewayWrapper) IsMultiCluster

func (g *GatewayWrapper) IsMultiCluster() bool

IsMultiCluster reports a type of the first address in the Status block returns false if no addresses present

func (*GatewayWrapper) Validate

func (g *GatewayWrapper) Validate() error

Validate ensures correctly configured underlying Gateway object Returns nil if validation passed

Jump to

Keyboard shortcuts

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