kube

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 23 Imported by: 4

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 it's possible in cluster, otherwise tries to read HOME

func GetKubernetesConfig

func GetKubernetesConfig(kubeconfig string) (*rest.Config, 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 EnhancedEvent

type EnhancedEvent struct {
	corev1.Event   `json:",inline"`
	ClusterName    string                  `json:"clusterName"`
	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"`
	OwnerReferences        []metav1.OwnerReference `json:"ownerReferences,omitempty"`
	Deleted                bool                    `json:"deleted"`
}

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, MaxEventAgeSeconds int64, metricsStore *metrics.Store, fn EventHandler, omitLookup bool, cacheSize int) *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 LeaderElectionConfig

type LeaderElectionConfig struct {
	Enabled          bool   `yaml:"enabled"`
	LeaderElectionID string `yaml:"leaderElectionID"`
}

LeaderElectionConfig is used to enable leader election

type ObjectMetadata

type ObjectMetadata struct {
	Annotations     map[string]string
	Labels          map[string]string
	OwnerReferences []metav1.OwnerReference
	Deleted         bool
}

type ObjectMetadataCache

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

func (*ObjectMetadataCache) GetObjectMetadata

func (o *ObjectMetadataCache) GetObjectMetadata(reference *v1.ObjectReference, clientset *kubernetes.Clientset, dynClient dynamic.Interface, metricsStore *metrics.Store) (ObjectMetadata, error)

type ObjectMetadataProvider

type ObjectMetadataProvider interface {
	GetObjectMetadata(reference *v1.ObjectReference, clientset *kubernetes.Clientset, dynClient dynamic.Interface, metricsStore *metrics.Store) (ObjectMetadata, error)
}

func NewObjectMetadataProvider

func NewObjectMetadataProvider(size int) ObjectMetadataProvider

Jump to

Keyboard shortcuts

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