Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertIngressRules(ingressRules []extensions.IngressRule) map[string]*IngressRule
- func ConvertIngressTLS(ingressTLS []extensions.IngressTLS) map[string]*IngressTLS
- func SetDefaultAnnotation(annotation, value string)
- type ConfigMap
- type Configuration
- type EndpointIP
- type EndpointIPs
- type EndpointPort
- type EndpointPorts
- type Endpoints
- type HAProxyController
- func (c *HAProxyController) ActiveConfiguration() (*parser.Parser, error)
- func (c *HAProxyController) HAProxyInitialize()
- func (c *HAProxyController) HAProxyReload() error
- func (c *HAProxyController) RequestsHTTPRefresh() (needsReload bool)
- func (c *HAProxyController) RequestsTCPRefresh() (needsReload bool)
- func (c *HAProxyController) Start(ctx context.Context, osArgs utils.OSArgs)
- func (c *HAProxyController) SyncData(jobChan <-chan SyncDataEvent, chConfigMapReceivedAndProcessed chan bool)
- type HTTPRequestRules
- type Ingress
- type IngressPath
- type IngressRule
- type IngressTLS
- type K8s
- func (k *K8s) EventsConfigfMaps(channel chan *ConfigMap, stop chan struct{})
- func (k *K8s) EventsEndpoints(channel chan *Endpoints, stop chan struct{})
- func (k *K8s) EventsIngresses(channel chan *Ingress, stop chan struct{})
- func (k *K8s) EventsNamespaces(channel chan *Namespace, stop chan struct{})
- func (k *K8s) EventsSecrets(channel chan *Secret, stop chan struct{})
- func (k *K8s) EventsServices(channel chan *Service, stop chan struct{}, publishSvc *Service)
- func (k *K8s) GetPublishServiceAddresses(service *corev1.Service, publishSvc *Service)
- func (k *K8s) UpdateIngressStatus(ingress *Ingress, publishSvc *Service) (err error)
- 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 Mode
- type Namespace
- type NamespacesWatch
- type Rule
- type Secret
- type Service
- type ServicePort
- type Status
- type StringW
- type SyncDataEvent
- type SyncType
- type TCPRequestRules
- type UseBackendRule
- type UseBackendRules
Constants ¶
const ( FrontendHTTP = "http" FrontendHTTPS = "https" FrontendSSL = "ssl" )
const DEBUG_API = false //nolint golint
Variables ¶
var ( HAProxyCFG string HAProxyCertDir string HAProxyStateDir string HAProxyMapDir string )
var ErrIgnored = errors.New("Ignored resource") //nolint golint
Functions ¶
func ConvertIngressRules ¶
func ConvertIngressRules(ingressRules []extensions.IngressRule) map[string]*IngressRule
ConvertIngressRules converts data from kubernetes format
func ConvertIngressTLS ¶
func ConvertIngressTLS(ingressTLS []extensions.IngressTLS) map[string]*IngressTLS
ConvertIngressRules converts data from kubernetes format
func SetDefaultAnnotation ¶
func SetDefaultAnnotation(annotation, value string)
Types ¶
type ConfigMap ¶
type ConfigMap struct { Namespace string Name string Annotations MapStringW Status Status }
ConfigMap is usefull data from k8s structures about configmap
type Configuration ¶
type Configuration struct { Namespace map[string]*Namespace NamespacesAccess NamespacesWatch IngressClass string ConfigMap *ConfigMap ConfigMapTCPServices *ConfigMap PublishService *Service MapFiles haproxy.Maps HTTPRequests map[Rule]HTTPRequestRules HTTPRequestsStatus Status TCPRequests map[Rule]TCPRequestRules TCPRequestsStatus Status BackendSwitchingRules map[string]UseBackendRules BackendSwitchingStatus map[string]struct{} RateLimitingEnabled bool HTTPS bool SSLPassthrough bool }
func (*Configuration) Clean ¶
func (c *Configuration) Clean()
Clean cleans all the statuses of various data that was changed deletes them completely or just resets them if needed
func (*Configuration) GetNamespace ¶
func (c *Configuration) GetNamespace(name string) *Namespace
GetNamespace returns Namespace. Creates one if not existing
func (*Configuration) Init ¶
func (c *Configuration) Init(osArgs utils.OSArgs, mapDir string)
Init itialize configuration
func (*Configuration) IsRelevantNamespace ¶
func (c *Configuration) IsRelevantNamespace(namespace string) bool
func (*Configuration) NewNamespace ¶
func (c *Configuration) NewNamespace(name string) *Namespace
NewNamespace returns new initialized Namespace
type EndpointIP ¶
func (*EndpointIP) Equal ¶
func (a *EndpointIP) Equal(b *EndpointIP) bool
type EndpointIPs ¶
type EndpointIPs map[string]*EndpointIP
func (*EndpointIPs) Equal ¶
func (a *EndpointIPs) Equal(b *EndpointIPs) bool
type EndpointPort ¶
func (*EndpointPort) Equal ¶
func (a *EndpointPort) Equal(b *EndpointPort) bool
type EndpointPorts ¶
type EndpointPorts []*EndpointPort
func (*EndpointPorts) Equal ¶
func (a *EndpointPorts) Equal(b *EndpointPorts) bool
type Endpoints ¶
type Endpoints struct { Namespace string Service StringW BackendName string Ports *EndpointPorts Addresses *EndpointIPs Status Status }
Endpoints is usefull data from k8s structures about Endpoints
type HAProxyController ¶
type HAProxyController struct { NativeAPI *clientnative.HAProxyClient ActiveTransaction string ActiveTransactionHasChanges bool // contains filtered or unexported fields }
HAProxyController is ingress controller
func (*HAProxyController) ActiveConfiguration ¶
func (c *HAProxyController) ActiveConfiguration() (*parser.Parser, error)
func (*HAProxyController) HAProxyInitialize ¶
func (c *HAProxyController) HAProxyInitialize()
HAProxyInitialize runs HAProxy for the first time so native client can have access to it
func (*HAProxyController) HAProxyReload ¶
func (c *HAProxyController) HAProxyReload() error
func (*HAProxyController) RequestsHTTPRefresh ¶
func (c *HAProxyController) RequestsHTTPRefresh() (needsReload bool)
func (*HAProxyController) RequestsTCPRefresh ¶ added in v1.4.0
func (c *HAProxyController) RequestsTCPRefresh() (needsReload bool)
func (*HAProxyController) Start ¶
func (c *HAProxyController) Start(ctx context.Context, osArgs utils.OSArgs)
Start initialize and run HAProxyController
func (*HAProxyController) SyncData ¶
func (c *HAProxyController) SyncData(jobChan <-chan SyncDataEvent, chConfigMapReceivedAndProcessed chan bool)
SyncData gets all kubernetes changes, aggregates them and apply to HAProxy. All the changes must come through this function
type HTTPRequestRules ¶ added in v1.4.0
type HTTPRequestRules map[uint64]models.HTTPRequestRule
type Ingress ¶
type Ingress struct { Namespace string Name string Annotations MapStringW Rules map[string]*IngressRule DefaultBackend *IngressPath TLS map[string]*IngressTLS Status Status }
Ingress is usefull data from k8s structures about ingress
type IngressPath ¶
type IngressPath struct { ServiceName string ServicePortInt int64 ServicePortString string TargetPort int64 Path string IsTCPService bool IsSSLPassthrough bool IsDefaultBackend bool Status Status }
IngressPath is usefull data from k8s structures about ingress path
func ConvertIngressBackend ¶
func ConvertIngressBackend(ingressBackend *extensions.IngressBackend) *IngressPath
func (*IngressPath) Equal ¶
func (a *IngressPath) Equal(b *IngressPath) bool
Equal checks if Ingress Paths are equal
type IngressRule ¶
type IngressRule struct { Host string Paths map[string]*IngressPath Status Status }
IngressRule is usefull data from k8s structures about ingress rule
func (*IngressRule) Equal ¶
func (a *IngressRule) Equal(b *IngressRule) bool
Equal checks if Ingress Rules are equal
type IngressTLS ¶
IngressTLS describes the transport layer security associated with an Ingress.
func (*IngressTLS) Equal ¶ added in v1.4.0
func (a *IngressTLS) Equal(b *IngressTLS) bool
Equal checks if Ingress secrets are equal
type K8s ¶
type K8s struct {
API *kubernetes.Clientset
}
K8s is structure with all data required to synchronize with k8s
func GetKubernetesClient ¶
GetKubernetesClient returns new client that communicates with k8s
func GetRemoteKubernetesClient ¶
GetRemoteKubernetesClient returns new client that communicates with k8s
func (*K8s) EventsConfigfMaps ¶
func (*K8s) EventsEndpoints ¶
func (*K8s) EventsIngresses ¶
func (*K8s) EventsNamespaces ¶
func (*K8s) EventsSecrets ¶
func (*K8s) EventsServices ¶
func (*K8s) GetPublishServiceAddresses ¶
type MapStringW ¶
MapStringW stores values and enables
func ConvertToMapStringW ¶
func ConvertToMapStringW(annotations map[string]string) MapStringW
ConvertToMapStringW removes prefixes in annotation
func (*MapStringW) Equal ¶
func (a *MapStringW) Equal(b MapStringW) bool
Equal comapres 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 { Name string Relevant bool Ingresses map[string]*Ingress Endpoints map[string]*Endpoints Services map[string]*Service Secret map[string]*Secret Status Status // contains filtered or unexported fields }
Namespace is usefull data from k8s structures about namespace
type NamespacesWatch ¶
type Rule ¶ added in v1.4.0
type Rule string
const ( //nolint BLACKLIST Rule = "blacklist" //nolint RATE_LIMIT Rule = "rate-limit" //nolint SSL_REDIRECT Rule = "ssl-redirect" //nolint PROXY_PROTOCOL Rule = "proxy-protocol" //nolint REQUEST_CAPTURE Rule = "request-capture" //nolint REQUEST_SET_HEADER Rule = "request-set-header" //nolint WHITELIST Rule = "whitelist" )
type Service ¶
type Service struct { Namespace string Name string Ports []ServicePort Addresses []string //Used only for publish-service Annotations MapStringW Selector MapStringW Status Status }
Service is usefull data from k8s structures about service
type ServicePort ¶
ServicePort describes port of a service
func (*ServicePort) Equal ¶
func (a *ServicePort) Equal(b *ServicePort) bool
type StringW ¶
StringW string value that has modified flag
func GetValueFromAnnotations ¶
func GetValueFromAnnotations(annotationName string, annotations ...MapStringW) (data *StringW, err error)
GetValueFromAnnotations returns value by checking in multiple annotatins. moves through list until it finds value if value is new or deleted, we check for next state to correctly set watch & value
type SyncDataEvent ¶
type SyncDataEvent struct { SyncType Namespace string Data interface{} // contains filtered or unexported fields }
SyncDataEvent represents converted k8s received message
type TCPRequestRules ¶ added in v1.4.0
type TCPRequestRules map[uint64]models.TCPRequestRule
type UseBackendRule ¶
type UseBackendRules ¶
type UseBackendRules map[string]UseBackendRule
Source Files ¶
- acls.go
- annotations.go
- api.go
- backend-annotations.go
- backend-switching.go
- configuration.go
- controller.go
- events.go
- frontend-annotations.go
- global-annotations.go
- haproxy.go
- https.go
- kubernetes.go
- mode.go
- monitor.go
- rate-limiting.go
- requests.go
- status.go
- stringw.go
- sync.go
- tcp.go
- types-equal.go
- types.go