watchers

package
v0.0.0-...-686bfca Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sAPIGroupServiceV1Core = "core/v1::Service"
)

Variables

This section is empty.

Functions

func NewNetResourceSetUpdater

func NewNetResourceSetUpdater(k8sWatcher *K8sWatcher) *netResourceSetUpdater

Types

type CCEEndpointClient

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

func (*CCEEndpointClient) CCEEndpoints

func (client *CCEEndpointClient) CCEEndpoints(namespace string) cceclientv2.CCEEndpointInterface

func (*CCEEndpointClient) Get

func (client *CCEEndpointClient) Get(namespace, name string) (*ccev2.CCEEndpoint, error)

func (*CCEEndpointClient) List

func (client *CCEEndpointClient) List() ([]*ccev2.CCEEndpoint, error)

type ENIClient

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

func (*ENIClient) ENIs

func (client *ENIClient) ENIs() cceclientv2.ENIInterface

func (*ENIClient) Get

func (client *ENIClient) Get(name string) (*ccev2.ENI, error)

func (*ENIClient) List

func (client *ENIClient) List() ([]*ccev2.ENI, error)

type K8sWatcher

type K8sWatcher struct {

	// NodeChain is the root of a notification chain for k8s Node events.
	// This NodeChain allows registration of subscriber.Node implementations.
	// On k8s Node events all registered subscriber.Node implementations will
	// have their event handling methods called in order of registration.
	NodeChain *subscriber.NodeChain

	// NetResourceSetChain is the root of a notification chain for NetResourceSet events.
	// This NetResourceSetChain allows registration of subscriber.NetResourceSet implementations.
	// On NetResourceSet events all registered subscriber.NetResourceSet implementations will
	// have their event handling methods called in order of registration.
	NetResourceSetChain *subscriber.NetResourceSetChain

	// CCEEndpointChain is the root of a notification chain for NetResourceSet events.
	// This CCEEndpointChain allows registration of subscriber.CCEEndpoint implementations.
	// On NetResourceSet events all registered subscriber.CCEEndpoint implementations will
	// have their event handling methods called in order of registration.
	CCEEndpointChain *subscriber.CCEEndpointChain

	// ENIChain is the root of a notification chain for ENI events.
	// This ENIChain allows registration of subscriber.CCEEndpointChain implementations.
	// On NetResourceSet events all registered subscriber.CCEEndpointChain implementations will
	// have their event handling methods called in order of registration.
	ENIChain *subscriber.ENIChain
	// contains filtered or unexported fields
}

func NewK8sWatcher

func NewK8sWatcher() *K8sWatcher

func (*K8sWatcher) GetAPIGroups

func (k *K8sWatcher) GetAPIGroups() []string

func (*K8sWatcher) GetK8sNode

func (k *K8sWatcher) GetK8sNode(_ context.Context, nodeName string) (*v1.Node, error)

GetK8sNode returns the *local Node* from the local store.

func (*K8sWatcher) GetStore

func (k *K8sWatcher) GetStore(name string) cache.Store

GetStore returns the k8s cache store for the given resource name.

func (*K8sWatcher) InitK8sSubsystem

func (k *K8sWatcher) InitK8sSubsystem(ctx context.Context, cachesSynced chan struct{})

InitK8sSubsystem takes a channel for which it will be closed when all caches essential for daemon are synchronized. To be called after WaitForCRDsToRegister() so that all needed CRDs have already been registered.

func (*K8sWatcher) K8sEventProcessed

func (k *K8sWatcher) K8sEventProcessed(scope, action string, status bool)

K8sEventProcessed is called to do metrics accounting for each processed Kubernetes event

func (*K8sWatcher) K8sEventReceived

func (k *K8sWatcher) K8sEventReceived(apiResourceName, scope, action string, valid, equal bool)

K8sEventReceived does metric accounting for each received Kubernetes event, as well as notifying of events for k8s resources synced.

func (*K8sWatcher) NewCCEEndpointClient

func (k *K8sWatcher) NewCCEEndpointClient() *CCEEndpointClient

