Documentation
¶
Index ¶
- Constants
- func GetJobCondition(job *batchv1.Job, condition batchv1.JobConditionType) *batchv1.JobCondition
- func HandlerJobCompleted(handlerJob *batchv1.Job) bool
- func HandlerJobFailed(handlerJob *batchv1.Job) bool
- type ExperimentReconciler
- func (r *ExperimentReconciler) GetHandler(instance *v2alpha2.Experiment, t HandlerType) *string
- func (r *ExperimentReconciler) GetHandlerStatus(ctx context.Context, instance *v2alpha2.Experiment, handler *string, ...) HandlerStatusType
- func (r *ExperimentReconciler) IsExperimentValid(ctx context.Context, instance *v2alpha2.Experiment) bool
- func (r *ExperimentReconciler) IsHandlerLaunched(ctx context.Context, instance *v2alpha2.Experiment, handler string, ...) (*batchv1.Job, error)
- func (r *ExperimentReconciler) IsVersionInfoValid(ctx context.Context, instance *v2alpha2.Experiment) bool
- func (r *ExperimentReconciler) LaunchHandler(ctx context.Context, instance *v2alpha2.Experiment, handler string, ...) error
- func (r *ExperimentReconciler) ReadMetric(ctx context.Context, instance *v2alpha2.Experiment, namespace string, ...) bool
- func (r *ExperimentReconciler) ReadMetrics(ctx context.Context, instance *v2alpha2.Experiment) bool
- func (r *ExperimentReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
- func (r *ExperimentReconciler) SetupWithManager(mgr ctrl.Manager) error
- type HandlerStatusType
- type HandlerType
Constants ¶
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" // 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 ¶
HandlerJobCompleted returns true if the job is completed (has the JobComplete condition set to true)
func HandlerJobFailed ¶
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) SetupWithManager ¶
func (r *ExperimentReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager ..
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" )