controllers

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ServiceAccountForHandlers is the service account name to use for jobs
	ServiceAccountForHandlers string = "iter8-handlers"
	// HandlerTypeStart is the type of a start handler
	HandlerTypeStart HandlerType = "Start"
	// HandlerTypeFinish is the type of a finish handler
	HandlerTypeFinish HandlerType = "Finish"
	// HandlerTypeRollback is the type of a rollback handler
	HandlerTypeRollback HandlerType = "Rollback"
	// HandlerTypeFailure is the type of a failure handler
	HandlerTypeFailure HandlerType = "Failure"
	// HandlerTypeLoop is the type of a loop handler
	HandlerTypeLoop HandlerType = "Loop"

	// HandlerYaml is the name of the job spec used for handlers
	HandlerYaml = "handler.yaml"

	// LabelExperimentName is key of label to be added to handler jobs for experiment name
	LabelExperimentName = "iter8/experimentName"
	// LabelExperimentNamespace is key of label to be added to handler jobs for experiment namespace
	LabelExperimentNamespace = "iter8/experimentNamespace"
)

Variables

This section is empty.

Functions

func GetJobCondition

func GetJobCondition(job *batchv1.Job, condition batchv1.JobConditionType) *batchv1.JobCondition

GetJobCondition is a utility to retrieve a condition from a Job resource returns nil if it is not present

func HandlerJobCompleted

func HandlerJobCompleted(handlerJob *batchv1.Job) bool

HandlerJobCompleted returns true if the job is completed (has the JobComplete condition set to true)

func HandlerJobFailed

func HandlerJobFailed(handlerJob *batchv1.Job) bool

HandlerJobFailed returns true if the job has failed (has the JobFailed condition set to true)

Types

type ExperimentReconciler

type ExperimentReconciler struct {
	client.Client
	Log           logr.Logger
	Scheme        *runtime.Scheme
	RestConfig    *rest.Config
	EventRecorder record.EventRecorder
	Iter8Config   configuration.Iter8Config
	HTTP          analytics.HTTP
	ReleaseEvents chan event.GenericEvent
}

ExperimentReconciler reconciles a Experiment object

func (*ExperimentReconciler) GetHandler

func (r *ExperimentReconciler) GetHandler(instance *v2alpha2.Experiment, t HandlerType) *string

GetHandler returns handler of a given type

func (*ExperimentReconciler) GetHandlerStatus

func (r *ExperimentReconciler) GetHandlerStatus(ctx context.Context, instance *v2alpha2.Experiment, handler *string, handlerInstance *int) HandlerStatusType

GetHandlerStatus determines a handlers status

func (*ExperimentReconciler) IsExperimentValid

func (r *ExperimentReconciler) IsExperimentValid(ctx context.Context, instance *v2alpha2.Experiment) bool

IsExperimentValid verifies that instance.Spec is valid; this should be done after late initialization TODO 1. If fixed_split, we have an initial split (or are we just assuming start handler does it?) TODO 2. Warning if no criteria? TODO 3. For ab and abn there is a reward TODO 4. If rollbackOnFailure there is a rollback handler?

func (*ExperimentReconciler) IsHandlerLaunched

func (r *ExperimentReconciler) IsHandlerLaunched(ctx context.Context, instance *v2alpha2.Experiment, handler string, handlerInstance *int) (*batchv1.Job, error)

IsHandlerLaunched returns the handler (job) if one has been launched Otherwise it returns nil

func (*ExperimentReconciler) IsVersionInfoValid

func (r *ExperimentReconciler) IsVersionInfoValid(ctx context.Context, instance *v2alpha2.Experiment) bool

IsVersionInfoValid verifies that Spec.versionInfo is valid DONE Verify that versionInfo is present DONE Verify that the number of versions (spec.versionInfo) is suitable to the spec.strategy.testingPattern DONE Verify that the names of the versions are all unique DONE Verify that the number of rewards (spec.criteria.rewards) is suitable to spec.strategy.testingPattern DONE Verify that each fieldpath starts with '.' TODO Verify any ObjectReferences are existing objects in the cluster

func (*ExperimentReconciler) LaunchHandler

func (r *ExperimentReconciler) LaunchHandler(ctx context.Context, instance *v2alpha2.Experiment, handler string, handlerInstance *int) error

LaunchHandler lauches the job that implements a particular handler

func (*ExperimentReconciler) ReadMetric

func (r *ExperimentReconciler) ReadMetric(ctx context.Context, instance *v2alpha2.Experiment, namespace string, name string, metricMap map[string]*v2alpha2.Metric) bool

ReadMetric reads a metric from the cluster using the name as the key If the name is of the form "namespace/name", look in namespace for name. Otherwise look for name. If not found, look in util.Iter8InstallNamespace() for name. If not found return NotFound error

func (*ExperimentReconciler) ReadMetrics

func (r *ExperimentReconciler) ReadMetrics(ctx context.Context, instance *v2alpha2.Experiment) bool

ReadMetrics reads needed metrics from cluster and caches them in the experiment result is false if an error occurred reading metrics

func (*ExperimentReconciler) Reconcile

func (r *ExperimentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile attempts to align the resource with the spec

func (*ExperimentReconciler) SetupWithManager

func (r *ExperimentReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager is the method called when setting up the experiment reconciler with the controller manager.

type HandlerStatusType

type HandlerStatusType string

HandlerStatusType is the type of a handler status

const (
	// HandlerStatusNoHandler indicates that there is no handler
	HandlerStatusNoHandler HandlerStatusType = "NoHandler"
	// HandlerStatusNotLaunched indicates that the handler has not been lauched
	HandlerStatusNotLaunched HandlerStatusType = "NotLaunched"
	// HandlerStatusRunning indicates that the handler is executing
	HandlerStatusRunning HandlerStatusType = "Running"
	// HandlerStatusFailed indicates that the handler failed during execution
	HandlerStatusFailed HandlerStatusType = "Failed"
	// HandlerStatusComplete indicates that the handler has successfully executed to completion
	HandlerStatusComplete HandlerStatusType = "Complete"
)

type HandlerType

type HandlerType string

HandlerType types of handlers

Jump to

Keyboard shortcuts

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