k8s

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateFailed is an event provided via EventRecorder
	CreateFailed = "CreateFailed"
	// CreateSucceeded is an event provided via EventRecorder
	CreateSucceeded = "CreateSucceeded"
	// DeleteSucceeded is an event provided via EventRecorder
	DeleteSucceeded = "DeleteSucceeded"
)

Variables

This section is empty.

Functions

func IgnoreAlreadyExists

func IgnoreAlreadyExists(err error) error

IgnoreAlreadyExists returns nil on k8s Already Exists type of errors, but returns the error as-is otherwise

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound returns nil on k8s Not Found type of errors, but returns the error as-is otherwise

Types

type Access

type Access struct {
	Client        client.Client
	Clientset     *k8sclient.Clientset
	Scheme        *runtime.Scheme
	EventRecorder record.EventRecorder
}

Access provides client related structs to access kubernetes

func (*Access) CreateWithReference

func (a *Access) CreateWithReference(ctx context.Context, object, owner metav1.Object) error

CreateWithReference method creates a kubernetes resource and sets the owner reference to a given object. It provides basic idempotency (by ignoring Already Exists errors). Successful creation of the event is logged via EventRecorder to the owner.

func (*Access) DeleteObject

func (a *Access) DeleteObject(ctx context.Context, object, owner metav1.Object) error

DeleteObject method deletes a kubernetes resource while ignores not found errors, so that it can be called multiple times. Successful deletion of the event is logged via EventRecorder to the owner.

Jump to

Keyboard shortcuts

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