Documentation ¶
Overview ¶
Package broker provides bi-directional synchronization of resources between a local source and a central broker.
Index ¶
- func EnvironmentVariable(setting string) string
- func NewFederator(dynClient dynamic.Interface, restMapper meta.RESTMapper, ...) federate.Federator
- func SecretPath(secretName string) string
- type ResourceConfig
- type Syncer
- func (s *Syncer) GetBrokerClient() dynamic.Interface
- func (s *Syncer) GetBrokerFederator() federate.Federator
- func (s *Syncer) GetBrokerNamespace() string
- func (s *Syncer) GetLocalClient() dynamic.Interface
- func (s *Syncer) GetLocalFederator() federate.Federator
- func (s *Syncer) GetLocalResource(name, namespace string, ofType runtime.Object) (runtime.Object, bool, error)
- func (s *Syncer) ListLocalResources(ofType runtime.Object) []runtime.Object
- func (s *Syncer) ListLocalResourcesBySelector(ofType runtime.Object, selector labels.Selector) []runtime.Object
- func (s *Syncer) Start(stopCh <-chan struct{}) error
- type SyncerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvironmentVariable ¶ added in v0.12.0
func NewFederator ¶
func SecretPath ¶ added in v0.12.0
Types ¶
type ResourceConfig ¶
type ResourceConfig struct { // SourceNamespace the namespace in the local source from which to retrieve the local resources to sync. LocalSourceNamespace string // LocalSourceLabelSelector optional selector to restrict the local resources to sync by their labels. LocalSourceLabelSelector string // LocalSourceFieldSelector optional selector to restrict the local resources to sync by their fields. LocalSourceFieldSelector string // LocalResourceType the type of the local resources to sync to the broker. LocalResourceType runtime.Object // TransformLocalToBroker function used to transform a local resource to the equivalent broker resource. TransformLocalToBroker syncer.TransformFunc // OnSuccessfulSyncToBroker function invoked after a successful sync operation to the broker. OnSuccessfulSyncToBroker syncer.OnSuccessfulSyncFunc // LocalResourcesEquivalent function to compare two local resources for equivalence. See ResourceSyncerConfig.ResourcesEquivalent // for more details. LocalResourcesEquivalent syncer.ResourceEquivalenceFunc // LocalShouldProcess function invoked to determine if a local resource should be processed. LocalShouldProcess syncer.ShouldProcessFunc // LocalWaitForCacheSync if true, waits for the local informer cache to sync on Start. Default is true. LocalWaitForCacheSync *bool // LocalResyncPeriod if non-zero, the period at which local resources will be re-synced regardless if anything changed. // Default is 0. LocalResyncPeriod time.Duration // BrokerResourceType the type of the broker resources to sync to the local source. BrokerResourceType runtime.Object // TransformBrokerToLocal function used to transform a broker resource to the equivalent local resource. TransformBrokerToLocal syncer.TransformFunc // OnSuccessfulSyncFromBroker function invoked after a successful sync operation from the broker. OnSuccessfulSyncFromBroker syncer.OnSuccessfulSyncFunc // BrokerResourcesEquivalent function to compare two broker resources for equivalence. See ResourceSyncerConfig.ResourcesEquivalent // for more details. BrokerResourcesEquivalent syncer.ResourceEquivalenceFunc // BrokerWaitForCacheSync if true, waits for the broker informer cache to sync on Start. Default is false. BrokerWaitForCacheSync *bool // BrokerResyncPeriod if non-zero, the period at which broker resources will be re-synced regardless if anything changed. // Default is 0. BrokerResyncPeriod time.Duration // SyncCounterOpts used to pass name and help text to resource syncer Gauge SyncCounterOpts *prometheus.GaugeOpts }
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
func NewSyncer ¶
func NewSyncer(config SyncerConfig) (*Syncer, error)
NewSyncer creates a Syncer that performs bi-directional syncing of resources between a local source and a central broker.
func (*Syncer) GetBrokerClient ¶ added in v0.12.0
func (*Syncer) GetBrokerFederator ¶ added in v0.6.0
func (*Syncer) GetBrokerNamespace ¶ added in v0.12.0
func (*Syncer) GetLocalClient ¶ added in v0.12.0
func (*Syncer) GetLocalFederator ¶ added in v0.8.0
func (*Syncer) GetLocalResource ¶ added in v0.6.1
func (*Syncer) ListLocalResources ¶ added in v0.8.0
func (*Syncer) ListLocalResourcesBySelector ¶ added in v0.16.0
type SyncerConfig ¶
type SyncerConfig struct { // LocalRestConfig the REST config used to access the local resources to sync. LocalRestConfig *rest.Config // LocalClient the client used to access local resources to sync. This is optional and is provided for unit testing // in lieu of the LocalRestConfig. If not specified, one is created from the LocalRestConfig. LocalClient dynamic.Interface // LocalNamespace the namespace in the local source to which resources from the broker will be synced. LocalNamespace string // LocalClusterID the ID of the local cluster. This is used to avoid loops when syncing the same resources between // the local and broker sources. If local resources are transformed to different broker resource types then // specify an empty LocalClusterID to disable this loop protection. LocalClusterID string // RestMapper used to obtain GroupVersionResources. This is optional and is provided for unit testing. If not specified, // one is created from the LocalRestConfig. RestMapper meta.RESTMapper // BrokerRestConfig the REST config used to access the broker resources to sync. If not specified and the BrokerClient // is not specified, the config is built from environment variables. BrokerRestConfig *rest.Config // BrokerClient the client used to access local resources to sync. This is optional and is provided for unit testing // in lieu of the BrokerRestConfig. If not specified, one is created from the BrokerRestConfig. BrokerClient dynamic.Interface // BrokerNamespace the namespace in the broker to which resources from the local source will be synced. If not // specified, the namespace is obtained from an environment variable. BrokerNamespace string // ResourceConfigs the configurations for resources to sync ResourceConfigs []ResourceConfig // Scheme used to convert resource objects. By default the global k8s Scheme is used. Scheme *runtime.Scheme }
Click to show internal directories.
Click to hide internal directories.