Documentation ¶
Index ¶
- Variables
- type Config
- type Event
- type K8sConfigMapWatcher
- func (c *K8sConfigMapWatcher) GetConfigs() ([]*config.TemplateArgs, error)
- func (c *K8sConfigMapWatcher) GetInjectionConfigs() (map[string][]*config.InjectionConfig, error)
- func (c *K8sConfigMapWatcher) GetTemplates() (map[string]string, error)
- func (c *K8sConfigMapWatcher) Watch(notifyMe chan<- interface{}, stopCh <-chan struct{}) error
- type Message
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWatchChannelClosed = errors.New("watcher channel has closed")
ErrWatchChannelClosed should restart watcher
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ClusterScoped means control Chaos Object in cluster level(all namespace); ClusterScoped bool `envconfig:"CLUSTER_SCOPED" default:"true"` // TemplateNamespace is the namespace which holds the template configmap. // If controller-manager is running with in-cluster mode. If is set to empty string, it will be overwrite to namespace which the pod belongs. TemplateNamespace string `envconfig:"TEMPLATE_NAMESPACE" default:""` // TargetNamespace means configmaps in this namespace will be controlled by this controller. // It SHOULD be the same with TargetNamespace in config.ChaosControllerConfig while clusterScoped is false. TargetNamespace string `envconfig:"TARGET_NAMESPACE" default:""` // TemplateLabels is label pairs used to discover common templates in Kubernetes. These should be key1:value[,key2:val2,...] TemplateLabels map[string]string `envconfig:"TEMPLATE_LABELS"` // ConfigLabels is label pairs used to discover ConfigMaps in Kubernetes. These should be key1:value[,key2:val2,...] ConfigLabels map[string]string `envconfig:"CONFIGMAP_LABELS"` }
Config is a configuration struct for the Watcher type
type K8sConfigMapWatcher ¶
type K8sConfigMapWatcher struct { Config // contains filtered or unexported fields }
K8sConfigMapWatcher is a struct that connects to the API and collects, parses, and emits sidecar configurations
func New ¶
func New(cfg Config, metrics *metrics.ChaosCollector) (*K8sConfigMapWatcher, error)
New creates a new K8sConfigMapWatcher
func (*K8sConfigMapWatcher) GetConfigs ¶
func (c *K8sConfigMapWatcher) GetConfigs() ([]*config.TemplateArgs, error)
GetConfigs returns the list of template args config
func (*K8sConfigMapWatcher) GetInjectionConfigs ¶
func (c *K8sConfigMapWatcher) GetInjectionConfigs() (map[string][]*config.InjectionConfig, error)
GetInjectionConfigs fetches all matching ConfigMaps
func (*K8sConfigMapWatcher) GetTemplates ¶
func (c *K8sConfigMapWatcher) GetTemplates() (map[string]string, error)
GetTemplates returns a map of common templates
func (*K8sConfigMapWatcher) Watch ¶
func (c *K8sConfigMapWatcher) Watch(notifyMe chan<- interface{}, stopCh <-chan struct{}) error
Watch watches for events impacting watched ConfigMaps and emits their events across a channel
type Message ¶
type Message struct { Event Event InjectionConfig config.InjectionConfig }
Message is a message that describes a change and payload to a sidecar configuration
Click to show internal directories.
Click to hide internal directories.