k8s

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachFallbackToLogs added in v0.2.9

func AttachFallbackToLogs(sc Client, pod *corev1.Pod, logstream io.ReadCloser) error

Attach to pod, falling back to streaming logs on error

func GetNamespacedName added in v0.2.8

func GetNamespacedName(obj metav1.Object) types.NamespacedName

func ReleaseHold added in v0.2.9

func ReleaseHold(ctx context.Context, sc Client, obj api.Object) error

Types

type Client

type Client interface {
	runtimeclient.Client
	GetLogs(string, string, *corev1.PodLogOptions) (io.ReadCloser, error)
	Attach(*corev1.Pod) error
}

type Factory

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

func (*Factory) GenerateName added in v0.2.9

func (f *Factory) GenerateName(kind string) string

A (naive) implementation of the algorithm that k8s uses to generate a unique name on the server side when `generateName` is specified. Allows us to generate a unique name client-side for our k8s resources.

func (*Factory) NewClient

func (f *Factory) NewClient(config *rest.Config) (Client, error)

func (*Factory) NewConfig added in v0.2.9

func (f *Factory) NewConfig(context string) (*rest.Config, error)

func (*Factory) NewManager added in v0.2.9

func (f *Factory) NewManager(config *rest.Config, namespace string) (*Manager, error)

type FactoryInterface

type FactoryInterface interface {
	NewConfig(string) (*rest.Config, error)
	NewClient(*rest.Config) (Client, error)
	NewManager(*rest.Config, string) (*Manager, error)
	GenerateName(string) string
}

type ManagedReporter added in v0.2.9

type ManagedReporter struct {
	Reporter
	// contains filtered or unexported fields
}

type Manager added in v0.2.9

type Manager struct {
	runtimecache.Cache
	Objs []runtime.Object
	// contains filtered or unexported fields
}

Wrapper for controller-runtime cache

func (*Manager) AddReporter added in v0.2.9

func (m *Manager) AddReporter(r Reporter) error

func (*Manager) Start added in v0.2.9

func (m *Manager) Start(ctx context.Context) error

Start handlers and informer cache concurrently. Blocks until either returns.

type Reporter added in v0.2.9

type Reporter interface {
	// Register creates an informer for a given kind/obj.
	Register(cache.Cache) (cache.Informer, error)

	// MatchingObj tells the cache manager which objects the reporter receives events for.
	// Allows tests to inject objects.
	MatchingObj(interface{}) bool

	// Handler receives events from the informer. Invoked only once.
	Handler(context.Context, <-chan ctrl.Request) error
}

Similar to controller-runtime's controller/reconciler, a reporter is wired up to an informer, triggering a func on new events for a particular kind. Unlike a reconciler, it's not intended to do anything fancy like implement a k8s API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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