kubernetes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDialTimeout is the default timeout for the connection
	DefaultDialTimeout = 5 * time.Second

	// MaxResourceWatchers is the maximum number of resource watchers that can be active at the same time
	MaxWatchers = 10
)
View Source
const (
	DefaultWatchTimeout = 120 * time.Second
)
View Source
const (
	// MaxConnections is the maximum number of connections that can be active at the same time
	MaxConnections = 3
)

Variables

This section is empty.

Functions

func FormatWatcherID added in v0.2.0

func FormatWatcherID(gvr schema.GroupVersionResource, namespace string, watcherType WatcherType) string

func NewBaseWatcher added in v0.2.0

func NewBaseWatcher(config WatcherConfig, watcherType WatcherType) *baseWatcher

Types

type KubeConnection

type KubeConnection struct {
	LastUsed time.Time
	// contains filtered or unexported fields
}

func NewKubeConnection

func NewKubeConnection(kubeConfig *api.Config, kubeContext string) (*KubeConnection, error)

func (*KubeConnection) Discover added in v0.2.0

func (kc *KubeConnection) Discover(ctx context.Context) ([]*metav1.APIResourceList, error)

func (*KubeConnection) GetWatcher added in v0.2.0

func (kc *KubeConnection) GetWatcher(gvr schema.GroupVersionResource, namespace string, watcherType WatcherType) (Watcher, error)

func (*KubeConnection) Stop

func (kc *KubeConnection) Stop()

type KubeService

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

func NewKubeService

func NewKubeService() *KubeService

func (*KubeService) Discover added in v0.2.0

func (ks *KubeService) Discover(ctx context.Context, kubeContext string) ([]*metav1.APIResourceList, error)

func (*KubeService) GetContextNames

func (ks *KubeService) GetContextNames() []string

func (*KubeService) GetDefaultContext

func (ks *KubeService) GetDefaultContext() string

func (*KubeService) ListResource

func (ks *KubeService) ListResource(ctx context.Context, kubeContext string, gvr schema.GroupVersionResource, namespace string) ([]*unstructured.Unstructured, error)

func (*KubeService) ListResourceTabular added in v0.2.0

func (ks *KubeService) ListResourceTabular(ctx context.Context, kubeContext string, gvr schema.GroupVersionResource, namespace string) (*metav1.Table, error)

func (*KubeService) Stop

func (ks *KubeService) Stop()

type ListWatcher added in v0.2.0

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

func NewListWatcher added in v0.2.0

func NewListWatcher(clientConfig *rest.Config, config WatcherConfig) (*ListWatcher, error)

func (ListWatcher) GetID added in v0.2.0

func (bw ListWatcher) GetID() string

func (ListWatcher) GetLastUsed added in v0.2.0

func (bw ListWatcher) GetLastUsed() time.Time

func (ListWatcher) GetType added in v0.2.0

func (bw ListWatcher) GetType() WatcherType

func (*ListWatcher) List added in v0.2.0

func (ListWatcher) Stop added in v0.2.0

func (bw ListWatcher) Stop()

func (ListWatcher) UpdateLastUsed added in v0.2.0

func (bw ListWatcher) UpdateLastUsed()

type TableWatcher added in v0.2.0

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

func NewTableWatcher added in v0.2.0

func NewTableWatcher(clientConfig *rest.Config, config WatcherConfig) (*TableWatcher, error)

func (TableWatcher) GetID added in v0.2.0

func (bw TableWatcher) GetID() string

func (TableWatcher) GetLastUsed added in v0.2.0

func (bw TableWatcher) GetLastUsed() time.Time

func (*TableWatcher) GetTable added in v0.2.0

func (tw *TableWatcher) GetTable(ctx context.Context) (*metav1.Table, error)

func (TableWatcher) GetType added in v0.2.0

func (bw TableWatcher) GetType() WatcherType

func (TableWatcher) Stop added in v0.2.0

func (bw TableWatcher) Stop()

func (TableWatcher) UpdateLastUsed added in v0.2.0

func (bw TableWatcher) UpdateLastUsed()

type Watcher added in v0.2.0

type Watcher interface {
	Stop()
	GetLastUsed() time.Time
	UpdateLastUsed()
	GetType() WatcherType
	GetID() string
}

type WatcherConfig added in v0.2.0

type WatcherConfig struct {
	KubeContext string
	GVR         schema.GroupVersionResource
	Namespace   string
	// contains filtered or unexported fields
}

type WatcherType added in v0.2.0

type WatcherType string
const (
	WatcherTypeList     WatcherType = "list"
	WatcherTypeTable    WatcherType = "table"
	WatcherTypeResource WatcherType = "resource"
)

Jump to

Keyboard shortcuts

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