flying_dutchman

package
v0.0.0-...-04692cc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobOwnerKey = ".metadata.controller"
)

Functions

func CheckForReadiness

func CheckForReadiness(myClient client.Client, desiredRuntimeObject runtime.Object) error

func CreateOrUpdate

TODO: Borrowed and modified slightly from https://godoc.org/sigs.k8s.io/controller-runtime/pkg/controller/controllerutil#CreateOrUpdate Changes include removing the mutateFn, using semantic.DeepEqual, doing a deepcopy before create cause create will muck with it

func EnsureRuntimeObject

func EnsureRuntimeObject(myClient client.Client, ctx context.Context, log logr.Logger, desiredRuntimeObject runtime.Object) (ctrl.Result, error)

func IsJobFinished

func IsJobFinished(job *batchv1.Job) error

func IsPodReady

func IsPodReady(pod *corev1.Pod) error

func IsReplicationControllerReady

func IsReplicationControllerReady(rc *corev1.ReplicationController) error

func IsServiceReady

func IsServiceReady(svc *corev1.Service) error

func MetaReconcile

func MetaReconcile(req ctrl.Request, mri MetaReconcilerInterface) (ctrl.Result, error)

MetaReconcile takes as input a request and an implementer of MetaReconcilerInterface It's to be used inside of a Reconcile loop

func ScheduleResources

func ScheduleResources(myClient client.Client, cr metav1.Object, mapOfUniqueIdToDesiredRuntimeObject map[string]runtime.Object, instructionManual *RuntimeObjectDependencyYaml) error

ScheduleResources takes as input a controller-runtime client, a custom resource, a map of runtime.Object, and a instruction manual It creates a task graph and schedules the runtime objects to the Kubernetes api-server

Types

type MetaReconcilerInterface

type MetaReconcilerInterface interface {
	// GetClient expects that the implementer returns a "controller-runtime" client
	GetClient() client.Client
	// GetCustomResource expects that the implementer returns the custom resource to watch against
	GetCustomResource(ctrl.Request) (metav1.Object, error)
	// GetRuntimeObjects expects that the implementer returns a map of uniqueId to runtime.Object to schedule to the api-server
	GetRuntimeObjects(interface{}) (map[string]runtime.Object, error)
	// GetInstructionManual expects that the implementer returns a pointer to the instruction manual
	GetInstructionManual() (*RuntimeObjectDependencyYaml, error)
}

MetaReconcilerInterface is a generic interface for running a Reconcile process

type RuntimeObjectDependency

type RuntimeObjectDependency struct {
	Obj           string `yaml:"obj"`
	IsDependentOn string `yaml:"isdependenton"`
}

Dependency Resources from YAML file

type RuntimeObjectDependencyYaml

type RuntimeObjectDependencyYaml struct {
	Groups       map[string][]string       `yaml:"runtimeobjectsgroupings"`
	Dependencies []RuntimeObjectDependency `yaml:"runtimeobjectdependencies"`
}

Jump to

Keyboard shortcuts

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