synced

package
v1.9.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Overview

Package synced provides tools for tracking if k8s resources have been initially sychronized with the k8s apiserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCRDResourceNames

func GetCRDResourceNames() []string

GetCRDResourceNames returns the list of Cilium CRDs we know about.

func SyncCRDs

func SyncCRDs(ctx context.Context, rs *Resources, ag *APIGroups) error

SyncCRDs will sync Cilium CRDs to ensure that they have all been installed inside the K8s cluster. These CRDs are added by the Cilium Operator. This function will block until it finds all the CRDs or if a timeout occurs.

Types

type APIGroups

type APIGroups struct {
	lock.RWMutex
	// contains filtered or unexported fields
}

APIGroups is a lockable map to hold which k8s API Groups we have enabled/in-use Note: We can replace it with a Go 1.9 map once we require that version

func (*APIGroups) AddAPI

func (m *APIGroups) AddAPI(api string)

func (*APIGroups) GetGroups

func (m *APIGroups) GetGroups() []string

func (*APIGroups) RemoveAPI

func (m *APIGroups) RemoveAPI(api string)

type Resources

type Resources struct {
	lock.RWMutex
	// contains filtered or unexported fields
}

Resources maps resource names to channels that are closed upon initial sync with k8s.

func (*Resources) BlockWaitGroupToSyncResources

func (r *Resources) BlockWaitGroupToSyncResources(
	stop <-chan struct{},
	swg *lock.StoppableWaitGroup,
	hasSyncedFunc cache.InformerSynced,
	resourceName string,
)

BlockWaitGroupToSyncResources ensures that anything which waits on waitGroup waits until all objects of the specified resource stored in Kubernetes are received by the informer and processed by controller. Fatally exits if syncing these initial objects fails. If the given stop channel is closed, it does not fatal. Once the k8s caches are synced against k8s, k8sCacheSynced is also closed.

func (*Resources) CancelWaitGroupToSyncResources

func (r *Resources) CancelWaitGroupToSyncResources(resourceName string)

func (*Resources) WaitForCacheSync

func (r *Resources) WaitForCacheSync(resourceNames ...string)

WaitForCacheSync waits for all K8s resources represented by resourceNames to have their K8s caches synchronized.

Jump to

Keyboard shortcuts

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