sync

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoteNameForLocalObject

func RemoteNameForLocalObject(localObj ctrlruntimeclient.Object) *reconcile.Request

Types

type Context

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

func NewContext

func NewContext(local, remote context.Context) Context

type ObjectStateStore

type ObjectStateStore interface {
	Get(source syncSide) (*unstructured.Unstructured, error)
	Put(obj *unstructured.Unstructured, clusterName string, subresources []string) error
}

type ResourceSyncer

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

func NewResourceSyncer

func NewResourceSyncer(
	log *zap.SugaredLogger,
	localClient ctrlruntimeclient.Client,
	remoteClient ctrlruntimeclient.Client,
	pubRes *syncagentv1alpha1.PublishedResource,
	localCRD *apiextensionsv1.CustomResourceDefinition,
	remoteAPIGroup string,
	mutator mutation.Mutator,
	stateNamespace string,
) (*ResourceSyncer, error)

func (*ResourceSyncer) Process

func (s *ResourceSyncer) Process(ctx Context, remoteObj *unstructured.Unstructured) (requeue bool, err error)

Process is the primary entrypoint for object synchronization. This function will create/update the local primary object (i.e. the copy of the remote object), sync any local status back to the remote object and then also synchronize all related resources. It also handles object deletion and will clean up the local objects when a remote object is gone. Each of these steps can potentially end the current processing and return (true, nil). In this case, the caller should re-fetch the remote object and call Process() again (most likely in the next reconciliation). Only when (false, nil) is returned is the entire process finished.

Directories

Path Synopsis
apis
dummy/v1alpha1
+groupName=dummy.example.com +versionName=v1alpha1 +kubebuilder:object:generate=true
+groupName=dummy.example.com +versionName=v1alpha1 +kubebuilder:object:generate=true

Jump to

Keyboard shortcuts

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