streamline

package
v0.6.75 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGlobalStore

func InitGlobalStore(s store.Store)

func LookupObjectMeta added in v0.6.67

func LookupObjectMeta(group, version, kind, namespace, name string) (map[string]any, error)

LookupObjectMeta returns cached Kubernetes object metadata from the process-wide store. It returns nil when the store is not initialized or the object is not cached.

func ResetGlobalStore

func ResetGlobalStore()

Types

type EventSubscriber

type EventSubscriber func(event watch.Event)

type GlobalStore

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

func GetGlobalStore

func GetGlobalStore() *GlobalStore

func (*GlobalStore) CommitTransientSHA

func (in *GlobalStore) CommitTransientSHA(obj unstructured.Unstructured) error

func (*GlobalStore) DeleteComponent

func (in *GlobalStore) DeleteComponent(key smcommon.StoreKey) error

func (*GlobalStore) Expire

func (in *GlobalStore) Expire(serviceID string) error

func (*GlobalStore) ExpireSHA

func (in *GlobalStore) ExpireSHA(obj unstructured.Unstructured) error

func (*GlobalStore) GetComponent

func (in *GlobalStore) GetComponent(obj unstructured.Unstructured) (result *smcommon.Component, err error)

func (*GlobalStore) GetResourceHealth

func (in *GlobalStore) GetResourceHealth(resources []unstructured.Unstructured) (hasPendingResources, hasFailedResources bool, err error)

func (*GlobalStore) ObjectMeta added in v0.6.67

func (in *GlobalStore) ObjectMeta(group, version, kind, namespace, name string) (map[string]any, error)

ObjectMeta returns uid, name, namespace, and labels for a cached applied object. Cluster-scoped objects use an empty namespace. A cache miss returns nil, nil.

func (*GlobalStore) SaveHookComponentWithManifestSHA

func (in *GlobalStore) SaveHookComponentWithManifestSHA(manifest, appliedResource unstructured.Unstructured) error

func (*GlobalStore) SetServiceChildren

func (in *GlobalStore) SetServiceChildren(serviceID, parentUID string, keys []smcommon.StoreKey) (int, error)

func (*GlobalStore) SyncAppliedResource

func (in *GlobalStore) SyncAppliedResource(obj unstructured.Unstructured) error

func (*GlobalStore) UpdateComponentSHA

func (in *GlobalStore) UpdateComponentSHA(obj unstructured.Unstructured, shaType store.SHAType) error

type NamespaceCache

type NamespaceCache interface {
	// HandleNamespaceEvent handles namespace events to keep the namespace cache in sync with the cluster state.
	HandleNamespaceEvent(e watch.Event)

	// EnsureNamespace ensures that the namespace exists with the desired metadata.
	// It can be a no-op based on the provided sync config.
	EnsureNamespace(ctx context.Context, namespace string, syncConfig *console.ServiceDeploymentForAgent_SyncConfig) error

	// DeleteNamespace deletes the namespace.
	// It can be a no-op based on the provided sync config.
	DeleteNamespace(ctx context.Context, namespace string, syncConfig *console.ServiceDeploymentForAgent_SyncConfig) error
}

func NewNamespaceCache

func NewNamespaceCache(client kubernetes.Interface) NamespaceCache

type Option

type Option func(*Supervisor)

func WithCacheSyncTimeout

func WithCacheSyncTimeout(d time.Duration) Option

func WithEventSubscribers

func WithEventSubscribers(gvr schema.GroupVersionResource, subscriber []EventSubscriber) Option

func WithMaxNotFoundRetries

func WithMaxNotFoundRetries(n int) Option

func WithMaxRestartBackoff added in v0.6.72

func WithMaxRestartBackoff(d time.Duration) Option

WithMaxRestartBackoff caps the delay between restarts of a synchronizer that fails to start. A resource that keeps failing until its next restart waits for the cap no longer holds back WaitUntilSynced, it is still retried.

func WithRestartDelay

func WithRestartDelay(d time.Duration) Option

func WithRestartJitter added in v0.6.72

func WithRestartJitter(d time.Duration) Option

WithRestartJitter sets how far a restart is spread out at most, so resources that fail together do not retry together.

func WithSynchronizerResyncInterval

func WithSynchronizerResyncInterval(d time.Duration) Option

type StatusSynchronizer

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

func NewStatusSynchronizer

func NewStatusSynchronizer(client client.Client, cacheTTL time.Duration) StatusSynchronizer

NewStatusSynchronizer creates a new StatusSynchronizer with rate limiting set to 10 calls per second.

func NewStatusSynchronizerWithCacheTTLFunc added in v0.6.58

func NewStatusSynchronizerWithCacheTTLFunc(client client.Client, cacheTTL func() time.Duration) StatusSynchronizer

func (*StatusSynchronizer) SHACache added in v0.6.59

func (in *StatusSynchronizer) SHACache() *cache.SimpleCache[string]

func (*StatusSynchronizer) UpdateServiceComponents

func (in *StatusSynchronizer) UpdateServiceComponents(serviceId string, components []*console.ComponentAttributes) error

type Supervisor

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

func NewSupervisor

func NewSupervisor(client dynamic.Interface, store store.Store, statusSynchronizer StatusSynchronizer,
	discoveryCache discoverycache.Cache, svcCache cache.Store[console.ServiceDeploymentForAgent], options ...Option) *Supervisor

func (*Supervisor) MaybeRegister

func (in *Supervisor) MaybeRegister(gvr schema.GroupVersionResource)

func (*Supervisor) Register

func (in *Supervisor) Register(gvr schema.GroupVersionResource)

func (*Supervisor) Run

func (in *Supervisor) Run(ctx context.Context)

func (*Supervisor) Stop

func (in *Supervisor) Stop()

func (*Supervisor) Unregister

func (in *Supervisor) Unregister(gvr schema.GroupVersionResource)

func (*Supervisor) WaitForCacheSync

func (in *Supervisor) WaitForCacheSync(ctx context.Context) error

func (*Supervisor) WaitUntilSynced added in v0.6.72

func (in *Supervisor) WaitUntilSynced(ctx context.Context) error

WaitUntilSynced blocks until every synchronizer has loaded its resources into the store, or has been failing for so long that it is no longer waited for, and returns early only when the context is done. Unlike WaitForCacheSync it has no timeout, as a consumer that reports on the whole cluster has nothing correct to report from a partially loaded store.

type Synchronizer

type Synchronizer interface {
	Start(ctx context.Context) error
	Stop()
	Started() bool
}

func NewSynchronizer

func NewSynchronizer(client dynamic.Interface, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, store store.Store, resyncInterval time.Duration, componentQueue workqueue.TypedRateLimitingInterface[string], subscribers []EventSubscriber) Synchronizer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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