utils

package
v0.0.0-...-45ed318 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ConditionSync        = "Sync"
	ConditionSyncSuccess = "Sync Success"

	ResourceReconciled = "Reconciled"
)

Variables

This section is empty.

Functions

func DiffPods

func DiffPods(lister v1lister.PodLister, ns string, oldSelector, newSelector labels.Selector) (onlyInOld, both, onlyInNew sets.String, err error)

func LabelSelectorEqual

func LabelSelectorEqual(oldSelector, newSelector labels.Selector) bool

func LabelsEqual

func LabelsEqual(oldLabels, newLabels map[string]string) bool

func PluginsConfigEqual

func PluginsConfigEqual(oldPlugins, newPlugins []ameshv1alpha1.AmeshPluginConfigPlugin) bool

func VerifyGeneration

func VerifyGeneration(conditions *[]metav1.Condition, newCondition metav1.Condition) bool

VerifyGeneration verify generation to decide whether to update status

Types

type SelectorCache

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

SelectorCache is a cache of selectors to avoid high CPU consumption caused by frequent calls

func NewSelectorCache

NewSelectorCache init SelectorCache for controller.

func (*SelectorCache) Delete

func (sc *SelectorCache) Delete(key string)

Delete can delete selector which exist in SelectorCache.

func (*SelectorCache) Get

func (sc *SelectorCache) Get(key string) (labels.Selector, bool)

Get return selector and existence in SelectorCache by key.

func (*SelectorCache) GetPodPluginConfigs

func (sc *SelectorCache) GetPodPluginConfigs(pod *v1.Pod) (sets.String, error)

func (*SelectorCache) Update

func (sc *SelectorCache) Update(key string, metaSelector *metav1.LabelSelector) (selector labels.Selector, err error)

Update can update or add a selector in SelectorCache while plugin config's selector changed.

Jump to

Keyboard shortcuts

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