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 *v2alpha1.Experiment, t HandlerType) *string
- func (r *ExperimentReconciler) GetHandlerStatus(ctx context.Context, instance *v2alpha1.Experiment, handler *string) HandlerStatusType
- func (r *ExperimentReconciler) IsExperimentValid(ctx context.Context, instance *v2alpha1.Experiment) bool
- func (r *ExperimentReconciler) IsHandlerLaunched(ctx context.Context, instance *v2alpha1.Experiment, handler string) (*batchv1.Job, error)
- func (r *ExperimentReconciler) IsVersionInfoValid(ctx context.Context, instance *v2alpha1.Experiment) bool
- func (r *ExperimentReconciler) LateInitialization(ctx context.Context, instance *v2alpha1.Experiment) bool
- func (r *ExperimentReconciler) LaunchHandler(ctx context.Context, instance *v2alpha1.Experiment, handler string) error
- func (r *ExperimentReconciler) ReadMetric(ctx context.Context, instance *v2alpha1.Experiment, name string, ...) bool
- func (r *ExperimentReconciler) ReadMetrics(ctx context.Context, instance *v2alpha1.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 start handler HandlerTypeStart HandlerType = "Start" // HandlerTypeFinish finish handler HandlerTypeFinish HandlerType = "Finish" // HandlerTypeRollback rollback handler HandlerTypeRollback HandlerType = "Rollback" // HandlerTypeFailure failure handler HandlerTypeFailure HandlerType = "Failure" )
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 *v2alpha1.Experiment, t HandlerType) *string
GetHandler returns handler of a given type
func (*ExperimentReconciler) GetHandlerStatus ¶
func (r *ExperimentReconciler) GetHandlerStatus(ctx context.Context, instance *v2alpha1.Experiment, handler *string) HandlerStatusType
GetHandlerStatus determines a handlers status
func (*ExperimentReconciler) IsExperimentValid ¶
func (r *ExperimentReconciler) IsExperimentValid(ctx context.Context, instance *v2alpha1.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 *v2alpha1.Experiment, handler string) (*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 *v2alpha1.Experiment) bool
IsVersionInfoValid verifies that Spec.versionInfo is valid DONE 1. verify that versionInfo is present DONE 2. verify that the number of versions in Spec.versionInfo is suitable to the Spec.Strategy.Type TODO 3. verify any ObjectReferences are existing objects in the cluster
func (*ExperimentReconciler) LateInitialization ¶
func (r *ExperimentReconciler) LateInitialization(ctx context.Context, instance *v2alpha1.Experiment) bool
LateInitialization initializes any fields in e.Spec not already set Returns false if something went wrong
func (*ExperimentReconciler) LaunchHandler ¶
func (r *ExperimentReconciler) LaunchHandler(ctx context.Context, instance *v2alpha1.Experiment, handler string) error
LaunchHandler lauches the job that implements a particular handler
func (*ExperimentReconciler) ReadMetric ¶
func (r *ExperimentReconciler) ReadMetric(ctx context.Context, instance *v2alpha1.Experiment, name string, metricMap map[string]*v2alpha1.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 *v2alpha1.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" )