Documentation
¶
Index ¶
- func GetKubernetesClient() (*kubernetes.Clientset, error)
- func GetKubernetesConfig() (*rest.Config, error)
- func GetObject(reference *v1.ObjectReference, clientset *kubernetes.Clientset, ...) (*unstructured.Unstructured, error)
- func NewLeaderElector(leaderElectionID string, config *rest.Config, startFunc func(context.Context), ...) (*leaderelection.LeaderElector, error)
- type AnnotationCache
- type EnhancedEvent
- type EnhancedObjectReference
- type EventHandler
- type EventWatcher
- type LabelCache
- type LeaderElectionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKubernetesClient ¶
func GetKubernetesClient() (*kubernetes.Clientset, error)
GetKubernetesClient returns the client if its possible in cluster, otherwise tries to read HOME
func GetKubernetesConfig ¶
func GetObject ¶
func GetObject(reference *v1.ObjectReference, clientset *kubernetes.Clientset, dynClient dynamic.Interface) (*unstructured.Unstructured, error)
func NewLeaderElector ¶
func NewLeaderElector(leaderElectionID string, config *rest.Config, startFunc func(context.Context), stopFunc func()) (*leaderelection.LeaderElector, error)
NewLeaderElector return a leader elector object using client-go
Types ¶
type AnnotationCache ¶
func NewAnnotationCache ¶
func NewAnnotationCache(kubeconfig *rest.Config) *AnnotationCache
func (*AnnotationCache) GetAnnotationsWithCache ¶
func (a *AnnotationCache) GetAnnotationsWithCache(reference *v1.ObjectReference) (map[string]string, error)
type EnhancedEvent ¶
type EnhancedEvent struct { corev1.Event `json:",inline"` InvolvedObject EnhancedObjectReference `json:"involvedObject"` }
func (EnhancedEvent) DeDot ¶
func (e EnhancedEvent) DeDot() EnhancedEvent
DeDot replaces all dots in the labels and annotations with underscores. This is required for example in the elasticsearch sink. The dynamic mapping generation interprets dots in JSON keys as as path in a onject. For reference see this logstash filter: https://www.elastic.co/guide/en/logstash/current/plugins-filters-de_dot.html
func (*EnhancedEvent) GetTimestampISO8601 ¶
func (e *EnhancedEvent) GetTimestampISO8601() string
func (*EnhancedEvent) GetTimestampMs ¶
func (e *EnhancedEvent) GetTimestampMs() int64
func (*EnhancedEvent) ToJSON ¶
func (e *EnhancedEvent) ToJSON() []byte
ToJSON does not return an error because we are %99 confident it is JSON serializable. TODO(makin) Is it a bad practice? It's open to discussion.
type EnhancedObjectReference ¶
type EventHandler ¶
type EventHandler func(event *EnhancedEvent)
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
func NewEventWatcher ¶
func NewEventWatcher(config *rest.Config, namespace string, throttlePeriod int64, fn EventHandler) *EventWatcher
func (*EventWatcher) OnAdd ¶
func (e *EventWatcher) OnAdd(obj interface{})
func (*EventWatcher) OnDelete ¶
func (e *EventWatcher) OnDelete(obj interface{})
func (*EventWatcher) OnUpdate ¶
func (e *EventWatcher) OnUpdate(oldObj, newObj interface{})
func (*EventWatcher) Start ¶
func (e *EventWatcher) Start()
func (*EventWatcher) Stop ¶
func (e *EventWatcher) Stop()
type LabelCache ¶
func NewLabelCache ¶
func NewLabelCache(kubeconfig *rest.Config) *LabelCache
func (*LabelCache) GetLabelsWithCache ¶
func (l *LabelCache) GetLabelsWithCache(reference *v1.ObjectReference) (map[string]string, error)
type LeaderElectionConfig ¶
type LeaderElectionConfig struct { Enabled bool `yaml:"enabled"` LeaderElectionID string `yaml:"leaderElectionID"` }
LeaderElectionConfig is used to enable leader election