func (*K8sWatcher) NewENIClient

func (k *K8sWatcher) NewENIClient() *ENIClient

func (*K8sWatcher) NewPodClient

func (k *K8sWatcher) NewPodClient() *PodClient

func (*K8sWatcher) NodesInit

func (k *K8sWatcher) NodesInit(k8sClient *k8s.K8sClient)

func (*K8sWatcher) RegisterCCEEndpointSubscriber

func (k *K8sWatcher) RegisterCCEEndpointSubscriber(s subscriber.CCEEndpoint)

RegisterCCEEndpointSubscriber allows registration of subscriber.CCEEndpoint implementations. On CCEEndpoint events all registered subscriber.CCEEndpoint implementations will have their event handling methods called in order of registration.

func (*K8sWatcher) RegisterENISubscriber

func (k *K8sWatcher) RegisterENISubscriber(s subscriber.ENI)

RegisterENISubscriber allows registration of subscriber.ENI implementations. On ENI events all registered subscriber.ENI implementations will have their event handling methods called in order of registration.

func (*K8sWatcher) RegisterNetResourceSetSubscriber

func (k *K8sWatcher) RegisterNetResourceSetSubscriber(s subscriber.NetResourceSet)

RegisterNetResourceSetSubscriber allows registration of subscriber.NetResourceSet implementations. On NetResourceSet events all registered subscriber.NetResourceSet implementations will have their event handling methods called in order of registration.

func (*K8sWatcher) RegisterNodeSubscriber

func (k *K8sWatcher) RegisterNodeSubscriber(s subscriber.Node)

RegisterNodeSubscriber allows registration of subscriber.Node implementations. On k8s Node events all registered subscriber.Node implementations will have their event handling methods called in order of registration.

func (*K8sWatcher) WaitForCRDsToRegister

func (k *K8sWatcher) WaitForCRDsToRegister(ctx context.Context) error

WaitForCRDsToRegister will wait for the CCE Operator to register the CRDs with the apiserver. This step is required before launching the full K8s watcher, as those resource controllers need the resources to be registered with K8s first.

func (*K8sWatcher) WaitForCacheSync

func (k *K8sWatcher) WaitForCacheSync(resourceNames ...string)

WaitForCacheSync blocks until the given resources have been synchronized from k8s. Note that if the controller for a resource has not been started, the wait for that resource returns immediately. If it is required that the resource exists and is actually synchronized, the caller must ensure the controller for that resource has been started before calling WaitForCacheSync. For most resources this can be done by receiving from controllersStarted channel (<-k.controllersStarted), which is closed after most watchers have been started.

func (*K8sWatcher) WaitForCacheSyncWithTimeout

func (k *K8sWatcher) WaitForCacheSyncWithTimeout(timeout time.Duration, resourceNames ...string) error

WaitForCacheSyncWithTimeout calls WaitForCacheSync to block until given resources have had their caches synced from K8s. This will wait up to the timeout duration after starting or since the last K8s registered watcher event (i.e. each event causes the timeout to be pushed back). Events are recorded using K8sResourcesSynced.Event function. If the timeout is exceeded, an error is returned.

type PodClient

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

func (*PodClient) Get

func (client *PodClient) Get(namespace, name string) (*corev1.Pod, error)

func (*PodClient) List

func (client *PodClient) List() ([]*corev1.Pod, error)

type WatcherConfiguration

type WatcherConfiguration interface {
	utils.ServiceConfiguration
	utils.IngressConfiguration
}

WatcherConfiguration is the required configuration for enableK8sWatchers

Directories

Path Synopsis
This package contains exported resource identifiers and metric resource labels related to K8s watchers.
This package contains exported resource identifiers and metric resource labels related to K8s watchers.
Package subscriber implements a mechanism to represent K8s watcher subscribers and allows K8s events to objects / resources to notify their respective subscribers.
Package subscriber implements a mechanism to represent K8s watcher subscribers and allows K8s events to objects / resources to notify their respective subscribers.

Jump to

Keyboard shortcuts

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