kube

package
v0.0.0-...-599b752 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

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 GetKubernetesConfig() (*rest.Config, error)

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

type AnnotationCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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 EnhancedObjectReference struct {
	corev1.ObjectReference `json:",inline"`
	Labels                 map[string]string `json:"labels,omitempty"`
	Annotations            map[string]string `json:"annotations,omitempty"`
}

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

type LabelCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

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