controller

package
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SyncType values
	COMMAND         SyncType = "COMMAND"
	CONFIGMAP       SyncType = "CONFIGMAP"
	ENDPOINTS       SyncType = "ENDPOINTS"
	INGRESS         SyncType = "INGRESS"
	INGRESS_CLASS   SyncType = "INGRESS_CLASS"
	NAMESPACE       SyncType = "NAMESPACE"
	POD             SyncType = "POD"
	SERVICE         SyncType = "SERVICE"
	SECRET          SyncType = "SECRET"
	CUSTOM_RESOURCE SyncType = "CUSTOM_RESOURCE"
	PUBLISH_SERVICE SyncType = "PUBLISH_SERVICE"
	// Modes
	HTTP Mode = "http"
	TCP  Mode = "tcp"
	// Status
	ADDED    = store.ADDED
	DELETED  = store.DELETED
	ERROR    = store.ERROR
	EMPTY    = store.EMPTY
	MODIFIED = store.MODIFIED
)
View Source
const (
	CoreGroupVersion = "core.haproxy.org/v1alpha1"
)
View Source
const (
	TRACE_API = false
)

TRACE_API outputs all k8s events received from k8s API nolint golint

Variables

View Source
var ErrIgnored = errors.New("ignored resource")

Functions

This section is empty.

Types

type BackendCR added in v1.7.0

type BackendCR struct {
}

func NewBackendCR added in v1.7.0

func NewBackendCR() BackendCR

func (BackendCR) GetInformer added in v1.7.0

func (c BackendCR) GetInformer(eventChan chan SyncDataEvent, factory informers.SharedInformerFactory) cache.SharedIndexInformer

func (BackendCR) GetKind added in v1.7.0

func (c BackendCR) GetKind() string

func (BackendCR) ProcessEvent added in v1.7.0

func (c BackendCR) ProcessEvent(s *store.K8s, job SyncDataEvent) bool

type CR added in v1.7.0

type CR interface {
	GetKind() string
	GetInformer(chan SyncDataEvent, informers.SharedInformerFactory) cache.SharedIndexInformer
	ProcessEvent(*store.K8s, SyncDataEvent) bool
}

A Custom Resource interface Any CR should be able to provide its kind, its kubernetes Informer and a method to process the update of a CR

type CRManager added in v1.7.0

type CRManager struct {
	// contains filtered or unexported fields
}

func NewCRManager added in v1.7.0

func NewCRManager(s *store.K8s, restCfg *rest.Config, cacheResync time.Duration, eventChan chan SyncDataEvent, stop chan struct{}) CRManager

func (CRManager) EventCustomResource added in v1.7.0

func (m CRManager) EventCustomResource(job SyncDataEvent) bool

func (CRManager) RegisterCoreCR added in v1.7.0

func (m CRManager) RegisterCoreCR(cr CR)

func (CRManager) RunInformers added in v1.7.0

func (m CRManager) RunInformers(namespace string) []cache.InformerSynced

RunInformers runs Custom Resource Informers and return an array of corresponding cache.InformerSynced

type DefaultsCR added in v1.7.0

type DefaultsCR struct {
}

func NewDefaultsCR added in v1.7.0

func NewDefaultsCR() DefaultsCR

func (DefaultsCR) GetInformer added in v1.7.0

func (c DefaultsCR) GetInformer(eventChan chan SyncDataEvent, factory informers.SharedInformerFactory) cache.SharedIndexInformer

func (DefaultsCR) GetKind added in v1.7.0

func (c DefaultsCR) GetKind() string

func (DefaultsCR) ProcessEvent added in v1.7.0

func (c DefaultsCR) ProcessEvent(s *store.K8s, job SyncDataEvent) bool

type GlobalCR added in v1.7.0

type GlobalCR struct {
}

func NewGlobalCR added in v1.7.0

func NewGlobalCR() GlobalCR

