index

package
v0.0.0-...-a3b290e Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetKeyFunc

type GetKeyFunc func(interface{}) (string, error)

Return a unique key for the indexed selector object

type GetPodSelectorFunc

type GetPodSelectorFunc func(interface{}) []PodSelector

Select the pods for the given selector object using a set of pod selectors

type PodHashFunc

type PodHashFunc func(pod *v1.Pod) string

Calculate a hash over pod fields to detect pod changes that should trigger an update

type PodSelector

type PodSelector struct {
	// If specified, a specific namespace to select
	Namespace *string

	// If specified, a selector over namespace labels for namespaces
	// to include
	NsSelector labels.Selector

	// A selector over pods in the selected namespaces
	PodSelector labels.Selector
}

Represent a selector over a set of pods

func PodSelectorFromNsAndSelector

func PodSelectorFromNsAndSelector(ns string,
	selector *metav1.LabelSelector) []PodSelector

Create a pod selector slice of length one for the given namespace and label selector

type PodSelectorIndex

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

Pod selector index type

func NewPodSelectorIndex

func NewPodSelectorIndex(log *logrus.Logger,
	podIndexer cache.Indexer,
	namespaceIndexer cache.Indexer,
	objIndexer cache.Indexer,
	getKey GetKeyFunc,
	getPodSelector GetPodSelectorFunc) *PodSelectorIndex

Create a new pod selector index object

func (*PodSelectorIndex) DeleteNamespace

func (i *PodSelectorIndex) DeleteNamespace(ns *v1.Namespace)

Call to update the index when a namespace is deleted

func (*PodSelectorIndex) DeletePod

func (i *PodSelectorIndex) DeletePod(pod *v1.Pod)

Call to update the index when a pod is deleted

func (*PodSelectorIndex) DeleteSelectorObj

func (i *PodSelectorIndex) DeleteSelectorObj(obj interface{})

Call to update the index when the selector object is deleted

func (*PodSelectorIndex) GetObjForPod

func (i *PodSelectorIndex) GetObjForPod(podkey string) (ret []string)

Get the selector objects that match a given pod

func (*PodSelectorIndex) GetPodForObj

func (i *PodSelectorIndex) GetPodForObj(objkey string) (ret []string)

Get the pods that match a given selector object

func (*PodSelectorIndex) SetObjUpdateCallback

func (i *PodSelectorIndex) SetObjUpdateCallback(updateObj UpdateFunc)

Set a callback that will be called whenever the pods selected by an object change

func (*PodSelectorIndex) SetPodHashFunc

func (i *PodSelectorIndex) SetPodHashFunc(podHashFunc PodHashFunc)

Set a function to compute a hash over pod fields. When the pod hash changes, the object update callback will be called

func (*PodSelectorIndex) SetPodUpdateCallback

func (i *PodSelectorIndex) SetPodUpdateCallback(updatePod UpdateFunc)

Set a callback that will be called whenever the objects that select a pod change

func (*PodSelectorIndex) SetRemIpUpdateCallback

func (i *PodSelectorIndex) SetRemIpUpdateCallback(updateRemIpCont RemIpUpdateFunc)

Set a callback that will be called whenever pod selected by network policy change

func (*PodSelectorIndex) UpdateNamespace

func (i *PodSelectorIndex) UpdateNamespace(ns *v1.Namespace)

Call to update the index when a namespace's labels change

func (*PodSelectorIndex) UpdatePod

func (i *PodSelectorIndex) UpdatePod(pod *v1.Pod)

Call to update the index when a pod's labels change. Calls the callback if the pod's mapping has changed

func (*PodSelectorIndex) UpdatePodNoCallback

func (i *PodSelectorIndex) UpdatePodNoCallback(pod *v1.Pod) bool

Call to update the index when a pod's labels change. Returns true if a pod update should be queued

func (*PodSelectorIndex) UpdateSelectorObj

func (i *PodSelectorIndex) UpdateSelectorObj(obj interface{})

Call to update the index when the selector object's selector(s) change. Calls the callback if the selector object's mapping have changed

func (*PodSelectorIndex) UpdateSelectorObjNoCallback

func (i *PodSelectorIndex) UpdateSelectorObjNoCallback(obj interface{}) bool

Call to update the index when the selector object's selector(s) change. Returns true if the selector object's mapping have changed

type RemIpUpdateFunc

type RemIpUpdateFunc func(pod *v1.Pod, deleted bool)

Callback function for SetRemIpUpdateCallback

type UpdateFunc

type UpdateFunc func(key string)

Callback function for SetPodUpdateCallback or SetObjUpdateCallback

Jump to

Keyboard shortcuts

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