k8s

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateFailed is an event provided via EventRecorder
	CreateFailed = "CreateFailed"
	// Created is an event provided via EventRecorder
	Created = "Created"
	// Deleted is an event provided via EventRecorder
	Deleted = "Deleted"
)

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

func NewEventRecorder added in v0.3.0

func NewEventRecorder(clientSet *kubernetes.Clientset, logf func(format string, args ...interface{})) record.EventRecorder

NewEventRecorder creates a new event recorder

func NewPerfJob added in v0.4.1

func NewPerfJob(objectMeta metav1.ObjectMeta, app string, imageSpec perfv1alpha1.ImageSpec,
	podConfig perfv1alpha1.PodConfigurationSpec) *batchv1.Job

NewPerfJob creates a new kubernetes job with the given arguments

func NewPersistentVolumeClaim added in v0.4.1

func NewPersistentVolumeClaim(pvcSpec corev1.PersistentVolumeClaimSpec, name, namespace string) *corev1.PersistentVolumeClaim

NewPersistentVolumeClaim creates a PVC based on the provided pvcSpec, name and namespace

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.

func (*Access) IsDeploymentReady added in v0.2.1

func (a *Access) IsDeploymentReady(namespacedName types.NamespacedName) (ready bool, err error)

IsDeploymentReady returns true if the given deployment's ready replicas matching with the desired replicas

func (*Access) IsEndpointReady added in v0.2.1

func (a *Access) IsEndpointReady(namespacedName types.NamespacedName) (finished bool, err error)

IsEndpointReady returns true if the given endpoint is fully connected to at least one pod

func (*Access) IsJobFinished added in v0.2.0

func (a *Access) IsJobFinished(namespacedName types.NamespacedName) (finished bool, err error)

IsJobFinished returns true if the given job has already succeeded or failed

func (*Access) RecordEventf added in v0.3.0

func (a *Access) RecordEventf(object metav1.Object, eventtype, reason, messageFmt string, args ...interface{}) error

RecordEventf is a convenience function to create an event (via Access.EventRecorder) for the given object.

Jump to

Keyboard shortcuts

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