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 BackendHTTPReqs
- type ConfigMap
- type Configuration
- type EndpointIP
- type EndpointIPs
- type EndpointPort
- type EndpointPorts
- type Endpoints
- type FrontendHTTPReqs
- type FrontendHTTPRsps
- type FrontendTCPReqs
- type HAProxyController
- func (c *HAProxyController) BackendHTTPReqsRefresh() (reload bool)
- func (c *HAProxyController) FrontendHTTPReqsRefresh() (reload bool)
- func (c *HAProxyController) FrontendHTTPRspsRefresh() (reload bool)
- func (c *HAProxyController) FrontendTCPreqsRefresh() (reload bool)
- func (c *HAProxyController) HAProxyProcess() (*os.Process, error)
- func (c *HAProxyController) Start(ctx context.Context, osArgs utils.OSArgs)
- func (c *HAProxyController) SyncData(jobChan <-chan SyncDataEvent, chConfigMapReceivedAndProcessed chan bool)
- 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 UseBackendRule
- type UseBackendRules
Constants ¶
const ( FrontendHTTP = "http" FrontendHTTPS = "https" FrontendSSL = "ssl" )
const TRACE_API = false //nolint golint
TRACE_API outputs all k8s events received from k8s API
Variables ¶
var ( HAProxyCFG string HAProxyCertDir string HAProxyStateDir string HAProxyMapDir string HAProxyPIDFile 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 BackendHTTPReqs ¶ added in v1.4.3
type BackendHTTPReqs struct {
// contains filtered or unexported fields
}
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
FrontendHTTPReqRules map[Rule]FrontendHTTPReqs
FrontendHTTPRspRules map[Rule]FrontendHTTPRsps
FrontendTCPRules map[Rule]FrontendTCPReqs
FrontendRulesStatus map[Mode]Status
BackendSwitchingRules map[string]UseBackendRules
BackendSwitchingStatus map[string]struct{}
BackendHTTPRules map[string]BackendHTTPReqs
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 initialize 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 FrontendHTTPReqs ¶ added in v1.4.3
type FrontendHTTPReqs map[uint64]models.HTTPRequestRule
type FrontendHTTPRsps ¶ added in v1.4.4
type FrontendHTTPRsps map[uint64]models.HTTPResponseRule
type FrontendTCPReqs ¶ added in v1.4.3
type FrontendTCPReqs map[uint64]models.TCPRequestRule
type HAProxyController ¶
type HAProxyController struct {
Client api.HAProxyClient
HAProxyCfgDir string
Logger utils.Logger
// contains filtered or unexported fields
}
HAProxyController is ingress controller
func (*HAProxyController) BackendHTTPReqsRefresh ¶ added in v1.4.3
func (c *HAProxyController) BackendHTTPReqsRefresh() (reload bool)
func (*HAProxyController) FrontendHTTPReqsRefresh ¶ added in v1.4.3
func (c *HAProxyController) FrontendHTTPReqsRefresh() (reload bool)
func (*HAProxyController) FrontendHTTPRspsRefresh ¶ added in v1.4.4
func (c *HAProxyController) FrontendHTTPRspsRefresh() (reload bool)
func (*HAProxyController) FrontendTCPreqsRefresh ¶ added in v1.4.3
func (c *HAProxyController) FrontendTCPreqsRefresh() (reload bool)
func (*HAProxyController) HAProxyProcess ¶ added in v1.4.4
func (c *HAProxyController) HAProxyProcess() (*os.Process, error)
Return HAProxy master process if it exists.
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 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
Logger utils.Logger
}
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 SET_HOST Rule = "set-host" //nolint SSL_REDIRECT Rule = "ssl-redirect" //nolint PATH_REWRITE Rule = "path-rewrite" //nolint PROXY_PROTOCOL Rule = "proxy-protocol" //nolint REQUEST_CAPTURE Rule = "request-capture" //nolint REQUEST_SET_HEADER Rule = "request-set-header" //nolint RESPONSE_SET_HEADER Rule = "response-set-header" //nolint WHITELIST Rule = "whitelist" )
type Service ¶
type Service struct {
Namespace string
Name string
Ports []ServicePort
Addresses []string //Used only for publish-service
DNS string
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 UseBackendRule ¶
type UseBackendRules ¶
type UseBackendRules map[string]UseBackendRule