Documentation
¶
Index ¶
- Constants
- func CreateBackupJob(catalog *ducklakev1alpha1.DuckLakeCatalog, backupPath string) (*batchv1.Job, error)
- func GetJobCondition(job *batchv1.Job, condType batchv1.JobConditionType) *batchv1.JobCondition
- func GetJobMessage(job *batchv1.Job) string
- func IsJobActive(job *batchv1.Job) bool
- func IsJobComplete(job *batchv1.Job) bool
- func IsJobFailed(job *batchv1.Job) bool
- func IsJobTimedOut(job *batchv1.Job) bool
- type JobConfig
- func (c *JobConfig) AddEnv(env []corev1.EnvVar)
- func (c *JobConfig) AddEnvFrom(envFrom []corev1.EnvFromSource)
- func (c *JobConfig) AddVolumeMounts(mounts []corev1.VolumeMount)
- func (c *JobConfig) AddVolumes(volumes []corev1.Volume)
- func (c *JobConfig) SetResources(resources corev1.ResourceRequirements)
- func (c *JobConfig) SetSecurityContext(securityContext *corev1.SecurityContext)
- type JobManager
- type JobPhase
- type JobState
- type LifecycleManager
- func (m *LifecycleManager) CleanupJobs(ctx context.Context, namespace string, selector labels.Selector) error
- func (m *LifecycleManager) GetJobLogs(ctx context.Context, job *batchv1.Job) (map[string]string, error)
- func (m *LifecycleManager) GetJobPods(ctx context.Context, job *batchv1.Job) ([]corev1.Pod, error)
- func (m *LifecycleManager) GetJobState(ctx context.Context, job *batchv1.Job) (*JobState, error)
- func (m *LifecycleManager) WaitForJobCompletion(ctx context.Context, job *batchv1.Job) (*JobState, error)
- type Operation
- type OperationType
Constants ¶
const ( // Job phases JobPhasePending JobPhase = "Pending" JobPhaseRunning JobPhase = "Running" JobPhaseComplete JobPhase = "Complete" JobPhaseFailed JobPhase = "Failed" // JobHistoryLimit is the number of completed/failed jobs to keep JobHistoryLimit = 3 // JobTimeoutDuration is the default timeout for jobs JobTimeoutDuration = 30 * time.Minute // JobCleanupAge is the age after which completed/failed jobs are cleaned up JobCleanupAge = 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func CreateBackupJob ¶
func CreateBackupJob(catalog *ducklakev1alpha1.DuckLakeCatalog, backupPath string) (*batchv1.Job, error)
CreateBackupJob creates a job to backup a catalog
func GetJobCondition ¶
func GetJobCondition(job *batchv1.Job, condType batchv1.JobConditionType) *batchv1.JobCondition
GetJobCondition returns the condition of the given type from the job status
func GetJobMessage ¶
GetJobMessage returns a human-readable message describing the job's state
func IsJobActive ¶
IsJobActive returns true if the job is still running
func IsJobComplete ¶
IsJobComplete checks if a job is complete
func IsJobTimedOut ¶
IsJobTimedOut returns true if the job has exceeded its timeout
Types ¶
type JobConfig ¶
type JobConfig struct { ReadOnly bool Resources corev1.ResourceRequirements SecurityContext *corev1.SecurityContext InitContainers []corev1.Container Sidecars []corev1.Container Volumes []corev1.Volume VolumeMounts []corev1.VolumeMount EnvFrom []corev1.EnvFromSource Env []corev1.EnvVar }
JobConfig contains the configuration for a DuckDB job
func DefaultReadJobConfig ¶
func DefaultReadJobConfig() *JobConfig
DefaultReadJobConfig returns the default configuration for read jobs
func DefaultWriteJobConfig ¶
func DefaultWriteJobConfig() *JobConfig
DefaultWriteJobConfig returns the default configuration for write jobs
func (*JobConfig) AddEnvFrom ¶
func (c *JobConfig) AddEnvFrom(envFrom []corev1.EnvFromSource)
AddEnvFrom adds environment from sources to the configuration
func (*JobConfig) AddVolumeMounts ¶
func (c *JobConfig) AddVolumeMounts(mounts []corev1.VolumeMount)
AddVolumeMounts adds volume mounts to the configuration
func (*JobConfig) AddVolumes ¶
AddVolumes adds volumes to the configuration
func (*JobConfig) SetResources ¶
func (c *JobConfig) SetResources(resources corev1.ResourceRequirements)
SetResources sets the resource requirements
func (*JobConfig) SetSecurityContext ¶
func (c *JobConfig) SetSecurityContext(securityContext *corev1.SecurityContext)
SetSecurityContext sets the security context
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
JobManager manages DuckDB job operations
func NewJobManager ¶
func NewJobManager(k8sClient kubernetes.Interface) *JobManager
NewJobManager creates a new job manager
type JobState ¶
type JobState struct { Phase JobPhase StartTime *metav1.Time CompletionTime *metav1.Time Failed bool Active bool Succeeded bool Message string Conditions []batchv1.JobCondition }
JobState represents the state of a job
type LifecycleManager ¶
type LifecycleManager struct {
// contains filtered or unexported fields
}
LifecycleManager manages the lifecycle of DuckDB jobs
func NewLifecycleManager ¶
func NewLifecycleManager(client client.Client, kubeClient kubernetes.Interface) *LifecycleManager
NewLifecycleManager creates a new job lifecycle manager
func (*LifecycleManager) CleanupJobs ¶
func (m *LifecycleManager) CleanupJobs(ctx context.Context, namespace string, selector labels.Selector) error
CleanupJobs removes old completed/failed jobs
func (*LifecycleManager) GetJobLogs ¶
func (m *LifecycleManager) GetJobLogs(ctx context.Context, job *batchv1.Job) (map[string]string, error)
GetJobLogs returns logs from all pods associated with a job
func (*LifecycleManager) GetJobPods ¶
GetJobPods returns all pods associated with a job
func (*LifecycleManager) GetJobState ¶
GetJobState returns the current state of a job
func (*LifecycleManager) WaitForJobCompletion ¶
func (m *LifecycleManager) WaitForJobCompletion(ctx context.Context, job *batchv1.Job) (*JobState, error)
WaitForJobCompletion waits for a job to complete with retries
type Operation ¶
type Operation struct { metav1.TypeMeta metav1.ObjectMeta Type OperationType SQL string Table *ducklakev1alpha1.DuckLakeTable Catalog *ducklakev1alpha1.DuckLakeCatalog PodTemplate *config.PodTemplateConfig JobNameSuffix string }
Operation represents a DuckDB operation configuration
func (*Operation) DeepCopyInto ¶
DeepCopyInto copies all properties of this object into another object of the same type
func (*Operation) DeepCopyObject ¶
DeepCopyObject implements runtime.Object
func (*Operation) GetObjectStoreEnv ¶
GetObjectStoreEnv returns environment variables for object store configuration
type OperationType ¶
type OperationType string
OperationType represents the type of DuckDB operation
const ( // OperationTypeRead represents a read-only operation OperationTypeRead OperationType = "read" // OperationTypeWrite represents a write operation OperationTypeWrite OperationType = "write" )