Documentation ¶
Overview ¶
Package syncer provides synchronization tools for resources in multiple stores.
Index ¶
- Constants
- func AreSpecsEquivalent(obj1, obj2 *unstructured.Unstructured) bool
- func DefaultResourcesEquivalent(obj1, obj2 *unstructured.Unstructured) bool
- func NewSharedInformer(config *ResourceSyncerConfig) (cache.SharedInformer, error)
- func ResourcesNotEquivalent(_, _ *unstructured.Unstructured) bool
- type Interface
- type OnSuccessfulSyncFunc
- type Operation
- type ResourceEquivalenceFunc
- type ResourceSyncerConfig
- type ShouldProcessFunc
- type SyncDirection
- type TransformFunc
Constants ¶
View Source
const ( DirectionLabel = "direction" OperationLabel = "operation" SyncerNameLabel = "syncer_name" )
View Source
const (
OrigNamespaceLabelKey = "submariner-io/originatingNamespace"
)
Variables ¶
This section is empty.
Functions ¶
func AreSpecsEquivalent ¶ added in v0.10.1
func AreSpecsEquivalent(obj1, obj2 *unstructured.Unstructured) bool
func DefaultResourcesEquivalent ¶ added in v0.6.0
func DefaultResourcesEquivalent(obj1, obj2 *unstructured.Unstructured) bool
func NewSharedInformer ¶ added in v0.17.2
func NewSharedInformer(config *ResourceSyncerConfig) (cache.SharedInformer, error)
func ResourcesNotEquivalent ¶ added in v0.6.2
func ResourcesNotEquivalent(_, _ *unstructured.Unstructured) bool
Types ¶
type Interface ¶
type Interface interface { Start(stopCh <-chan struct{}) error AwaitStopped() GetResource(name, namespace string) (runtime.Object, bool, error) RequeueResource(name, namespace string) ListResources() []runtime.Object ListResourcesBySelector(selector labels.Selector) []runtime.Object Reconcile(resourceLister func() []runtime.Object) }
func NewResourceSyncer ¶
func NewResourceSyncer(config *ResourceSyncerConfig) (Interface, error)
func NewResourceSyncerWithSharedInformer ¶ added in v0.17.2
func NewResourceSyncerWithSharedInformer(config *ResourceSyncerConfig, informer cache.SharedInformer) (Interface, error)
type OnSuccessfulSyncFunc ¶ added in v0.6.0
OnSuccessfulSyncFunc is invoked after a successful sync operation.
type ResourceEquivalenceFunc ¶ added in v0.6.0
type ResourceEquivalenceFunc func(obj1, obj2 *unstructured.Unstructured) bool
type ResourceSyncerConfig ¶
type ResourceSyncerConfig struct { // Name of this syncer used for logging. Name string // SourceClient the client used to obtain the resources to sync. SourceClient dynamic.Interface // SourceNamespace the namespace of the resources to sync. SourceNamespace string // SourceLabelSelector optional selector to restrict the resources to sync by their labels. SourceLabelSelector string // SourceFieldSelector optional selector to restrict the resources to sync by their fields. SourceFieldSelector string // LocalClusterID the cluster ID of the source client. This is used in conjunction with Direction to avoid // loops when syncing the same resources between the local and remote sources. LocalClusterID string // Direction specifies how resources are synced. It is assumed that resources emanating from a remote source have // the cluster ID label specified by federate.ClusterIDLabelKey set appropriately. If set to LocalToRemote, only // resources that do not have a cluster ID label are synced. This avoids re-syncing non-local resources. If set to // RemoteToLocal, resources whose cluster ID label matches LocalClusterID are not synced. This avoids syncing // local resources from the remote source. Direction SyncDirection // RestMapper used to obtain GroupVersionResources. RestMapper meta.RESTMapper // Federator used to perform the syncing. Federator federate.Federator // ResourceType the type of the resources to sync. ResourceType runtime.Object // Transform function used to transform resources prior to syncing. Transform TransformFunc // OnSuccessfulSync function invoked after a successful sync operation. If true is returned, the resource is re-queued // to be retried later. OnSuccessfulSync OnSuccessfulSyncFunc // ResourcesEquivalent function to compare two resources for equivalence. This is invoked on an update notification // to compare the old and new resources. If true is returned, the update is ignored, otherwise the update is processed. // By default all updates are processed. ResourcesEquivalent ResourceEquivalenceFunc // ShouldProcess function invoked to determine if a resource should be processed. ShouldProcess ShouldProcessFunc // WaitForCacheSync if true, waits for the informer cache to sync on Start. Default is true. WaitForCacheSync *bool // Scheme used to convert resource objects. By default the global k8s Scheme is used. Scheme *runtime.Scheme // ResyncPeriod if non-zero, the period at which resources will be re-synced regardless if anything changed. Default is 0. ResyncPeriod time.Duration // SyncCounterOpts if specified, used to create a gauge to record counter metrics. // Alternatively the gauge can be created directly and passed via the SyncCounter field, // in which case SyncCounterOpts is ignored. SyncCounterOpts *prometheus.GaugeOpts // SyncCounter if specified, used to record counter metrics. SyncCounter *prometheus.GaugeVec // NamespaceInformer if specified, used to retry resources that initially failed due to missing namespace. NamespaceInformer cache.SharedInformer }
type ShouldProcessFunc ¶ added in v0.9.0
type ShouldProcessFunc func(obj *unstructured.Unstructured, op Operation) bool
type SyncDirection ¶
type SyncDirection int
const ( None SyncDirection = iota // Resources are synced from a local source to a remote source. LocalToRemote // Resources are synced from a remote source to a local source. RemoteToLocal )
func (SyncDirection) String ¶ added in v0.9.0
func (d SyncDirection) String() string
type TransformFunc ¶
TransformFunc is invoked prior to syncing to transform the resource or evaluate if it should be synced. If nil is returned, the resource is not synced and, if the second return value is true, the resource is re-queued to be retried later.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package broker provides bi-directional synchronization of resources between a local source and a central broker.
|
Package broker provides bi-directional synchronization of resources between a local source and a central broker. |
Package test provides test utilities for the Syncer.
|
Package test provides test utilities for the Syncer. |
Click to show internal directories.
Click to hide internal directories.