ingestion

package
v0.0.0-...-c7431a4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlreadyExistsErr = "a GDP object already exists, can't add another"
	GDPSuccess       = "success"
)
View Source
const (
	BootupMsg              = "starting up amko"
	BootupSyncMsg          = "syncing all objects"
	BootupSyncEndMsg       = "synced all objects"
	AcceptedMsg            = "success: gslb config accepted"
	ControllerNotLeaderMsg = "error: controller not a leader"
	InvalidConfigMsg       = "error: invalid gslb config"
	EditRestartMsg         = "gslb config edited, amko needs a restart"
	AlreadySetMsg          = "error: can't add another gslbconfig"
	NoSecretMsg            = "error: secret object doesn't exist"
	KubeConfigErr          = "error: provided kubeconfig has an error"
	ControllerAPIErr       = "error: issue in connecting to the controller API"
	ClusterHealthCheckErr  = "error: cluster healthcheck failed, "
)
View Source
const (
	GslbHostRuleAccepted = "Accepted"
	GslbHostRuleRejected = "Rejected"
)

Variables

This section is empty.

Functions

func AddGDPObj

func AddGDPObj(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32, fullSync bool)

AddGDPObj creates a new GlobalFilter if not present on the first GDP object. Subsequent adds for GDP objects must fail as only one GDP object is allowed globally.

func AddGSLBConfigObject

func AddGSLBConfigObject(obj interface{}, initializeGSLBMemberClusters InitializeGSLBMemberClustersFn) error

AddGSLBConfigObject parses the gslb config object and starts informers for the member clusters.

func AddGSLBHostRuleObj

