v2

package
v0.0.0-...-171a537 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisclaimerAnnotation      = shared.OperatorGroup + shared.Separator + "managed-by-reconciler-disclaimer"
	DisclaimerAnnotationValue = "DO NOT EDIT - This resource is managed by Kyma.\n" +
		"Any modifications are discarded and the resource is reverted to the original state."
	OwnedByFormat = "%s/%s"
)
View Source
const (
	EventRecorderDefault    = "declarative.kyma-project.io/events"
	DefaultInMemoryParseTTL = 24 * time.Hour
)
View Source
const ManifestFilePrefix = "manifest"
View Source
const (
	SyncedOCIRefAnnotation = "sync-oci-ref"
)

Variables

View Source
var (
	ErrManagerInErrorState = errors.New("manager is in error state")

	ErrResourceSyncDiffInSameOCILayer = errors.New("resource syncTarget diff detected but in " +
		"same oci layer, prevent sync resource to be deleted")
)
View Source
var ErrInvalidManifestType = errors.New("invalid object type, expected *v1beta2.Manifest")
View Source
var ErrNotValidClientObject = errors.New("object in resource info is not a valid client object")

Functions

func DisclaimerTransform

func DisclaimerTransform(_ context.Context, _ Object, resources []*unstructured.Unstructured) error

func DockerImageLocalizationTransform

func DockerImageLocalizationTransform(ctx context.Context, obj Object, resources []*unstructured.Unstructured) error

DockerImageLocalizationTransform rewrites Docker images in the provided resources according to the Spec.LocalizedImages field in the Manifest object.

func KymaComponentTransform

func KymaComponentTransform(_ context.Context, obj Object, resources []*unstructured.Unstructured) error

func ManagedByOwnedBy

func ManagedByOwnedBy(_ context.Context, obj Object, resources []*unstructured.Unstructured) error

Types

type ExistsStateCheck

type ExistsStateCheck struct{}

func NewExistsStateCheck

func NewExistsStateCheck() *ExistsStateCheck

func (*ExistsStateCheck) GetState

func (c *ExistsStateCheck) GetState(
	ctx context.Context,
	clnt client.Client,
	resources []*resource.Info,
) (shared.State, error)

type InMemoryManifestCache

type InMemoryManifestCache struct {
	*ttlcache.Cache[string, internal.ManifestResources]

	TTL time.Duration
}

func NewInMemoryManifestCache

func NewInMemoryManifestCache(ttl time.Duration) *InMemoryManifestCache

func (*InMemoryManifestCache) EvictCache

func (c *InMemoryManifestCache) EvictCache(spec *Spec)

func (*InMemoryManifestCache) Parse

type ManagedByLabelRemoval

type ManagedByLabelRemoval interface {
	RemoveManagedByLabel(ctx context.Context,
		manifest *v1beta2.Manifest,
		skrClient client.Client,
	) error
}

type ManifestAPIClient

type ManifestAPIClient interface {
	UpdateManifest(ctx context.Context, manifest *v1beta2.Manifest) error
	PatchStatusIfDiffExist(ctx context.Context, manifest *v1beta2.Manifest,
		previousStatus shared.Status,
	) error
	SsaSpec(ctx context.Context, obj client.Object) error
}

type ManifestCache

type ManifestCache string

type ManifestParser

type ManifestParser interface {
	Parse(spec *Spec) (internal.ManifestResources, error)
	EvictCache(spec *Spec)
}

type Object

type Object interface {
	client.Object
	GetStatus() shared.Status
	SetStatus(status shared.Status)
}

type ObjectTransform

type ObjectTransform = func(context.Context, Object, []*unstructured.Unstructured) error

type Option

type Option interface {
	Apply(options *Options)
}

type Options

type Options struct {
	client.Client
	ManifestCache
	ManifestParser
	record.EventRecorder

	Config               *rest.Config
	CustomStateCheck     StateCheck
	PostRenderTransforms []ObjectTransform
}