func (GlobalCR) GetInformer added in v1.7.0

func (c GlobalCR) GetInformer(eventChan chan SyncDataEvent, factory informers.SharedInformerFactory) cache.SharedIndexInformer

func (GlobalCR) GetKind added in v1.7.0

func (c GlobalCR) GetKind() string

func (GlobalCR) ProcessEvent added in v1.7.0

func (c GlobalCR) ProcessEvent(s *store.K8s, job SyncDataEvent) bool

type HAProxyController

type HAProxyController struct {
	Cfg config.ControllerCfg

	Client         api.HAProxyClient
	OSArgs         utils.OSArgs
	Store          store.K8s
	PublishService *utils.NamespaceValue
	AuxCfgModTime  int64

	PodNamespace string
	PodPrefix    string
	// contains filtered or unexported fields
}

HAProxyController is ingress controller

func (*HAProxyController) Start

func (c *HAProxyController) Start()

Start initializes and runs HAProxyController

func (*HAProxyController) Stop added in v1.5.1

func (c *HAProxyController) Stop()

Stop handles shutting down HAProxyController

func (*HAProxyController) SyncData

func (c *HAProxyController) SyncData()

SyncData gets all kubernetes changes, aggregates them and apply to HAProxy. All the changes must come through this function

type K8s

type K8s struct {
	API                        *kubernetes.Clientset
	Logger                     utils.Logger
	DisableServiceExternalName bool // CVE-2021-25740
	RestConfig                 *rest.Config
}

K8s is structure with all data required to synchronize with k8s

func GetKubernetesClient

func GetKubernetesClient(disableServiceExternalName bool) (*K8s, error)

GetKubernetesClient returns new client that communicates with k8s

func GetRemoteKubernetesClient

func GetRemoteKubernetesClient(kubeconfig string, disableServiceExternalName bool) (*K8s, error)

GetRemoteKubernetesClient returns new client that communicates with k8s

func (*K8s) EventPods added in v1.7.0

func (k *K8s) EventPods(namespace, podPrefix string, resyncPeriod time.Duration, eventChan chan SyncDataEvent)

func (*K8s) EventsConfigfMaps

func (k *K8s) EventsConfigfMaps(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsEndpointSlices added in v1.7.0

func (k *K8s) EventsEndpointSlices(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsEndpoints

func (k *K8s) EventsEndpoints(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsIngressClass added in v1.5.0

func (k *K8s) EventsIngressClass(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsIngresses

func (k *K8s) EventsIngresses(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsNamespaces

func (k *K8s) EventsNamespaces(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsSecrets

func (k *K8s) EventsSecrets(channel chan SyncDataEvent, stop chan struct{}, informer cache.SharedIndexInformer)

func (*K8s) EventsServices

func (k *K8s) EventsServices(channel chan SyncDataEvent, ingressChan chan ingress.Sync, stop chan struct{}, informer cache.SharedIndexInformer, publishSvc *utils.NamespaceValue)

func (*K8s) IsNetworkingV1ApiSupported added in v1.5.0

func (k *K8s) IsNetworkingV1ApiSupported() bool

func (*K8s) IsNetworkingV1Beta1ApiSupported added in v1.5.0

func (k *K8s) IsNetworkingV1Beta1ApiSupported() bool

type Mode

type Mode string

type SyncDataEvent

type SyncDataEvent struct {
	SyncType
	CRKind    string
	Namespace string
	Name      string
	Data      interface{}
	// contains filtered or unexported fields
}

SyncDataEvent represents converted k8s received message

type SyncType

type SyncType string

SyncType represents type of k8s received message

type UpdateHandler added in v1.5.0

type UpdateHandler interface {
	Update(k store.K8s, cfg *config.ControllerCfg, api api.HAProxyClient) (reload bool, err error)
}

Directories

Path Synopsis
haproxy
api

Jump to

Keyboard shortcuts

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