Documentation ¶
Index ¶
Constants ¶
const ( EventReasonWaitForCascadingDelete = "WaitForCascadingDelete" EventReasonWaitForCascadingDeleteError = "WaitForCascadingDeleteError" )
const ( // If this finalizer is present on a federated resource, the sync // controller will have the opportunity to perform pre-deletion operations // (like deleting managed resources from member clusters). FinalizerSyncController = common.DefaultPrefix + "sync-controller" // If this finalizer is present on a cluster, the sync // controller will have the opportunity to perform per-deletion operations // (like deleting managed resources from member clusters). FinalizerCascadingDelete = common.DefaultPrefix + "cascading-delete" )
const (
SyncControllerName = "sync-controller"
)
Variables ¶
This section is empty.
Functions ¶
func ApplyJSONPatch ¶
func ApplyJSONPatch(obj *unstructured.Unstructured, overrides fedcorev1a1.OverridePatches) error
ApplyJSONPatch applies the override on to the given unstructured object.
Types ¶
type FederatedResource ¶
type FederatedResource interface { dispatch.FederatedResourceForDispatch version.VersionedResource // FederatedName returns the name of the underlying FederatedObject or ClusterFederatedObject. FederatedName() common.QualifiedName // UpdateVersions updates the recorded versions for the given clusters. UpdateVersions(selectedClusters []string, versionMap map[string]string) error // DeleteVersions deletes the recorded versions. DeleteVersions() // ComputePlacement computes the placement of the resource in the given clusters. ComputePlacement(clusters []*fedcorev1a1.FederatedCluster) sets.Set[string] // SetObject sets the underlying FederatedObject or ClusterFederatedObject. SetObject(obj fedcorev1a1.GenericFederatedObject) }
FederatedResource is a wrapper for FederatedObjects and ClusterFederatedObjects that provides necessary abstractions for the Sync controller to propagate them to selected member clusters.
type FederatedResourceAccessor ¶
type FederatedResourceAccessor interface { Run(context.Context) HasSynced() bool FederatedResource( qualifiedName common.QualifiedName, ) (federatedResource FederatedResource, err error) VisitFederatedResources(visitFunc func(fedcorev1a1.GenericFederatedObject)) }
FederatedResourceAccessor provides a way to retrieve and visit FederatedResource representations of FederatedObject/ClusterFederatedObject in the apiserver.
func NewFederatedResourceAccessor ¶
func NewFederatedResourceAccessor( logger klog.Logger, fedSystemNamespace, targetNamespace string, client fedcorev1a1client.CoreV1alpha1Interface, fedObjectInformer fedcorev1a1informers.FederatedObjectInformer, clusterFedObjectInformer fedcorev1a1informers.ClusterFederatedObjectInformer, ftcManager informermanager.FederatedTypeConfigManager, enqueue func(common.QualifiedName), eventRecorder record.EventRecorder, ) FederatedResourceAccessor
type SyncController ¶
type SyncController struct {
// contains filtered or unexported fields
}
SyncController synchronizes the state of federated resources in the host cluster with resources in member clusters.
func NewSyncController ¶
func NewSyncController( kubeClient kubernetes.Interface, fedClient fedclient.Interface, fedObjectInformer fedcorev1a1informers.FederatedObjectInformer, clusterFedObjectInformer fedcorev1a1informers.ClusterFederatedObjectInformer, ftcManager informermanager.FederatedTypeConfigManager, fedInformerManager informermanager.FederatedInformerManager, fedSystemNamespace, targetNamespace string, clusterAvailableDelay, clusterUnavailableDelay, memberObjectEnqueueDelay time.Duration, logger klog.Logger, syncWorkerCount int, cascadingDeletionWorkerCount int, metrics stats.Metrics, ) (*SyncController, error)
NewSyncController returns a new sync controller for the configuration
func (*SyncController) HasSynced ¶
func (s *SyncController) HasSynced() bool
Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet synced with the corresponding api server.
func (*SyncController) IsControllerReady ¶
func (s *SyncController) IsControllerReady() bool
func (*SyncController) Run ¶
func (s *SyncController) Run(ctx context.Context)