Documentation ¶
Index ¶
- Constants
- func AddressTypeToMultiCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool)
- func AddressTypeToSingleCluster(address gatewayapiv1.GatewayAddress) (gatewayapiv1.AddressType, bool)
- type ClusterGateway
- type ClusterGatewayTarget
- type GatewayTarget
- type GatewayWrapper
- func (g *GatewayWrapper) GetClusterGatewayAddresses() map[string][]gatewayapiv1.GatewayStatusAddress
- func (g *GatewayWrapper) GetClusterGatewayLabels(clusterName string) map[string]string
- func (g *GatewayWrapper) GetClusterGatewayListeners(clusterName string) []gatewayapiv1.ListenerStatus
- func (g *GatewayWrapper) GetClusterGateways() []ClusterGateway
- func (g *GatewayWrapper) IsMultiCluster() bool
- func (g *GatewayWrapper) Validate() error
Constants ¶
const ( LabelPrefix = "kuadrant.io/" ClustersLabelPrefix = "clusters." + LabelPrefix MultiClusterIPAddressType gatewayapiv1.AddressType = LabelPrefix + "MultiClusterIPAddress" MultiClusterHostnameAddressType gatewayapiv1.AddressType = LabelPrefix + "MultiClusterHostnameAddress" )
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 (t *ClusterGatewayTarget) GetGeo() v1alpha1.GeoCode
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