k8s

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// All possible states
	UNKNOWN uint8 = iota
	LEADER
	FOLLOWER

	// Name of the events
	BOOT_UP_AS_LEADER   = "BOOT_UP_AS_LEADER"
	BOOT_UP_AS_FOLLOWER = "BOOT_UP_AS_FOLLOWER"
	FOLLOWER_TO_LEADER  = "FOLLOWER_TO_LEADER"
	LOST_LEADERSHIP     = "LOST_LEADERSHIP"
)

Variables

This section is empty.

Functions

func AddGatewaysFromNSToIngestionQueue

func AddGatewaysFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func AddGatewaysFromNSToIngestionQueueWCP

func AddGatewaysFromNSToIngestionQueueWCP(numWorkers uint32, c *AviController, namespace string, msg string)

func AddIngressFromNSToIngestionQueue

func AddIngressFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func AddMultiClusterIngressFromNSToIngestionQueue

func AddMultiClusterIngressFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func AddNamespaceAnnotationEventHandler

func AddNamespaceAnnotationEventHandler(numWorkers uint32, c *AviController) cache.ResourceEventHandler

func AddNamespaceEventHandler

func AddNamespaceEventHandler(numWorkers uint32, c *AviController) cache.ResourceEventHandler

* Namespace Add event: will be called during each boot or newNS added. In add event * handler, just add valid namespaces as Ingress handling, present in namespace, will be done * during fullk8sync for reboot case or individual ingress handler called for ingress add event * (For second case, user will add namespace first and then ingress, so just validating namespace * should be enough)

Namespace Delete event: no op. Let individual event handler take care

Namespace update event: 2 cases to handle : NS label changed from 1) valid to invalid --> Call ingress and service delete * 2) invalid to valid --> Call ingress and service add

func AddPodEventHandler

func AddPodEventHandler(numWorkers uint32, c *AviController) cache.ResourceEventHandler

func AddRouteEventHandler

func AddRouteEventHandler(numWorkers uint32, c *AviController) cache.ResourceEventHandler

func AddRoutesFromNSToIngestionQueue

func AddRoutesFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func AddServiceImportsFromNSToIngestionQueue

func AddServiceImportsFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func AddServicesFromNSToIngestionQueue

func AddServicesFromNSToIngestionQueue(numWorkers uint32, c *AviController, namespace string, msg string)

func DeleteAviObjects

func DeleteAviObjects(parentVSKeys []avicache.NamespaceName, avi_obj_cache *avicache.AviObjCache, avi_rest_client_pool *utils.AviRestClientPool)

func DeleteConfigFromConfigmap

func DeleteConfigFromConfigmap(cs kubernetes.Interface) (bool, error)

func DeleteNPLAnnotations

func DeleteNPLAnnotations()

func GetSEGManagementNetwork

func GetSEGManagementNetwork(name, tenant string) string

Fetch SEG mgmt network

func InformerStatusUpdatesForGateway

func InformerStatusUpdatesForGateway(key string, gateway *advl4v1alpha1pre1.Gateway)

func InformerStatusUpdatesForSvcApiGateway

func InformerStatusUpdatesForSvcApiGateway(key string, gateway *servicesapi.Gateway)

func NewAdvL4Informers

func NewAdvL4Informers(cs advl4crd.Interface)

func NewCRDInformers

func NewCRDInformers()

func NewInfraSettingCRDInformer

func NewInfraSettingCRDInformer()

func NewIstioCRDInformers

func NewIstioCRDInformers(cs istiocrd.Interface)

func NewSvcApiInformers

func NewSvcApiInformers(cs svccrd.Interface)

func PopulateCache

func PopulateCache(tenant string) error

do not pass tenant, fetch the tenants here using avi client

func PopulateControllerProperties

func PopulateControllerProperties(cs kubernetes.Interface) error

func PopulateNodeCache

func PopulateNodeCache(cs *kubernetes.Clientset)

func SetAviInfrasettingNodeNetworks

