Documentation
¶
Index ¶
- Variables
- func SetCondition(task *api.CassandraTask, condition api.JobConditionType, ...) bool
- type AsyncTaskExecutorFunc
- type CassandraTaskReconciler
- type Clock
- type JobStatus
- type PodFilterFunc
- type ProcessFunc
- type RealClock
- type ScheduledTaskReconciler
- type SyncTaskExecutorFunc
- type TaskConfiguration
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
var ( JobRunningRequeue = 10 * time.Second TaskRunningRequeue = 5 * time.Second )
These are vars to allow modifications for testing
Functions ¶
func SetCondition ¶
func SetCondition(task *api.CassandraTask, condition api.JobConditionType, status metav1.ConditionStatus, message string) bool
Types ¶
type AsyncTaskExecutorFunc ¶
type AsyncTaskExecutorFunc func(httphelper.NodeMgmtClient, *corev1.Pod, *TaskConfiguration) (string, error)
AsyncTaskExecutorFunc is called for all methods that support async processing
type CassandraTaskReconciler ¶
CassandraTaskReconciler reconciles a CassandraJob object
func (*CassandraTaskReconciler) HasCondition ¶
func (r *CassandraTaskReconciler) HasCondition(task *api.CassandraTask, condition api.JobConditionType, status metav1.ConditionStatus) bool
func (*CassandraTaskReconciler) SetupWithManager ¶
func (r *CassandraTaskReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type PodFilterFunc ¶
type PodFilterFunc func(*corev1.Pod, *TaskConfiguration) bool
PodFilterFunc approves or rejects the target pod for processing purposes.
type ProcessFunc ¶
type ProcessFunc func(*TaskConfiguration) error
ProcessFunc is a function that's run before the pods are being processed individually, or after the pods have been processed.
type ScheduledTaskReconciler ¶ added in v1.24.0
type ScheduledTaskReconciler struct {
client.Client
Scheme *runtime.Scheme
Clock Clock
Log logr.Logger
}
ScheduledTaskReconciler reconciles a ScheduledTask object
func (*ScheduledTaskReconciler) SetupWithManager ¶ added in v1.24.0
func (r *ScheduledTaskReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type SyncTaskExecutorFunc ¶
type SyncTaskExecutorFunc func(httphelper.NodeMgmtClient, *corev1.Pod, *TaskConfiguration) error
SyncTaskExecutorFunc is called as a backup if async one isn't supported
type TaskConfiguration ¶
type TaskConfiguration struct {
// Meta / status
Id string
TaskStartTime *metav1.Time
Datacenter *cassapi.CassandraDatacenter
Context context.Context
Job api.CassandraCommand
// Input parameters
RestartPolicy corev1.RestartPolicy
Arguments api.JobArguments
MaxConcurrentPods *int
Retries *int
// Execution functionality per pod
AsyncFeature httphelper.Feature
AsyncFunc AsyncTaskExecutorFunc
SyncFeature httphelper.Feature
SyncFunc SyncTaskExecutorFunc
PodFilter PodFilterFunc
// Functions not targeting the pod
ValidateFunc ValidatorFunc
PreProcessFunc ProcessFunc
// Status tracking
Completed int
}
TaskConfiguration sets the command's functions to execute
func (*TaskConfiguration) PreProcess ¶
func (t *TaskConfiguration) PreProcess() error
func (*TaskConfiguration) Validate ¶
func (t *TaskConfiguration) Validate() (bool, error)
type ValidatorFunc ¶
type ValidatorFunc func(*TaskConfiguration) (bool, error)
ValidatorFunc validates that necessary parameters are set for the task. If false is returned, the task has failed the validation and the error has the details. If true is returned, the error is transient and should be retried.