Documentation
¶
Index ¶
- Constants
- func CopyAnnotations(in map[string]string) map[string]string
- func EqualMap[T, V Literal](mapA, mapB map[T]V) bool
- func EqualPointers[P Literal](a, b *P) bool
- func EqualSlice[T Equalizer[T]](sliceA, sliceB []T) bool
- func EqualSliceComparable[T comparable](sliceA, sliceB []T) bool
- func NoNilPointer[P any](pointers ...*P) bool
- type AllowedRoutes
- type BackendRef
- type BackendRefs
- type ConfigMap
- type ConfigMaps
- type CustomResources
- type Endpoints
- type Equalizer
- type ErrNotFound
- type Gateway
- type GatewayClass
- type HAProxySrv
- type Ingress
- type IngressClass
- type IngressCore
- type IngressPath
- type IngressRule
- type IngressTLS
- type K8s
- func (k *K8s) Clean()
- func (k *K8s) EventBackendCR(namespace, name string, data *v1.Backend) bool
- func (k *K8s) EventConfigMap(ns *Namespace, data *ConfigMap) (updateRequired bool)
- func (k *K8s) EventDefaultsCR(namespace, name string, data *v1.Defaults) bool
- func (k *K8s) EventEndpoints(ns *Namespace, data *Endpoints, ...) (updateRequired bool)
- func (k *K8s) EventGateway(ns *Namespace, data *Gateway) (updateRequired bool)
- func (k *K8s) EventGatewayClass(data *GatewayClass) (updateRequired bool)
- func (k *K8s) EventGlobalCR(namespace, name string, data *v1.Global) bool
- func (k *K8s) EventIngress(ns *Namespace, data *Ingress) (updateRequired bool)
- func (k *K8s) EventIngressClass(data *IngressClass) (updateRequired bool)
- func (k *K8s) EventNamespace(ns *Namespace, data *Namespace) (updateRequired bool)
- func (k *K8s) EventPod(podEvent PodEvent) (updateRequired bool)
- func (k *K8s) EventPublishService(ns *Namespace, data *Service) (updateRequired bool)
- func (k *K8s) EventReferenceGrant(ns *Namespace, data *ReferenceGrant) (updateRequired bool)
- func (k *K8s) EventSecret(ns *Namespace, data *Secret) (updateRequired bool)
- func (k *K8s) EventService(ns *Namespace, data *Service) (updateRequired bool)
- func (k *K8s) EventTCPRoute(ns *Namespace, data *TCPRoute) (updateRequired bool)
- func (k K8s) GetEndpoints(namespace, name string) (endpoints map[string]*PortEndpoints, err error)
- func (k K8s) GetNamespace(name string) *Namespace
- func (k K8s) GetSecret(namespace, name string) (*Secret, error)
- func (k K8s) GetService(namespace, name string) (*Service, error)
- type LabelSelector
- type LabelSelectorRequirement
- type Listener
- type Listeners
- type Literal
- type MapStringW
- func (a *MapStringW) Clean()
- func (a *MapStringW) Clone() MapStringW
- func (a *MapStringW) Equal(b MapStringW) bool
- func (a *MapStringW) Get(name string) (data *StringW, err error)
- func (a *MapStringW) SetStatus(old MapStringW) (different bool)
- func (a *MapStringW) SetStatusState(state Status)
- func (a *MapStringW) String() string
- type Namespace
- type NamespacesWatch
- type ParentRef
- type ParentRefs
- type PodEvent
- type PortEndpoints
- type ReferenceGrant
- type ReferenceGrantFrom
- type ReferenceGrantTo
- type RouteGroupKind
- type RouteGroupKinds
- type RouteNamespaces
- type RuntimeBackend
- type Secret
- type Service
- type ServicePort
- type Status
- type StringW
- type TCPRoute
- type TCPRoutes
Constants ¶
const ( NETWORKINGV1 = "networking.k8s.io/v1" PATH_TYPE_EXACT = "Exact" PATH_TYPE_PREFIX = "Prefix" PATH_TYPE_IMPLEMENTATION_SPECIFIC = "ImplementationSpecific" )
const DefaultLocalBackend = "default-local-service"
const (
TCPProtocolType string = "TCP"
)
Variables ¶
This section is empty.
Functions ¶
func CopyAnnotations ¶
CopyAnnotations returns a copy of annotations map and removes prefixe from annotations name
func EqualPointers ¶ added in v1.10.0
func EqualSlice ¶ added in v1.10.0
func EqualSliceComparable ¶ added in v1.10.0
func EqualSliceComparable[T comparable](sliceA, sliceB []T) bool
func NoNilPointer ¶ added in v1.10.0
Types ¶
type AllowedRoutes ¶ added in v1.10.0
type AllowedRoutes struct {
Namespaces *RouteNamespaces
Kinds []RouteGroupKind
}
func (*AllowedRoutes) Equal ¶ added in v1.10.0
func (ar *AllowedRoutes) Equal(other *AllowedRoutes) bool
type BackendRef ¶ added in v1.10.0
type BackendRef struct {
Namespace *string
Port *int32
Weight *int32
Group *string
Kind *string
Name string
}
func (*BackendRef) Equal ¶ added in v1.10.0
func (backref *BackendRef) Equal(other *BackendRef) bool
type BackendRefs ¶ added in v1.10.0
type BackendRefs []BackendRef
func (BackendRefs) Equal ¶ added in v1.10.0
func (refs BackendRefs) Equal(other BackendRefs) bool
type ConfigMap ¶
type ConfigMap struct {
Annotations map[string]string
Namespace string
Name string
Status Status
Loaded bool
}
ConfigMap is useful data from k8s structures about configmap
type ConfigMaps ¶
type CustomResources ¶
type Endpoints ¶
type Endpoints struct {
SliceName string
Namespace string
Service string
Ports map[string]*PortEndpoints // Ports[portName]
Status Status
}
Endpoints describes endpoints of a service
type ErrNotFound ¶
type ErrNotFound error
type Gateway ¶ added in v1.10.0
type GatewayClass ¶ added in v1.10.0
type GatewayClass struct {
Description *string
Name string
ControllerName string
Status Status
Generation int64
}
func (*GatewayClass) Equal ¶ added in v1.10.0
func (gwc *GatewayClass) Equal(other *GatewayClass) bool
type HAProxySrv ¶
type HAProxySrv struct {
// Srv disabled is srv with address ""
Name string
Address string
Modified bool
Port int64
}
func (*HAProxySrv) String ¶ added in v1.8.4
func (h *HAProxySrv) String() string
type Ingress ¶
type Ingress struct {
IngressCore
Status Status // Used for store purpose
Addresses []string
Ignored bool // true if resource ignored because of non matching Controller Class
ClassUpdated bool
Faked bool
}
Ingress is useful data from k8s structures about ingress
func ConvertToIngress ¶
ConvertToIngress detects the interface{} provided by the SharedInformer and select the proper strategy to convert and return the resource as a store.Ingress struct
type IngressClass ¶
type IngressClass struct {
APIVersion string
Name string
Controller string
Annotations map[string]string
Status Status // Used for store purpose
}
func ConvertToIngressClass ¶
func ConvertToIngressClass(resource interface{}) (ingress *IngressClass, err error)
func (*IngressClass) Equal ¶ added in v1.10.5
func (a *IngressClass) Equal(b *IngressClass) bool
type IngressCore ¶
type IngressCore struct {
Annotations map[string]string
Rules map[string]*IngressRule
DefaultBackend *IngressPath
TLS map[string]*IngressTLS
APIVersion string // Required for K8s.UpdateIngressStatus to select proper versioned Client Set
Namespace string
Name string
Class string
}
type IngressPath ¶
type IngressPath struct {
SvcPortResolved *ServicePort
SvcNamespace string
SvcName string
SvcPortString string
Path string
PathTypeMatch string
SvcPortInt int64
IsDefaultBackend bool
}
IngressPath is useful data from k8s structures about ingress path
type IngressRule ¶
type IngressRule struct {
Paths map[string]*IngressPath
Host string
}
IngressRule is useful data from k8s structures about ingress rule
type IngressTLS ¶
IngressTLS describes the transport layer security associated with an Ingress.
type K8s ¶
type K8s struct {
ConfigMaps ConfigMaps
NamespacesAccess NamespacesWatch
Namespaces map[string]*Namespace
IngressClasses map[string]*IngressClass
SecretsProcessed map[string]struct{}
BackendsProcessed map[string]struct{}
GatewayClasses map[string]*GatewayClass
GatewayControllerName string
PublishServiceAddresses []string
HaProxyPods map[string]struct{}
UpdateAllIngresses bool
BackendsWithNoConfigSnippets map[string]struct{}
}
func NewK8sStore ¶
func (*K8s) EventBackendCR ¶
func (*K8s) EventConfigMap ¶
func (*K8s) EventDefaultsCR ¶
func (*K8s) EventEndpoints ¶
func (*K8s) EventGateway ¶ added in v1.10.0
func (*K8s) EventGatewayClass ¶ added in v1.10.0
func (k *K8s) EventGatewayClass(data *GatewayClass) (updateRequired bool)
func (*K8s) EventGlobalCR ¶
func (*K8s) EventIngress ¶
func (*K8s) EventIngressClass ¶
func (k *K8s) EventIngressClass(data *IngressClass) (updateRequired bool)
func (*K8s) EventNamespace ¶
func (*K8s) EventPublishService ¶
func (*K8s) EventReferenceGrant ¶ added in v1.10.0
func (k *K8s) EventReferenceGrant(ns *Namespace, data *ReferenceGrant) (updateRequired bool)
func (*K8s) EventSecret ¶
func (*K8s) EventService ¶
func (*K8s) EventTCPRoute ¶ added in v1.10.0
func (K8s) GetEndpoints ¶
func (k K8s) GetEndpoints(namespace, name string) (endpoints map[string]*PortEndpoints, err error)
GetEndpoints takes the ns and name of a service and provides a map of endpoints: portName --> *PortEndpoints
func (K8s) GetNamespace ¶
GetNamespace returns Namespace. Creates one if not existing
type LabelSelector ¶ added in v1.10.0
type LabelSelector struct {
MatchLabels map[string]string
MatchExpressions []LabelSelectorRequirement
}
func (*LabelSelector) Equal ¶ added in v1.10.0
func (labelSelector *LabelSelector) Equal(other *LabelSelector) bool
type LabelSelectorRequirement ¶ added in v1.10.0
func (LabelSelectorRequirement) Equal ¶ added in v1.10.0
func (lsr LabelSelectorRequirement) Equal(other LabelSelectorRequirement) bool
type Listener ¶ added in v1.10.0
type MapStringW ¶
MapStringW stores values and enables
func (*MapStringW) Equal ¶
func (a *MapStringW) Equal(b MapStringW) bool
Equal compares if two maps are equal
func (*MapStringW) Get ¶
func (a *MapStringW) Get(name string) (data *StringW, err error)
Get checks if name exists and if not, returns default value if defined
func (*MapStringW) SetStatus ¶
func (a *MapStringW) SetStatus(old MapStringW) (different bool)
SetStatus sets Status state for all items in map
func (*MapStringW) SetStatusState ¶
func (a *MapStringW) SetStatusState(state Status)
SetStatusState sets all watches to desired state
func (*MapStringW) String ¶
func (a *MapStringW) String() string
Get checks if name exists and if not, returns default value if defined
type Namespace ¶
type Namespace struct {
Secret map[string]*Secret
Ingresses map[string]*Ingress
Endpoints map[string]map[string]*Endpoints // service -> sliceName -> Endpoints
Services map[string]*Service
HAProxyRuntime map[string]map[string]*RuntimeBackend // service -> portName -> Backend
CRs *CustomResources
Gateways map[string]*Gateway
TCPRoutes map[string]*TCPRoute
ReferenceGrants map[string]*ReferenceGrant
Labels map[string]string
Name string
Status Status
Relevant bool
// contains filtered or unexported fields
}
Namespace is useful data from k8s structures about namespace
type NamespacesWatch ¶
type ParentRef ¶ added in v1.10.0
type ParentRefs ¶ added in v1.10.0
type ParentRefs []ParentRef
func (ParentRefs) Equal ¶ added in v1.10.0
func (refs ParentRefs) Equal(other ParentRefs) bool
type PortEndpoints ¶
PortEndpoints describes endpoints of a service port
func (*PortEndpoints) Equal ¶
func (a *PortEndpoints) Equal(b *PortEndpoints) bool
Equal checks if old PortEndpoints equals to a new PortEndpoints.
type ReferenceGrant ¶ added in v1.10.0
type ReferenceGrant struct {
Namespace string
Name string
Status Status
From []ReferenceGrantFrom
To []ReferenceGrantTo
Generation int64
}
func (*ReferenceGrant) Equal ¶ added in v1.10.0
func (rf *ReferenceGrant) Equal(other *ReferenceGrant) bool
type ReferenceGrantFrom ¶ added in v1.10.0
type ReferenceGrantTo ¶ added in v1.10.0
func (ReferenceGrantTo) Equal ¶ added in v1.10.0
func (refto ReferenceGrantTo) Equal(other ReferenceGrantTo) bool
type RouteGroupKind ¶ added in v1.10.0
type RouteGroupKinds ¶ added in v1.10.0
type RouteGroupKinds []RouteGroupKind
func (RouteGroupKinds) Equal ¶ added in v1.10.0
func (rgks RouteGroupKinds) Equal(other RouteGroupKinds) bool
type RouteNamespaces ¶ added in v1.10.0
type RouteNamespaces struct {
From *string
Selector *LabelSelector
}
func (*RouteNamespaces) Equal ¶ added in v1.10.0
func (rn *RouteNamespaces) Equal(other *RouteNamespaces) bool
type RuntimeBackend ¶
type RuntimeBackend struct {
Endpoints PortEndpoints
Name string
HAProxySrvs []*HAProxySrv
DynUpdateFailed bool
}
RuntimeBackend holds the runtime state of an HAProxy backend
type Service ¶
type Service struct {
Annotations map[string]string
Namespace string
Name string
DNS string
Status Status
Ports []ServicePort
Addresses []string // Used only for publish-service
Faked bool
}
Service is useful data from k8s structures about service
func (*Service) EqualWithAddresses ¶
type ServicePort ¶
ServicePort describes port of a service
func (*ServicePort) Equal ¶
func (a *ServicePort) Equal(b *ServicePort) bool