func SetAviInfrasettingNodeNetworks(name, segMgmtNetwork, infraSEGName string, netAviInfra []akov1beta1.AviInfraSettingNodeNetwork, tenant string)

func SetAviInfrasettingVIPNetworks

func SetAviInfrasettingVIPNetworks(name, segMgmtNetwork, infraSEGName string, netAviInfra []akov1beta1.AviInfraSettingVipNetwork, tenant string)

func SetDeleteSyncChannel

func SetDeleteSyncChannel()

func SyncFromFastRetryLayer

func SyncFromFastRetryLayer(key interface{}, wg *sync.WaitGroup) error

func SyncFromIngestionLayer

func SyncFromIngestionLayer(key interface{}, wg *sync.WaitGroup) error

func SyncFromNodesLayer

func SyncFromNodesLayer(key interface{}, wg *sync.WaitGroup) error

func SyncFromSlowRetryLayer

func SyncFromSlowRetryLayer(key interface{}, wg *sync.WaitGroup) error

func SyncFromStatusQueue

func SyncFromStatusQueue(key interface{}, wg *sync.WaitGroup) error

Types

type AviController

type AviController struct {
	DisableSync bool
	State       *State
	// contains filtered or unexported fields
}

func SharedAviController

func SharedAviController() *AviController

func (*AviController) AddBootupNSEventHandler

func (c *AviController) AddBootupNSEventHandler(stopCh <-chan struct{}, startSyncCh chan struct{})

func (*AviController) CleanupStaleVSes

func (c *AviController) CleanupStaleVSes()

func (*AviController) DeleteModels

func (c *AviController) DeleteModels()

DeleteModels : Delete models and add the model name in the queue. The rest layer would pick up the model key and delete the objects in Avi

func (*AviController) FullSync

func (c *AviController) FullSync()

func (*AviController) FullSyncK8s

func (c *AviController) FullSyncK8s(sync bool) error

func (*AviController) GetValidator

func (c *AviController) GetValidator() Validator

func (*AviController) HandleConfigMap

func (c *AviController) HandleConfigMap(k8sinfo K8sinformers, ctrlCh chan struct{}, stopCh <-chan struct{}, quickSyncCh chan struct{}) error

HandleConfigMap : initialise the controller, start informer for configmap and wait for the akc configmap to be created. When the configmap is created, enable sync for other k8s objects. When the configmap is disabled, disable sync.

func (*AviController) InitController

func (c *AviController) InitController(informers K8sinformers, registeredInformers []string, ctrlCh <-chan struct{}, stopCh <-chan struct{}, quickSyncCh chan struct{}, waitGroupMap ...map[string]*sync.WaitGroup)

func (*AviController) InitVCFHandlers

func (c *AviController) InitVCFHandlers(kubeClient kubernetes.Interface, ctrlCh <-chan struct{}, stopCh <-chan struct{})

func (*AviController) InitializeNamespaceSync

func (c *AviController) InitializeNamespaceSync()

Controller Specific method

func (*AviController) IstioBootstrap

func (c *AviController) IstioBootstrap()

func (*AviController) NewFSM

func (c *AviController) NewFSM() *FSM

func (*AviController) NoOperation

func (c *AviController) NoOperation()

func (*AviController) OnLostLeadership

func (c *AviController) OnLostLeadership()

func (*AviController) OnNewLeader

func (c *AviController) OnNewLeader()

func (*AviController) OnNewLeaderDuringBootup

func (c *AviController) OnNewLeaderDuringBootup()

func (*AviController) OnStartedLeading

func (c *AviController) OnStartedLeading()

Leader election callback functions

func (*AviController) OnStartedLeadingAfterFailover

func (c *AviController) OnStartedLeadingAfterFailover()

func (*AviController) OnStartedLeadingDuringBootup

func (c *AviController) OnStartedLeadingDuringBootup()

Event Handler functions

func (*AviController) OnStoppedLeading

func (c *AviController) OnStoppedLeading()

func (*AviController) RefreshAuthToken

