Skip to content

Commit

Permalink
Merge pull request #1512 from FabianKramm/main
Browse files Browse the repository at this point in the history
refactor: rename syncdown
  • Loading branch information
FabianKramm authored Feb 1, 2024
2 parents 665047e + b3d7fff commit e3abc34
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 42 deletions.
8 changes: 4 additions & 4 deletions docs/pages/advanced-topics/plugins-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ You can get more familiar with the interfaces mentioned above by reading the SDK
:::


The `SyncDown` function mentioned above is called by the vCluster SDK when a given resource, e.g. a ConfigMap, is created in the vCluster, but it doesn't exist in the host cluster yet. To create a ConfigMap in the host cluster we will call the `SyncDownCreate` function with the output of the `translate` function as a third parameter. This demonstrates a typical pattern used in the vCluster syncer implementations.
The `SyncDown` function mentioned above is called by the vCluster SDK when a given resource, e.g. a ConfigMap, is created in the vCluster, but it doesn't exist in the host cluster yet. To create a ConfigMap in the host cluster we will call the `SyncToHostCreate` function with the output of the `translate` function as a third parameter. This demonstrates a typical pattern used in the vCluster syncer implementations.

```
func (s *configMapSyncer) SyncToHost(ctx *syncercontext.syncercontext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(vObj.(*corev1.ConfigMap)))
return s.SyncToHostCreate(ctx, vObj, s.translate(vObj.(*corev1.ConfigMap)))
}
func (s *configMapSyncer) translate(vObj client.Object) *corev1.ConfigMap {
Expand All @@ -96,12 +96,12 @@ func (s *configMapSyncer) translate(vObj client.Object) *corev1.ConfigMap {
The `TranslateMetadata` function used above produces a ConfigMap object that will be created in the host cluster. It is a deep copy of the ConfigMap from vCluster, but with certain metadata modifications - the name and labels are transformed, some vCluster labels and annotations are added, and many metadata fields are stripped (uid, resourceVersion, etc.).


Next, we need to implement code that will handle the updates of the ConfigMap. When a ConfigMap in vCluster or host cluster is updated, the vCluster SDK will call the `Sync` function of the syncer. Current ConfigMap resources from the host cluster and from vCluster are passed as the second and third parameters respectively. In the implementation below, you can see another pattern used by the vCluster syncers. The `translateUpdate` function will return nil when no change to the ConfigMap in the host cluster is needed, and the `SyncDownUpdate` function will not do an unnecessary update API call in such case.
Next, we need to implement code that will handle the updates of the ConfigMap. When a ConfigMap in vCluster or host cluster is updated, the vCluster SDK will call the `Sync` function of the syncer. Current ConfigMap resources from the host cluster and from vCluster are passed as the second and third parameters respectively. In the implementation below, you can see another pattern used by the vCluster syncers. The `translateUpdate` function will return nil when no change to the ConfigMap in the host cluster is needed, and the `SyncToHostUpdate` function will not do an unnecessary update API call in such case.

```
func (s *configMapSyncer) Sync(ctx *syncercontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownUpdate(ctx, vObj, s.translateUpdate(pObj.(*corev1.ConfigMap), vObj.(*corev1.ConfigMap)))
return s.SyncToHostUpdate(ctx, vObj, s.translateUpdate(pObj.(*corev1.ConfigMap), vObj.(*corev1.ConfigMap)))
}
func (s *configMapSyncer) translateUpdate(pObj, vObj *corev1.ConfigMap) *corev1.ConfigMap {
Expand Down
10 changes: 5 additions & 5 deletions docs/pages/plugins/tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,26 @@ type carSyncer struct {

After an import block, we see the `NewCarSyncer` function, which is being called from the `main.go`. It returns a new instance of the `carSyncer` struct, which is defined by a single nested anonymous struct of type `NamespacedTranslator`. The `NamespacedTranslator` implements many functions of the [`Syncer`](https://pkg.go.dev/github.com/loft-sh/vcluster-sdk/syncer#Syncer) interface for us, and we will implement the remaining ones - `SyncDown` and `Sync`.

The `SyncDown` function mentioned above is called by the vCluster SDK when a given resource, e.g. a Car, is created in the vCluster, but it doesn't exist in the host cluster yet. To create a ConfigMap in the host cluster we will call the `SyncDownCreate` function with the output of the `translate` function as third parameter. This demonstrates a typical pattern used in the vCluster syncer implementations.
The `SyncDown` function mentioned above is called by the vCluster SDK when a given resource, e.g. a Car, is created in the vCluster, but it doesn't exist in the host cluster yet. To create a ConfigMap in the host cluster we will call the `SyncToHostCreate` function with the output of the `translate` function as third parameter. This demonstrates a typical pattern used in the vCluster syncer implementations.

```
func (s *carSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.TranslateMetadata(ctx.Context, vObj).(*examplev1.Car))
return s.SyncToHostCreate(ctx, vObj, s.TranslateMetadata(ctx.Context, vObj).(*examplev1.Car))
}
func (s *carSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownUpdate(ctx, vObj, s.translateUpdate(ctx.Context, pObj.(*examplev1.Car), vObj.(*examplev1.Car)))
return s.SyncToHostUpdate(ctx, vObj, s.translateUpdate(ctx.Context, pObj.(*examplev1.Car), vObj.(*examplev1.Car)))
}
```
The `TranslateMetadata` function used above produces a Car object that will be created in the host cluster. It is a deep copy of the Car from vCluster, but with certain metadata modifications - the name and labels are transformed, some vCluster labels and annotations are added, many metadata fields are stripped (uid, resourceVersion, etc.).


Next, we need to implement code that will handle the updates of the Car. When a CAr in vCluster or host cluster is updated, the vCluster SDK will call the `Sync` function of the syncer. Current Car resource from the host cluster and from vCluster are passed as the second and third parameters respectively. In the implementation below, you can see another pattern used by the vCluster syncers. The `translateUpdate` function will return nil when no change to the Car in the host cluster is needed, and the `SyncDownUpdate` function will not do an unnecessary update API call in such case.
Next, we need to implement code that will handle the updates of the Car. When a CAr in vCluster or host cluster is updated, the vCluster SDK will call the `Sync` function of the syncer. Current Car resource from the host cluster and from vCluster are passed as the second and third parameters respectively. In the implementation below, you can see another pattern used by the vCluster syncers. The `translateUpdate` function will return nil when no change to the Car in the host cluster is needed, and the `SyncToHostUpdate` function will not do an unnecessary update API call in such case.

```
func (s *carSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownUpdate(ctx, vObj, s.translateUpdate(ctx.Context, pObj.(*examplev1.Car), vObj.(*examplev1.Car)))
return s.SyncToHostUpdate(ctx, vObj, s.translateUpdate(ctx.Context, pObj.(*examplev1.Car), vObj.(*examplev1.Car)))
}
func (s *carSyncer) translateUpdate(ctx context.Context, pObj, vObj *examplev1.Car) *examplev1.Car {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/configmaps/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *configMapSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.O
return ctrl.Result{}, nil
}

return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.ConfigMap)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.ConfigMap)))
}

func (s *configMapSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -99,7 +99,7 @@ func (s *configMapSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object,
}

// did the configmap change?
return s.SyncDownUpdate(ctx, vObj, newConfigMap)
return s.SyncToHostUpdate(ctx, vObj, newConfigMap)
}

func (s *configMapSyncer) isConfigMapUsed(ctx *synccontext.SyncContext, vObj runtime.Object) (bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/endpoints/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type endpointsSyncer struct {
}

func (s *endpointsSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj))
}

func (s *endpointsSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -34,7 +34,7 @@ func (s *endpointsSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object,
translator.PrintChanges(pObj, newEndpoints, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newEndpoints)
return s.SyncToHostUpdate(ctx, vObj, newEndpoints)
}

var _ syncer.Starter = &endpointsSyncer{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/ingresses/legacy/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ingressSyncer struct {
var _ syncertypes.Syncer = &ingressSyncer{}

func (s *ingressSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1beta1.Ingress)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1beta1.Ingress)))
}

func (s *ingressSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -63,7 +63,7 @@ func (s *ingressSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, v
translator.PrintChanges(pObj, newIngress, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newIngress)
return s.SyncToHostUpdate(ctx, vObj, newIngress)
}

func SecretNamesFromIngress(ingress *networkingv1beta1.Ingress) []string {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/ingresses/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ingressSyncer struct {
var _ syncertypes.Syncer = &ingressSyncer{}

func (s *ingressSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1.Ingress)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1.Ingress)))
}

func (s *ingressSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -65,7 +65,7 @@ func (s *ingressSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, v
translator.PrintChanges(pObj, newIngress, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newIngress)
return s.SyncToHostUpdate(ctx, vObj, newIngress)
}

func SecretNamesFromIngress(ingress *networkingv1.Ingress) []string {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/networkpolicies/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type networkPolicySyncer struct {
var _ syncertypes.Syncer = &networkPolicySyncer{}

func (s *networkPolicySyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1.NetworkPolicy)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*networkingv1.NetworkPolicy)))
}

func (s *networkPolicySyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -32,5 +32,5 @@ func (s *networkPolicySyncer) Sync(ctx *synccontext.SyncContext, pObj client.Obj
translator.PrintChanges(pObj, newNetworkPolicy, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newNetworkPolicy)
return s.SyncToHostUpdate(ctx, vObj, newNetworkPolicy)
}
4 changes: 2 additions & 2 deletions pkg/controllers/resources/persistentvolumeclaims/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *persistentVolumeClaimSyncer) SyncToHost(ctx *synccontext.SyncContext, v
return ctrl.Result{}, err
}

return s.SyncDownCreate(ctx, vObj, newPvc)
return s.SyncToHostCreate(ctx, vObj, newPvc)
}

func (s *persistentVolumeClaimSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -163,7 +163,7 @@ func (s *persistentVolumeClaimSyncer) Sync(ctx *synccontext.SyncContext, pObj cl
translator.PrintChanges(pPvc, newPvc, ctx.Log)
}

return s.SyncDownUpdate(ctx, vPvc, newPvc)
return s.SyncToHostUpdate(ctx, vPvc, newPvc)
}

func (s *persistentVolumeClaimSyncer) ensurePersistentVolume(ctx *synccontext.SyncContext, pObj *corev1.PersistentVolumeClaim, vObj *corev1.PersistentVolumeClaim, log loghelper.Logger) (bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/poddisruptionbudgets/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type pdbSyncer struct {
}

func (pdb *pdbSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return pdb.SyncDownCreate(ctx, vObj, pdb.translate(ctx.Context, vObj.(*policyv1.PodDisruptionBudget)))
return pdb.SyncToHostCreate(ctx, vObj, pdb.translate(ctx.Context, vObj.(*policyv1.PodDisruptionBudget)))
}

func (pdb *pdbSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -31,5 +31,5 @@ func (pdb *pdbSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vOb
translator.PrintChanges(pObj, newPDB, ctx.Log)
}

return pdb.SyncDownUpdate(ctx, vObj, newPDB)
return pdb.SyncToHostUpdate(ctx, vObj, newPDB)
}
4 changes: 2 additions & 2 deletions pkg/controllers/resources/pods/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (s *podSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object)
return ctrl.Result{}, nil
}

return s.SyncDownCreate(ctx, vPod, pPod)
return s.SyncToHostCreate(ctx, vPod, pPod)
}

func (s *podSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -348,7 +348,7 @@ func (s *podSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj
translator.PrintChanges(pPod, updatedPod, ctx.Log)
}

return s.SyncDownUpdate(ctx, vPod, updatedPod)
return s.SyncToHostUpdate(ctx, vPod, updatedPod)
}

func syncEphemeralContainers(vPod *corev1.Pod, pPod *corev1.Pod) bool {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/secrets/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (s *secretSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Obje
return ctrl.Result{}, nil
}

return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.Secret)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.Secret)))
}

func (s *secretSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -132,7 +132,7 @@ func (s *secretSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vO
translator.PrintChanges(pObj, newSecret, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newSecret)
return s.SyncToHostUpdate(ctx, vObj, newSecret)
}

func (s *secretSyncer) isSecretUsed(ctx *synccontext.SyncContext, vObj runtime.Object) (bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/resources/serviceaccounts/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type serviceAccountSyncer struct {
}

func (s *serviceAccountSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.ServiceAccount)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.ServiceAccount)))
}

func (s *serviceAccountSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand All @@ -31,5 +31,5 @@ func (s *serviceAccountSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Ob
translator.PrintChanges(pObj, newServiceAccount, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newServiceAccount)
return s.SyncToHostUpdate(ctx, vObj, newServiceAccount)
}
4 changes: 2 additions & 2 deletions pkg/controllers/resources/services/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *serviceSyncer) WithOptions() *syncertypes.Options {
}

func (s *serviceSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.Service)))
return s.SyncToHostCreate(ctx, vObj, s.translate(ctx.Context, vObj.(*corev1.Service)))
}

func (s *serviceSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -103,7 +103,7 @@ func (s *serviceSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, v
translator.PrintChanges(pService, newService, ctx.Log)
}

return s.SyncDownUpdate(ctx, vObj, newService)
return s.SyncToHostUpdate(ctx, vObj, newService)
}

func isSwitchingFromExternalName(pService *corev1.Service, vService *corev1.Service) bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *volumeSnapshotSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj cli
return ctrl.Result{}, err
}

return s.SyncDownCreate(ctx, vObj, pObj)
return s.SyncToHostCreate(ctx, vObj, pObj)
}

func (s *volumeSnapshotSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
Expand Down Expand Up @@ -153,5 +153,5 @@ func (s *volumeSnapshotSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Ob
translator.PrintChanges(pVS, updated, ctx.Log)
}

return s.SyncDownUpdate(ctx, vVS, updated)
return s.SyncToHostUpdate(ctx, vVS, updated)
}
4 changes: 2 additions & 2 deletions pkg/controllers/syncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func (s *mockSyncer) naiveTranslateUpdate(ctx *synccontext.SyncContext, vObj cli

// SyncDown is called when a virtual object was created and needs to be synced down to the physical cluster
func (s *mockSyncer) SyncToHost(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownCreate(ctx, vObj, s.naiveTranslateCreate(ctx, vObj))
return s.SyncToHostCreate(ctx, vObj, s.naiveTranslateCreate(ctx, vObj))
}

// Sync is called to sync a virtual object with a physical object
func (s *mockSyncer) Sync(ctx *synccontext.SyncContext, pObj client.Object, vObj client.Object) (ctrl.Result, error) {
return s.SyncDownUpdate(ctx, vObj, s.naiveTranslateUpdate(ctx, vObj, pObj))
return s.SyncToHostUpdate(ctx, vObj, s.naiveTranslateUpdate(ctx, vObj, pObj))
}

var _ syncertypes.Syncer = &mockSyncer{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/syncer/translator/namespaced_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (n *namespacedTranslator) RegisterIndices(ctx *context.RegisterContext) err
})
}

func (n *namespacedTranslator) SyncDownCreate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) {
func (n *namespacedTranslator) SyncToHostCreate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) {
ctx.Log.Infof("create physical %s %s/%s", n.name, pObj.GetNamespace(), pObj.GetName())
err := ctx.PhysicalClient.Create(ctx.Context, pObj)
if err != nil {
Expand All @@ -82,7 +82,7 @@ func (n *namespacedTranslator) SyncDownCreate(ctx *context.SyncContext, vObj, pO
return ctrl.Result{}, nil
}

func (n *namespacedTranslator) SyncDownUpdate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) {
func (n *namespacedTranslator) SyncToHostUpdate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) {
// this is needed because of interface nil check
if !(pObj == nil || (reflect.ValueOf(pObj).Kind() == reflect.Ptr && reflect.ValueOf(pObj).IsNil())) {
ctx.Log.Infof("updating physical %s/%s, because virtual %s have changed", pObj.GetNamespace(), pObj.GetName(), n.name)
Expand Down
10 changes: 5 additions & 5 deletions pkg/controllers/syncer/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ type NamespacedTranslator interface {
// RegisterIndices registers the default indices for the syncer
RegisterIndices(ctx *syncercontext.RegisterContext) error

// SyncDownCreate creates the given pObj in the target namespace
SyncDownCreate(ctx *syncercontext.SyncContext, vObj, pObj client.Object) (ctrl.Result, error)
// SyncToHostCreate creates the given pObj in the target namespace
SyncToHostCreate(ctx *syncercontext.SyncContext, vObj, pObj client.Object) (ctrl.Result, error)

// SyncDownUpdate updates the given pObj (if not nil) in the target namespace
SyncDownUpdate(ctx *syncercontext.SyncContext, vObj, pObj client.Object) (ctrl.Result, error)
// SyncToHostUpdate updates the given pObj (if not nil) in the target namespace
SyncToHostUpdate(ctx *syncercontext.SyncContext, vObj, pObj client.Object) (ctrl.Result, error)

// Function to override default VirtualToHost name translation
// SetNameTranslator is a function to override default VirtualToHost name translation
SetNameTranslator(nameTranslator translate.PhysicalNamespacedNameTranslator)
}

0 comments on commit e3abc34

Please sign in to comment.