func DefaultOptions

func DefaultOptions() *Options

func (*Options) Apply

func (o *Options) Apply(options ...Option) *Options

type OrphanDetection

type OrphanDetection interface {
	DetectOrphanedManifest(ctx context.Context, manifest *v1beta2.Manifest) error
}

type PostRenderTransformOption

type PostRenderTransformOption struct {
	ObjectTransforms []ObjectTransform
}

func WithPostRenderTransform

func WithPostRenderTransform(transforms ...ObjectTransform) PostRenderTransformOption

func (PostRenderTransformOption) Apply

func (o PostRenderTransformOption) Apply(options *Options)

type Reconciler

type Reconciler struct {
	queue.RequeueIntervals
	*Options

	ManifestMetrics        *metrics.ManifestMetrics
	MandatoryModuleMetrics *metrics.MandatoryModulesMetrics
	// contains filtered or unexported fields
}

func NewFromManager

func NewFromManager(mgr manager.Manager, requeueIntervals queue.RequeueIntervals, metrics *metrics.ManifestMetrics,
	mandatoryModulesMetrics *metrics.MandatoryModulesMetrics, manifestAPIClient ManifestAPIClient,
	orphanDetectionClient orphan.DetectionRepository, specResolver SpecResolver, clientCache SKRClientCache,
	skrClient SKRClient,
	options ...Option,
) *Reconciler

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

type ResourceList

type ResourceList []*resource.Info

ResourceList provides convenience methods for comparing collections of Infos. Copy from https://github.com/helm/helm/blob/v3.19.0/pkg/kube/resource.go

func (ResourceList) Difference

func (r ResourceList) Difference(rs ResourceList) ResourceList

Difference will return a new Result with objects not contained in rs.

func (ResourceList) Visit

func (r ResourceList) Visit(fn resource.VisitorFunc) error

Visit implements resource.Visitor.

type SKRClient

type SKRClient interface {
	ResolveClient(ctx context.Context, manifest *v1beta2.Manifest) (*skrclient.SKRClient, error)
}

type SKRClientCache

type SKRClientCache interface {
	GetClient(key string) *skrclient.SKRClient
	AddClient(key string, client *skrclient.SKRClient)
	DeleteClient(key string)
}

type Spec

type Spec struct {
	ManifestName string
	Path         string
	OCIRef       string
}

type SpecResolver

type SpecResolver interface {
	GetSpec(ctx context.Context, manifest *v1beta2.Manifest) (*Spec, error)
}

type StateCheck

type StateCheck interface {
	GetState(ctx context.Context, clnt client.Client, resources []*resource.Info) (shared.State, error)
}

type WithCustomResourceLabels

type WithCustomResourceLabels k8slabels.Set

func (WithCustomResourceLabels) Apply

func (o WithCustomResourceLabels) Apply(options *Options)

type WithCustomStateCheckOption

type WithCustomStateCheckOption struct {
	StateCheck
}

func WithCustomStateCheck

func WithCustomStateCheck(check StateCheck) WithCustomStateCheckOption

func (WithCustomStateCheckOption) Apply

func (o WithCustomStateCheckOption) Apply(options *Options)

type WithManagerOption

type WithManagerOption struct {
	manager.Manager
}

func WithManager

func WithManager(mgr manager.Manager) WithManagerOption

func (WithManagerOption) Apply

func (o WithManagerOption) Apply(options *Options)

type WithManifestCache

type WithManifestCache ManifestCache

func (WithManifestCache) Apply

func (o WithManifestCache) Apply(options *Options)

type WithManifestParserOption

type WithManifestParserOption struct {
	ManifestParser
}

func WithManifestParser

func WithManifestParser(parser ManifestParser) WithManifestParserOption

func (WithManifestParserOption) Apply

func (o WithManifestParserOption) Apply(options *Options)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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