func AddGSLBHostRuleObj(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

func AddHostRule

func AddHostRule(numWorkers uint32, hrStore *store.ClusterStore, hr *akov1beta1.HostRule, c *GSLBMemberController)

func AddHostRuleEventHandler

func AddHostRuleEventHandler(numWorkers uint32, c *GSLBMemberController) cache.ResourceEventHandler

func AddIngressEventHandler

func AddIngressEventHandler(numWorkers uint32, c *GSLBMemberController) cache.ResourceEventHandler

func AddLBSvcEventHandler

func AddLBSvcEventHandler(numWorkers uint32, c *GSLBMemberController) cache.ResourceEventHandler

func AddMultiClusterIngressEventHandler

func AddMultiClusterIngressEventHandler(numWorkers uint32, c *GSLBMemberController) cache.ResourceEventHandler

func AddNamespaceEventHandler

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

func AddOrUpdateHostRuleStore

func AddOrUpdateHostRuleStore(clusterHRStore *store.ClusterStore,
	hr *akov1beta1.HostRule, cname string)

AddOrUpdateHostRuleStore traverses through the cluster store for cluster name cname, and then to ns store for the HostRule's namespace and then adds/updates the GS FQDN obj in the object map store.

func AddOrUpdateIngressStore

func AddOrUpdateIngressStore(clusterRouteStore *store.ClusterStore,
	ingHost k8sobjects.IngressHostMeta, cname string)

AddOrUpdateIngressStore traverses through the cluster store for cluster name cname, and then to ns store for the ingressHost's namespace and then adds/updates the ingressHost obj in the object map store.

func AddOrUpdateLBSvcStore

func AddOrUpdateLBSvcStore(clusterSvcStore *store.ClusterStore,
	svc *corev1.Service, cname string)

AddOrUpdateLBSvcStore traverses through the cluster store for cluster name cname, and then to ns store for the service's namespace and then adds/updates the service obj in the object map store.

func AddOrUpdateMultiClusterIngressStore

func AddOrUpdateMultiClusterIngressStore(clusterRouteStore *store.ClusterStore,
	multiClusterIngHost k8sobjects.MultiClusterIngressHostMeta, cname string)

AddOrUpdateMultiClusterIngressStore traverses through the cluster store for cluster name cname, and then to ns store for the ingressHost's namespace and then adds/updates the ingressHost obj in the object map store.

func AddOrUpdateNSStore

func AddOrUpdateNSStore(clusterNSStore *store.ObjectStore, ns *corev1.Namespace, cname string)

func AddOrUpdateRouteStore

func AddOrUpdateRouteStore(clusterRouteStore *store.ClusterStore,
	route *routev1.Route, cname string)

AddOrUpdateRouteStore traverses through the cluster store for cluster name cname, and then to ns store for the route's namespace and then adds/updates the route obj in the object map store.

func AddRouteEventHandler

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

func BuildContextConfig

func BuildContextConfig(kubeconfigPath, context string) (*restclient.Config, error)

BuildContextConfig builds the kubernetes/openshift context config

func CacheRefreshRoutine

func CacheRefreshRoutine()

CacheRefreshRoutine fetches the objects in the AVI controller and finds out the delta between the existing and the new objects.

func CheckAcceptedGSLBConfigAndInitalize

func CheckAcceptedGSLBConfigAndInitalize(gcList *gslbalphav1.GSLBConfigList) (bool, error)

CheckAcceptedGSLBConfigAndInitalize checks whether there's already an accepted GSLBConfig object that exists. If yes, we take that and set as our GSLB configuration.

func CheckAndSetGslbLeader

func CheckAndSetGslbLeader() error

func CheckGSLBConfigsAndInitialize

func CheckGSLBConfigsAndInitialize() bool

CheckGSLBConfigsAndInitialize iterates through all the GSLBConfig objects in the system and does: 1. add a GSLBConfig object if only one GSLBConfig object exists with accepted state. 2. add a GSLBConfig object if only one GSLBConfig object (in non-accepted state). 3. returns false if there was an error on either of the above two conditions, else retruns true.

func CreateController

func CreateController()

func DeleteFromHostRuleStore

func DeleteFromHostRuleStore(hrStore *store.ClusterStore,
	hr *akov1beta1.HostRule, cname string)

DeleteFromHostRuleStore traverses through the cluster store for cluster name cname, and then ns store for the HostRule's namespace and then deletes the HostRule key from the object map store.

func DeleteFromIngressStore

func DeleteFromIngressStore(clusterIngStore *store.ClusterStore,
	ingHost k8sobjects.IngressHostMeta, cname string) bool

DeleteFromIngressStore traverses through the cluster store for cluster name cname, and then ns store for the ingHost's namespace and then deletes the ingHost key from the object map store.

func DeleteFromLBSvcStore

func DeleteFromLBSvcStore(clusterSvcStore *store.ClusterStore,
	svc *corev1.Service, cname string)

DeleteFromLBSvcStore traverses through the cluster store for cluster name cname, and then ns store for the service's namespace and then deletes the service key from the object map store.

func DeleteFromMultiClusterIngressStore

func DeleteFromMultiClusterIngressStore(clusterIngStore *store.ClusterStore,
	multiClusterIngHost k8sobjects.MultiClusterIngressHostMeta, cname string) bool

DeleteFromMultiClusterIngressStore traverses through the cluster store for cluster name cname, and then ns store for the ingHost's namespace and then deletes the ingHost key from the object map store.

func DeleteFromNSStore

func DeleteFromNSStore(clusterNSStore *store.ObjectStore, ns *corev1.Namespace, cname string)

func DeleteFromRouteStore

func DeleteFromRouteStore(clusterRouteStore *store.ClusterStore,
	route *routev1.Route, cname string) bool

DeleteFromRouteStore traverses through the cluster store for cluster name cname, and then ns store for the route's namespace and then deletes the route key from the object map store.

func DeleteGDPObj

func DeleteGDPObj(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

DeleteGDPObj requires to delete the filters that were previously created. If a GDP object is deleted, the previously accepted and rejected objects need to pass through this filter again to find out which filter is applicable, the global one or the local one.

func DeleteGSLBHostRuleObj

func DeleteGSLBHostRuleObj(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

func DeleteNamespacedObjsFromAllStores

func DeleteNamespacedObjsFromAllStores(k8swq []workqueue.RateLimitingInterface, numWorkers uint32, nsMeta k8sobjects.NSMeta)

func GDPSanityChecks

func GDPSanityChecks(gdp *gdpalphav2.GlobalDeploymentPolicy, fullSync bool) error

func GenerateKubeConfig

func GenerateKubeConfig() error

GenerateKubeConfig reads the kubeconfig given through the environment variable decodes it and then writes to a temporary file.

func GenerateModels

func GenerateModels(gsCache *avicache.AviCache)

func GetObjTypeStores

func GetObjTypeStores(objType string) (string, *store.ClusterStore, *store.ClusterStore, error)

func GetStopChannel

func GetStopChannel() <-chan struct{}

func GetUUIDFromGSLBConfig

func GetUUIDFromGSLBConfig(gcObj *gslbalphav1.GSLBConfig) error

func HandleBootup

func HandleBootup(cfg *restclient.Config) (bool, error)

func HandleHostRuleAliasChange

func HandleHostRuleAliasChange(fqdn, cname string, oldAliasList, newAliasList []string)

func InformersToRegister

func InformersToRegister(oclient *oshiftclient.Clientset, kclient *kubernetes.Clientset, cname string) ([]string, error)

func Initialize

func Initialize()

Initialize initializes the first controller which looks for GSLB Config

func InitializeClusterClient

func InitializeClusterClient(cfg *restclient.Config) (client.Client, error)

func IsGSLBConfigValid

func IsGSLBConfigValid(obj interface{}) (*gslbalphav1.GSLBConfig, error)

IsGSLBConfigValid returns true if the the GSLB Config object was created in "avi-system" namespace. TODO: Validate the controllers inside the config object

func MoveNSObjs

func MoveNSObjs(nsObjs []string, fromStore *store.ObjectStore, toStore *store.ObjectStore)

func MoveObjs

func MoveObjs(objList []string, fromStore *store.ClusterStore, toStore *store.ClusterStore, objType string)

MoveObjs moves the objects in "objList" from "fromStore" to "toStore". TODO: call this function via an interface, so we can remove dependency

on objType.

func PublishChangeToRestLayer

func PublishChangeToRestLayer(gsKey interface{}, sharedQ *utils.WorkerQueue)

func ReApplyObjectsOnHostRule

func ReApplyObjectsOnHostRule(hr *akov1beta1.HostRule, add bool, cname, lfqdn, gfqdn string, numWorkers uint32,
	k8swq []workqueue.RateLimitingInterface)

func ResyncNodesToRestLayer

func ResyncNodesToRestLayer()

func RunControllers

func RunControllers(gslbController *GSLBConfigController, gdpController *GDPController, gslbhrCtrl *GSLBHostRuleController, stopCh <-chan struct{})

func SetInformerListTimeout

func SetInformerListTimeout(val int64)

func StartGraphLayerWorkers

func StartGraphLayerWorkers()

func UpdateGDPObj

func UpdateGDPObj(old, new interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

UpdateGDPObj updates the global and the namespace filters if a the GDP object was really changed. The update of a GDP object also requires re-evaluation of all the previously accepted and rejected objects. Hence, those are re-evaluated and added or deleted based on whether or not, they pass the new fitler objects. TODO: Optimize the filter process a bit more based on how the filters are processed.

func UpdateGSLBHostRuleObj

func UpdateGSLBHostRuleObj(old, new interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

func ValidateGSLBHostRule

func ValidateGSLBHostRule(gslbhr *gslbhralphav1.GSLBHostRule, fullSync bool) error

func WriteChangedObjsToQueue

func WriteChangedObjsToQueue(k8swq []workqueue.RateLimitingInterface, numWorkers uint32, allGSPropertyChanged bool,
	clustersToBeSynced []string)

Types

type AMKOClusterReconciler

type AMKOClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

func (*AMKOClusterReconciler) Reconcile

func (r *AMKOClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*AMKOClusterReconciler) SetupWithManager

func (r *AMKOClusterReconciler) SetupWithManager(mgr ctrl.Manager) error

type AddDelGSLBHostRulefn

type AddDelGSLBHostRulefn func(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

type GDPAddfn

type GDPAddfn func(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32, fullSync bool)

GDPAddfn is a type of function which handles an add or a delete of a GDP object

type GDPController

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

GDPController defines the members required to hold an instance of a controller handling GDP events.

func InitializeGDPController

func InitializeGDPController(kubeclientset kubernetes.Interface,
	gdpclientset gdpcs.Interface,
	gslbInformerFactory gdpinformers.SharedInformerFactory,
	AddGDPFunc GDPAddfn, UpdateGDPFunc GDPUpdfn,
	DeleteGDPFunc GDPDelfn) *GDPController

InitializeGDPController handles initialization of a controller which handles GDP object events. Also, starts the required informers for this.

func (*GDPController) Run

func (gdpController *GDPController) Run(stopCh <-chan struct{}) error

type GDPDelfn

type GDPDelfn func(obj interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

GDPDelfn is a type of function which handles an add or a delete of a GDP object

type GDPUpdfn

type GDPUpdfn func(old, new interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

GDPUpdfn is a function type which handles an update of a GDP object.

type GSLBConfigAddfn

type GSLBConfigAddfn func(obj interface{}, f InitializeGSLBMemberClustersFn) error

type GSLBConfigController

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

func GetNewController

func GetNewController(kubeclientset kubernetes.Interface, gslbclientset gslbcs.Interface,
	gslbInformerFactory gslbinformers.SharedInformerFactory,
	AddGSLBConfigFunc GSLBConfigAddfn,
	initializeMemberClusters InitializeGSLBMemberClustersFn) *GSLBConfigController

GetNewController builds the GSLB Controller which has an informer for GSLB Config object

func (*GSLBConfigController) Cleanup

func (gslbController *GSLBConfigController) Cleanup()

func (*GSLBConfigController) Run

func (gslbController *GSLBConfigController) Run(stopCh <-chan struct{}) error

type GSLBHostRuleController

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

func InitializeGSLBHostRuleController

func InitializeGSLBHostRuleController(kubeclientset kubernetes.Interface,
	gslbhrclientset gslbcs.Interface,
	gslbInformerFactory gslbinformers.SharedInformerFactory,
	AddGSLBHostRuleObj AddDelGSLBHostRulefn,
	UpdateGSLBHostRuleObj UpdateGSLBHostRulefn, DeleteGSLBHostRuleObj AddDelGSLBHostRulefn) *GSLBHostRuleController

func (*GSLBHostRuleController) Run

func (gslbHostRuleController *GSLBHostRuleController) Run(stopCh <-chan struct{}) error

type GSLBMemberController

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

GSLBMemberController is actually kubernetes cluster which is added to an AVI controller here which is added to an AVI controller

func GetGSLBMemberController

func GetGSLBMemberController(clusterName string, informersInstance *containerutils.Informers,
	hrInformer *hrinformer.HostRuleInformer) GSLBMemberController

GetAviController sets config for an AviController

func InitializeGSLBMemberClusters

func InitializeGSLBMemberClusters(membersKubeConfig string, memberClusters []gslbalphav1.MemberCluster) ([]*GSLBMemberController, error)

InitializeGSLBClusters initializes the GSLB member clusters

func InitializeMemberCluster

func InitializeMemberCluster(cfg *restclient.Config, cluster KubeClusterDetails,
	clients map[string]*kubernetes.Clientset) (*GSLBMemberController, error)

func (GSLBMemberController) GetName

func (ctrl GSLBMemberController) GetName() string

func (*GSLBMemberController) Run

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

func (*GSLBMemberController) SetupEventHandlers

func (c *GSLBMemberController) SetupEventHandlers(k8sinfo K8SInformers)

SetupEventHandlers sets up event handlers for the controllers of the member clusters. They define the ingress/route event handlers and start the informers as well.

func (*GSLBMemberController) Start

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

type InitializeGSLBMemberClustersFn

type InitializeGSLBMemberClustersFn func(string, []gslbalphav1.MemberCluster) ([]*GSLBMemberController, error)

type K8SInformers

type K8SInformers struct {
	Cs kubernetes.Interface
}

type KubeClusterDetails

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

func GetNewKubeClusterDetails

func GetNewKubeClusterDetails(clusterName, kubeConfig, kubeapi string, informers *utils.Informers) KubeClusterDetails

func (KubeClusterDetails) GetClusterContextName

func (kc KubeClusterDetails) GetClusterContextName() string

type UpdateGSLBHostRulefn

type UpdateGSLBHostRulefn func(old, new interface{}, k8swq []workqueue.RateLimitingInterface, numWorkers uint32)

Jump to

Keyboard shortcuts

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