utils

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PropsAndTagsFromLabels

func PropsAndTagsFromLabels(labels map[string]string) (map[string]string, map[string]bool)

PropsAndTagsFromLabels converts k8s label set into SignalFx properties and tags formatted sets.

Types

type CachedPod

type CachedPod struct {
	UID             types.UID
	LabelSet        labels.Set
	OwnerReferences []metav1.OwnerReference
	Namespace       string
}

CachedPod is used for holding only the neccessary

type CachedService

type CachedService struct {
	UID       types.UID
	Name      string
	Namespace string
	Selector  labels.Selector
	// contains filtered or unexported fields
}

CachedService is used for holding only the neccesarry fields we need for label syncing

type PodCache

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

PodCache is used for holding values we care about from a pod for quicker lookup than querying the API for them each time.

func NewPodCache

func NewPodCache() *PodCache

NewPodCache creates a new minimal pod cache

func (*PodCache) AddPod

func (pc *PodCache) AddPod(pod *v1.Pod)

AddPod adds or updates a pod in cache This function should only be called after pc.IsCached to prevent unneccesary updates to the internal cache.

func (*PodCache) DeleteByKey

func (pc *PodCache) DeleteByKey(key types.UID)

DeleteByKey removes a pod from the cache given a UID

func (*PodCache) GetCachedPod

func (pc *PodCache) GetCachedPod(podUID types.UID) *CachedPod

GetCachedPod returns a CachedPod object from the cache if it exists

func (*PodCache) GetLabels

func (pc *PodCache) GetLabels(key types.UID) labels.Set

GetLabels retrieves a pod's cached label set

func (*PodCache) GetOwnerReferences

func (pc *PodCache) GetOwnerReferences(key types.UID) []metav1.OwnerReference

GetOwnerReferences retrieves a pod's cached owner references

func (*PodCache) GetPodsInNamespace

func (pc *PodCache) GetPodsInNamespace(namespace string) []types.UID

GetPodsInNamespace returns a list of pod UIDs given a namespace

func (*PodCache) IsCached

func (pc *PodCache) IsCached(pod *v1.Pod) bool

IsCached checks if a pod was already in the cache, or if the mapped values have changed. Returns true if no change

type ServiceCache

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

ServiceCache is used for holding values we care about from a pod for quicker lookup than querying the API for them each time.

func NewServiceCache

func NewServiceCache() *ServiceCache

NewServiceCache creates a new minimal pod cache

func (*ServiceCache) AddService

func (sc *ServiceCache) AddService(svc *v1.Service) bool

AddService adds or updates a service in cache This function should only be called after sc.IsCached to prevent unneccesary updates to the internal cache. Returns true if the service is added, false if it was ignored

func (*ServiceCache) Delete

func (sc *ServiceCache) Delete(svc *v1.Service)

Delete removes a service from the cache

func (*ServiceCache) DeleteByKey

func (sc *ServiceCache) DeleteByKey(svcUID types.UID) []types.UID

DeleteByKey removes a service from the cache given a UID Returns pods that were previously matched by this service so their properties may be updated accordingly

func (*ServiceCache) GetMatchingServices

func (sc *ServiceCache) GetMatchingServices(cachedPod *CachedPod) []string

GetMatchingServices returns a list of service names that match the given pod, given the services are in the cache already

func (*ServiceCache) IsCached

func (sc *ServiceCache) IsCached(svc *v1.Service) bool

IsCached checks if a service is already in the cache or if any of the the cached fields have changed.

Jump to

Keyboard shortcuts

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