configmap

package
v0.0.0-...-df31834 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package configmap exists to facilitate consuming Kubernetes ConfigMap resources in various ways, including:

  • Watching them for changes over time, and
  • Loading them from a VolumeMount.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(p string) (map[string]string, error)

Load reads the "Data" of a ConfigMap from a particular VolumeMount.

Types

type InformedWatcher

type InformedWatcher struct {

	// Embedding this struct allows us to reuse the logic
	// of registering and notifying observers. This simplifies the
	// InformedWatcher to just setting up the Kubernetes informer
	ManualWatcher
	// contains filtered or unexported fields
}

InformedWatcher provides an informer-based implementation of Watcher.

func NewDefaultWatcher deprecated

func NewDefaultWatcher(kc kubernetes.Interface, namespace string) *InformedWatcher

NewDefaultWatcher creates a new default configmap.Watcher instance.

Deprecated: Use NewInformedWatcher

func NewInformedWatcher

func NewInformedWatcher(kc kubernetes.Interface, namespace string) *InformedWatcher

NewInformedWatcher watchers a Kubernetes namespace for configmap changs

func NewInformedWatcherFromFactory

func NewInformedWatcherFromFactory(sif informers.SharedInformerFactory, namespace string) *InformedWatcher

NewInformedWatcherFromFactory watchers a Kubernetes namespace for configmap changs

func (*InformedWatcher) Start

func (i *InformedWatcher) Start(stopCh <-chan struct{}) error

Start implements Watcher

type ManualWatcher

type ManualWatcher struct {
	Namespace string
	// contains filtered or unexported fields
}

ManualWatcher will notify Observers when a ConfigMap is manually reported as changed

func (*ManualWatcher) OnChange

func (w *ManualWatcher) OnChange(configMap *corev1.ConfigMap)

func (*ManualWatcher) Start

func (w *ManualWatcher) Start(<-chan struct{}) error

func (*ManualWatcher) Watch

func (w *ManualWatcher) Watch(name string, o Observer)

Watch implements Watcher

type Observer

type Observer func(*corev1.ConfigMap)

Observer is the signature of the callbacks that notify an observer of the latest state of a particular configuration. An observer should not modify the provided ConfigMap, and should `.DeepCopy()` it for persistence (or otherwise process its contents).

type StaticWatcher

type StaticWatcher struct {
	// contains filtered or unexported fields
}

StaticWatcher is a Watcher with static ConfigMaps. Callbacks will occur when Watch is invoked for a specific Observer

func NewFixedWatcher deprecated

func NewFixedWatcher(cms ...*corev1.ConfigMap) *StaticWatcher

NewFixedWatcher returns a StaticWatcher that exposes a collection of ConfigMaps.

Deprecated: Use NewStaticWatcher

func NewStaticWatcher

func NewStaticWatcher(cms ...*corev1.ConfigMap) *StaticWatcher

NewStaticWatcher returns an StaticWatcher that exposes a collection of ConfigMaps.

func (*StaticWatcher) Start

func (di *StaticWatcher) Start(<-chan struct{}) error

Start implements Watcher

func (*StaticWatcher) Watch

func (di *StaticWatcher) Watch(name string, o Observer)

Watch implements Watcher

type Watcher

type Watcher interface {
	// Watch is called to register a callback to be notified when a named ConfigMap changes.
	Watch(string, Observer)

	// Start is called to initiate the watches and provide a channel to signal when we should
	// stop watching.  When Start returns, all registered Observers will be called with the
	// initial state of the ConfigMaps they are watching.
	Start(<-chan struct{}) error
}

Watcher defined the interface that a configmap implementation must implement.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL