Documentation ¶
Index ¶
- Constants
- Variables
- func JobStatusToPodAnnotations(taskId string, annotations map[string]string, jobStatus JobStatus) error
- func SetCondition(task *api.CassandraTask, condition api.JobConditionType, ...) bool
- type AsyncTaskExecutorFunc
- type CassandraTaskReconciler
- type JobStatus
- type PodFilterFunc
- type ProcessFunc
- type SyncTaskExecutorFunc
- type TaskConfiguration
- type ValidatorFunc
Constants ¶
const (
// PodJobAnnotationPrefix defines the prefix key for a job data (json serialized) in the annotations of the pod
PodJobAnnotationPrefix = "control.k8ssandra.io/job"
)
*
Jobs executing something on every pod in the datacenter
*
Variables ¶
var ( JobRunningRequeue = 10 * time.Second TaskRunningRequeue = time.Duration(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 JobStatus ¶
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 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 // Input parameters RestartPolicy corev1.RestartPolicy Arguments api.JobArguments // Execution functionality per pod AsyncFeature httphelper.Feature AsyncFunc AsyncTaskExecutorFunc 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.