Documentation
¶
Index ¶
- func OwnedBy(obj ctrlruntimeclient.Object, agentName string) bool
- func RemoteNameForLocalObject(localObj ctrlruntimeclient.Object) *mcreconcile.Request
- func WithClusterName(ctx context.Context, cluster logicalcluster.Name) context.Context
- func WithEventRecorder(ctx context.Context, recorder record.EventRecorder) context.Context
- func WithWorkspacePath(ctx context.Context, path logicalcluster.Path) context.Context
- type MutatorCreatorFunc
- type ObjectStateStore
- type ResourceSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoteNameForLocalObject ¶
func RemoteNameForLocalObject(localObj ctrlruntimeclient.Object) *mcreconcile.Request
func WithClusterName ¶ added in v0.4.0
func WithEventRecorder ¶ added in v0.4.0
WithEventRecorder adds a event recorder to the context. The recorder must be configured for the kcp side of the synchronization as the agent never issues events on the local cluster.
Types ¶
type MutatorCreatorFunc ¶ added in v0.3.0
type MutatorCreatorFunc func(*syncagentv1alpha1.ResourceMutationSpec) (mutation.Mutator, error)
type ObjectStateStore ¶
type ObjectStateStore interface { Get(ctx context.Context, source syncSide) (*unstructured.Unstructured, error) Put(ctx context.Context, obj *unstructured.Unstructured, clusterName logicalcluster.Name, 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, mutatorCreator MutatorCreatorFunc, stateNamespace string, agentName string, ) (*ResourceSyncer, error)
func (*ResourceSyncer) Process ¶
func (s *ResourceSyncer) Process(ctx context.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. The context must contain a cluster name and event recorder, optionally a workspace path.
Source Files
¶
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 |