sync

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIgnoreNormalizer

func NewIgnoreNormalizer(overrides map[string]ResourceOverride) (diff.Normalizer, error)

NewIgnoreNormalizer creates diff normalizer which removes ignored fields according to given application spec and resource overrides

func NewNoopNormalizer

func NewNoopNormalizer() diff.Normalizer

NewNoopNormalizer returns normalizer that does not apply any resource modifications

func StateDiffs

func StateDiffs(
	configs, lives []*unstructured.Unstructured,
	overrides map[string]ResourceOverride,
	diffOpts []diff.Option) (*diff.DiffResultList, error)

StateDiffs will apply all required normalizations and calculate the diffs between the live and the config/desired states.

Types

type LiveStateCache

type LiveStateCache interface {
	// GetClusterCache returns synced cluster cache
	GetClusterCache() (clustercache.ClusterCache, error)
	// GetManagedLiveObjs returns state of live objects which correspond to target
	// objects with the specified ResourceInfo name and matching namespace.
	GetManagedLiveObjs(name, namespace string, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error)
	// Init must be executed before cache can be used
	Init(numaLogger *logger.NumaLogger) error
	// PopulateResourceInfo is called by the cache to update ResourceInfo struct for a managed resource
	PopulateResourceInfo(un *unstructured.Unstructured, isRoot bool) (interface{}, bool)
}

LiveStateCache is a cluster caching that stores resource references and ownership references. It also stores custom metadata for resources managed by Numaplane. It always ensures the cache is up-to-date before returning the resources.

func NewLiveStateCache

func NewLiveStateCache(
	clusterCacheConfig *rest.Config, customMetrics *metrics.CustomMetrics,
) LiveStateCache

type NoopNormalizer

type NoopNormalizer struct {
}

func (*NoopNormalizer) Normalize

func (n *NoopNormalizer) Normalize(un *unstructured.Unstructured) error

type ObjectUpdatedHandler

type ObjectUpdatedHandler = func(managedByNumaplane map[string]bool, ref v1.ObjectReference)

type OverrideIgnoreDiff

type OverrideIgnoreDiff struct {
	// JSONPointers is a JSON path list following the format defined in RFC4627 (https://datatracker.ietf.org/doc/html/rfc6902#section-3)
	JSONPointers []string
}

OverrideIgnoreDiff contains configurations about how fields should be ignored during diffs between the desired state and live state

type ResourceFilter

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

ResourceFilter filter resources based on allowed Resource Types

func (*ResourceFilter) IsExcludedResource

func (n *ResourceFilter) IsExcludedResource(group, kind, _ string) bool

type ResourceIgnoreDifferences

type ResourceIgnoreDifferences struct {
	Group        string
	Kind         string
	Name         string
	Namespace    string
	JSONPointers []string
}

ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state.

type ResourceInfo

type ResourceInfo struct {
	Name string

	Health *health.HealthStatus
	// contains filtered or unexported fields
}

type ResourceOverride

type ResourceOverride struct {
	IgnoreDifferences OverrideIgnoreDiff
}

ResourceOverride holds configuration to customize resource diffing and health assessment

type ResourceType

type ResourceType struct {
	Group string
	Kind  string
}

Jump to

Keyboard shortcuts

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