Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CRWatcher ¶
type CRWatcher struct { Config *Config // contains filtered or unexported fields }
CRWatcher thing that watches
func NewCRWatcher ¶
func NewCRWatcher(cfg *Config, kubeCfg *restclient.Config, rc ResourceController, l ErrorLogger) (*CRWatcher, error)
NewCRWatcher builds a CRWatcher
type Config ¶
type Config struct { Group string // API Group of the CRD Namespace string // namespace of the CRD Version string // version of the CRD PluralName string // plural name of the CRD Filter string // Optional disregard resources that don't have an annotation key matching this filter Resync time.Duration // How often existing CRs should be resynced (marked as updated) }
Config provides config for a CRD Watcher
type ErrorLogger ¶
type ErrorLogger interface {
Error(err error)
}
ErrorLogger will receive any error messages from the kubernetes client
type ResourceController ¶
type ResourceController interface { ResourceAdded(resource *unstructured.Unstructured) ResourceUpdated(oldResource, newResource *unstructured.Unstructured) ResourceDeleted(resource *unstructured.Unstructured) }
ResourceController exposes the functionality of a controller that will handle callbacks for events that happen to the Custom Resource being monitored. The events are informational only, so you can't return an error.
- ResourceAdded is called when an object is added.
- ResourceUpdated is called when an object is modified. Note that oldResource is the last known state of the object-- it is possible that several changes were combined together, so you can't use this to see every single change. ResourceUpdated is also called when a re-list happens, and it will get called even if nothing changed. This is useful for periodically evaluating or syncing something.
- ResourceDeleted will get the final state of the item if it is known, otherwise it will get an object of type DeletedFinalStateUnknown. This can happen if the watch is closed and misses the delete event and we don't notice the deletion until the subsequent re-list.
Click to show internal directories.
Click to hide internal directories.