func (c *AviController) RefreshAuthToken()

func (*AviController) Run

func (c *AviController) Run(stopCh <-chan struct{}) error

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.

func (*AviController) SetSEGroupCloudNameFromNSAnnotations

func (c *AviController) SetSEGroupCloudNameFromNSAnnotations() bool

func (*AviController) SetupAKOCRDEventHandlers

func (c *AviController) SetupAKOCRDEventHandlers(numWorkers uint32)

SetupAKOCRDEventHandlers handles setting up of AKO CRD event handlers TODO: The CRD are getting re-enqueued for the same resourceVersion via fullsync as well as via these handlers. We can leverage the resourceVersion checks to optimize this code. However the CRDs would need a check on status for re-publish. The status does not change the resourceVersion and during fullsync we ignore a CRD if it's status is not updated.

func (*AviController) SetupAdvL4EventHandlers

func (c *AviController) SetupAdvL4EventHandlers(numWorkers uint32)

SetupAdvL4EventHandlers handles setting up of AdvL4 event handlers

func (*AviController) SetupEventHandlers

func (c *AviController) SetupEventHandlers(k8sinfo K8sinformers)

func (*AviController) SetupIstioCRDEventHandlers

func (c *AviController) SetupIstioCRDEventHandlers(numWorkers uint32)

SetupIstioCRDEventHandlers handles setting up of Istio CRD event handlers

func (*AviController) SetupMultiClusterIngressEventHandlers

func (c *AviController) SetupMultiClusterIngressEventHandlers(numWorkers uint32)

SetupMultiClusterIngressEventHandlers handles setting up of MultiClusterIngress CRD event handlers

func (*AviController) SetupNamespaceEventHandler

func (c *AviController) SetupNamespaceEventHandler(numWorkers uint32)

func (*AviController) SetupServiceImportEventHandlers

func (c *AviController) SetupServiceImportEventHandlers(numWorkers uint32)

SetupServiceImportEventHandlers handles setting up of ServiceImport CRD event handlers

func (*AviController) SetupSvcApiEventHandlers

func (c *AviController) SetupSvcApiEventHandlers(numWorkers uint32)

SetupServicesApi handles setting up of ServicesAPI event handlers

func (*AviController) Start

func (c *AviController) Start(stopCh <-chan struct{})

func (*AviController) SyncCRDObjects

func (c *AviController) SyncCRDObjects()

func (*AviController) TransitionToFollower

func (c *AviController) TransitionToFollower()

func (*AviController) TransitionToLeader

func (c *AviController) TransitionToLeader()

Transition functions

func (*AviController) ValidAviSecret

func (c *AviController) ValidAviSecret() bool

type Event

type Event struct {
	Name       string
	Handler    func()
	Transition func()
}

func (*Event) Handle

func (e *Event) Handle()

type FSM

type FSM struct {
	// key -> current state-next state
	Event map[string]*Event
}

type K8sinformers

type K8sinformers struct {
	Cs            kubernetes.Interface
	DynamicClient dynamic.Interface
	OshiftClient  oshiftclient.Interface
}

type State

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

type Validator

type Validator interface {
	ValidateHTTPRuleObj(key string, httprule *akov1beta1.HTTPRule) error
	ValidateHostRuleObj(key string, hostrule *akov1beta1.HostRule) error
	ValidateAviInfraSetting(key string, infraSetting *akov1beta1.AviInfraSetting) error
	ValidateMultiClusterIngressObj(key string, multiClusterIngress *akov1alpha1.MultiClusterIngress) error
	ValidateServiceImportObj(key string, serviceImport *akov1alpha1.ServiceImport) error
	ValidateSSORuleObj(key string, ssoRule *akov1alpha2.SSORule) error
	ValidateL4RuleObj(key string, l4Rule *akov1alpha2.L4Rule) error
	ValidateL7RuleObj(key string, l7Rule *akov1alpha2.L7Rule) error
}

func NewValidator

func NewValidator() Validator

Jump to

Keyboard shortcuts

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