Documentation ¶
Index ¶
Constants ¶
const ( // PodConfigNotificationUnknown is the default value for // PodConfigNotificationMode when uninitialized. PodConfigNotificationUnknown = iota // PodConfigNotificationSnapshot delivers the full configuration as a SET whenever // any change occurs. PodConfigNotificationSnapshot // PodConfigNotificationSnapshotAndUpdates delivers an UPDATE and DELETE message whenever pods are // changed, and a SET message if there are any additions or removals. PodConfigNotificationSnapshotAndUpdates // PodConfigNotificationIncremental delivers ADD, UPDATE, DELETE, REMOVE, RECONCILE to the update channel. PodConfigNotificationIncremental )
Variables ¶
This section is empty.
Functions ¶
func GetPodFullName ¶
Types ¶
type Accessor ¶
type Accessor interface { // MergedState returns a representation of the current merge state. // Must be reentrant when more than one source is defined. MergedState() interface{} }
Accessor is an interface for retrieving the current merge state.
type AccessorFunc ¶
type AccessorFunc func() interface{}
AccessorFunc implements the Accessor interface.
func (AccessorFunc) MergedState ¶
func (f AccessorFunc) MergedState() interface{}
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
func NewBroadcaster ¶
func NewBroadcaster() *Broadcaster
NewBroadcaster registers a set of listeners that support the Listener interface and notifies them all on changes.
func (*Broadcaster) Add ¶
func (b *Broadcaster) Add(listener Listener)
Add registers listener to receive updates of changes.
func (*Broadcaster) Notify ¶
func (b *Broadcaster) Notify(instance interface{})
Notify notifies all listeners.
type Listener ¶
type Listener interface {
// OnUpdate is invoked when a change is made to an object.
OnUpdate(instance interface{})
}
type ListenerFunc ¶
type ListenerFunc func(instance interface{})
ListenerFunc receives a representation of the change or object.
func (ListenerFunc) OnUpdate ¶
func (f ListenerFunc) OnUpdate(instance interface{})
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a class for merging configuration from multiple sources. Changes are pushed via channels and sent to the merge function.
func (*Mux) Channel ¶
Channel returns a channel where a configuration source can send updates of new configurations. Multiple calls with the same source will return the same channel. This allows change and state based sources to use the same channel. Different source names however will be treated as a union.
type PodConfig ¶
type PodConfig struct {
// contains filtered or unexported fields
}
PodConfig is a configuration mux that merges many sources of pod configuration into a single consistent structure, and then delivers incremental change notifications to listeners in order.
func NewPodConfig ¶
func NewPodConfig(mode PodConfigNotificationMode, recorder record.EventRecorder) *PodConfig
NewPodConfig creates an object that can merge many configuration sources into a stream of normalized updates to a pod configuration.
func (*PodConfig) Channel ¶
Channel creates or returns a config source channel. The channel only accepts PodUpdates
func (*PodConfig) SeenAllSources ¶
SeenAllSources returns true if seenSources contains all sources in the config, and also this config has received a SET message from each source.
func (*PodConfig) Sync ¶
func (c *PodConfig) Sync()
Sync requests the full configuration be delivered to the update channel.
func (*PodConfig) Updates ¶
func (c *PodConfig) Updates() <-chan cptypes.ContainerUpdate
Updates returns a channel of updates to the configuration, properly denormalized.
type PodConfigNotificationMode ¶
type PodConfigNotificationMode int
PodConfigNotificationMode describes how changes are sent to the update channel.
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
func ConvertToTimestamp ¶
ConvertToTimestamp takes a string, parses it using the RFC3339Nano layout, and converts it to a Timestamp object.
func NewTimestamp ¶
func NewTimestamp() *Timestamp
NewTimestamp returns a Timestamp object using the current time.