Documentation ¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the Submariner project.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // RestConfig the REST config used to access the resources to watch. RestConfig *rest.Config // RestMapper used to obtain GroupVersionResources. This is optional and is provided for unit testing in lieu of the // RestConfig. If not specified, one is created from the RestConfig. RestMapper meta.RESTMapper // Client the client used to access the resources to watch. This is optional and is provided for unit testing in lieu // of the RestConfig. If not specified, one is created from the RestConfig. Client dynamic.Interface // 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 // ResourceConfigs the configurations for the resources to watch. ResourceConfigs []ResourceConfig }
type EventHandler ¶
type EventHandler interface { OnCreate(obj runtime.Object, numRequeues int) bool OnUpdate(obj runtime.Object, numRequeues int) bool OnDelete(obj runtime.Object, numRequeues int) bool }
EventHandler can handle notifications of events that happen to a resource. The bool return value from each event notification method indicates whether or not the resource should be re-queued to be retried later, typically in case of an error.
type EventHandlerFuncs ¶
type EventHandlerFuncs struct { OnCreateFunc func(obj runtime.Object, numRequeues int) bool OnUpdateFunc func(obj runtime.Object, numRequeues int) bool OnDeleteFunc func(obj runtime.Object, numRequeues int) bool }
EventHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing EventHandler.
func (EventHandlerFuncs) OnCreate ¶
func (r EventHandlerFuncs) OnCreate(obj runtime.Object, numRequeues int) bool
type ResourceConfig ¶
type ResourceConfig struct { // Name of this watcher used for logging. Name string // ResourceType the types of the resources to watch. ResourceType runtime.Object // Handler that is notified of create, update, and delete events. Handler EventHandler // 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 syncer.ResourceEquivalenceFunc // ShouldProcess function invoked to determine if a resource should be processed. ShouldProcess syncer.ShouldProcessFunc // SourceNamespace the namespace of the resources to watch. SourceNamespace string // SourceLabelSelector optional selector to restrict the resources to watch by their labels. SourceLabelSelector string // SourceFieldSelector optional selector to restrict the resources to watch by their fields. SourceFieldSelector string }