dispatch

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	//nolint:gosec
	DefaultAPITokenMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
)
View Source
const (
	RetainTerminatingObjectFinalizer = common.DefaultPrefix + "retain-terminating-object"
)

Variables

This section is empty.

Functions

func RetainOrMergeClusterFields

func RetainOrMergeClusterFields(
	targetGvk schema.GroupVersionKind,
	desiredObj, clusterObj *unstructured.Unstructured,
) error

RetainOrMergeClusterFields updates the desired object with values retained from the cluster object.

Types

type CheckUnmanagedDispatcher

type CheckUnmanagedDispatcher interface {
	OperationDispatcher

	CheckRemovedOrUnlabeled(ctx context.Context, clusterName string)
}

func NewCheckUnmanagedDispatcher

func NewCheckUnmanagedDispatcher(
	clientAccessor clientAccessorFunc,
	targetGVR schema.GroupVersionResource,
	targetName common.QualifiedName,
) CheckUnmanagedDispatcher

type FederatedResourceForDispatch

type FederatedResourceForDispatch interface {
	// TargetName returns the name of the resource's target object.
	TargetName() common.QualifiedName
	// TargetGVK returns the resource's target group/version/kind.
	TargetGVK() schema.GroupVersionKind
	// TargetGVR returns the resource's target group/version/resource.
	TargetGVR() schema.GroupVersionResource
	// TypeConfig returns the FederatedTypeConfig for the resource's target type.
	TypeConfig() *fedcorev1a1.FederatedTypeConfig
	// Object returns the underlying FederatedObject or ClusterFederatedObject
	// as a GenericFederatedObject.
	Object() fedcorev1a1.GenericFederatedObject
	// VersionForCluster returns the resource's last propagated version for the given cluster.
	VersionForCluster(clusterName string) (string, error)
	// ObjectForCluster returns the resource's desired object for the given cluster.
	ObjectForCluster(clusterName string) (*unstructured.Unstructured, error)
	// ApplyOverrides applies cluster-specific overrides to the given object.
	ApplyOverrides(obj *unstructured.Unstructured, clusterName string) error
	// RecordError records an error for the resource.
	RecordError(errorCode string, err error)
	// RecordEvent records an event for the resource.
	RecordEvent(reason, messageFmt string, args ...interface{})
}

FederatedResourceForDispatch is the subset of the FederatedResource interface required for dispatching operations to managed resources.

type ManagedDispatcher

type ManagedDispatcher interface {
	UnmanagedDispatcher

	Create(ctx context.Context, clusterName string)
	Update(ctx context.Context, clusterName string, clusterObj *unstructured.Unstructured)
	VersionMap() map[string]string
	CollectedStatus() status.CollectedPropagationStatus
	RecordClusterError(propStatus fedcorev1a1.PropagationStatusType, clusterName string, err error)
	RecordStatus(clusterName string, propStatus fedcorev1a1.PropagationStatusType)
}

ManagedDispatcher dispatches operations to member clusters for resources managed by a federated resource.

func NewManagedDispatcher

func NewManagedDispatcher(
	clientAccessor clientAccessorFunc,
	fedResource FederatedResourceForDispatch,
	skipAdoptingResources bool,
	metrics stats.Metrics,
) ManagedDispatcher

type OperationDispatcher

type OperationDispatcher interface {
	// Wait returns true for ok if all operations completed
	// successfully and false if only some operations completed
	// successfully.  An error is returned on timeout.
	Wait() (ok bool, timeoutErr error)
}

OperationDispatcher provides an interface to wait for operations dispatched to member clusters.

type UnmanagedDispatcher

type UnmanagedDispatcher interface {
	OperationDispatcher

	Delete(ctx context.Context, clusterName string, clusterObj *unstructured.Unstructured)
	RemoveManagedLabel(ctx context.Context, clusterName string, clusterObj *unstructured.Unstructured)
}

UnmanagedDispatcher dispatches operations to member clusters for resources that are no longer managed by a federated resource.

func NewUnmanagedDispatcher

func NewUnmanagedDispatcher(
	clientAccessor clientAccessorFunc,
	targetGVR schema.GroupVersionResource,
	targetName common.QualifiedName,
	metrics stats.Metrics,
) UnmanagedDispatcher

Jump to

Keyboard shortcuts

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