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) GetBrokerFederator() federate.Federator
- 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, error)
- 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 // LocalTransform function used to transform a local resource to the equivalent broker resource. LocalTransform syncer.TransformFunc // OnSuccessfulSync function invoked after a successful sync operation. LocalOnSuccessfulSync 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 // BrokerTransform function used to transform a broker resource to the equivalent local resource. BrokerTransform syncer.TransformFunc // 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) GetBrokerFederator ¶ added in v0.6.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
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 via BuildBrokerConfigFromEnv. 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 via BuildBrokerConfigFromEnv. 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.