Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobSpawner ¶
type JobSpawner interface {
// SpawnJob creates a K8s Job for the task and returns the job name.
// Returns the job name even when the job already exists (idempotent).
SpawnJob(ctx context.Context, task lib.Task, config pkg.AgentConfiguration) (string, error)
// IsJobActive returns true if an active (not completed/failed) K8s Job exists
// for the given task identifier. Uses the agent.benjamin-borbe.de/task-id
// label set by SpawnJob.
IsJobActive(ctx context.Context, taskIdentifier lib.TaskIdentifier) (bool, error)
// CountActiveJobs returns the number of non-terminal K8s Jobs currently
// running for the given assignee. Uses the agent.benjamin-borbe.de/assignee
// label set by SpawnJob. Jobs spawned before that label existed are not
// counted, so the cap under-counts during the rollout and never over-counts.
CountActiveJobs(ctx context.Context, assignee string) (int, error)
}
JobSpawner creates a K8s Job for a task.
func NewJobSpawner ¶
func NewJobSpawner( kubeClient kubernetes.Interface, namespace k8s.Namespace, kafkaBrokers string, branch string, topicPrefix string, currentDateTimeGetter libtime.CurrentDateTimeGetter, jobTTLSecondsAfterFinished int32, jobKafkaClientCertSecret string, jobKafkaCaCertSecret string, ) JobSpawner
NewJobSpawner creates a new JobSpawner backed by the K8s batch/v1 API. jobTTLSecondsAfterFinished controls how long completed Job pods survive before Kubernetes' TTL controller garbage-collects them. jobKafkaClientCertSecret and jobKafkaCaCertSecret are the names of K8s secrets to mount into spawned Jobs for Kafka mTLS; empty strings mean no cert mounting.
Click to show internal directories.
Click to hide internal directories.