skop

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logger log.Logger) context.Context

func Logger

func Logger(ctx context.Context) log.Logger

Types

type Client

type Client interface {
	Create(ctx context.Context, res k8s.Resource, options ...k8s.Option) error
	Get(ctx context.Context, name string, res k8s.Resource, options ...k8s.Option) error
	Update(ctx context.Context, res k8s.Resource, options ...k8s.Option) error
	Delete(ctx context.Context, res k8s.Resource, options ...k8s.Option) error
	Watch(ctx context.Context, res k8s.Resource) (Watcher, error)
}

func FromK8sClient added in v1.1.0

func FromK8sClient(c *k8s.Client) Client

FromK8sClient provides an implementation of the Client interface backed by the provided *k8s.Client.

type Operator

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

func New

func New(options ...Option) *Operator

New constructs a new operator with the provided options.

func (*Operator) Client

func (op *Operator) Client() Client

Client returns a client for the Kubernetes API you can use in your handlers.

func (*Operator) Reconcile

func (op *Operator) Reconcile()

Reconcile reconciles all currently known resources.

func (*Operator) Run

func (op *Operator) Run()

func (*Operator) Stop

func (op *Operator) Stop()

type Option

type Option func(op *Operator)

func WithClient

func WithClient(client interface{}) Option

WithClient configures an operator to use the specified client to communicate with the Kubernetes API. This option accepts an *k8s.Client as well as anything implementing the Client interface and panics for any other values. It is required and New panics if it is not provided.

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger configures an operator to use the specified logger. This option is optional and defaults to using the standard library's log package.

func WithReconciler

func WithReconciler(r Reconciler) Option

WithReconciler configures the operator to use the specified reconciler. As an operator can only have one reconciler, when specifying this option multiple times, the last option wins.

func WithResource

func WithResource(r k8s.Resource) Option

WithResource configures an operator to watch for changes of the specified resource type. This option is required and New will panic if it is not provided.

type Reconciler

type Reconciler interface {
	Reconcile(ctx context.Context, op *Operator, res k8s.Resource) error
}

type ReconcilerFunc

type ReconcilerFunc func(ctx context.Context, op *Operator, res k8s.Resource) error

func (ReconcilerFunc) Reconcile

func (f ReconcilerFunc) Reconcile(ctx context.Context, op *Operator, res k8s.Resource) error

type Watcher

type Watcher interface {
	Next(res k8s.Resource) (string, error)
	Close() error
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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