CronJob deadline not configured
This product is not supported for your selected
Datadog site. (
).
Id: 58876b44-a690-4e9f-9214-7735fa0dd15d
Cloud Provider: Kubernetes
Platform: Terraform
Severity: Low
Category: Resource Management
Learn More
Description
CronJobs must include a configured deadline. The starting_deadline_seconds attribute in the resource spec (kubernetes_cron_job[].spec.starting_deadline_seconds) must be defined. This ensures missed job executions have a bounded retry window and are not indefinitely retried.
Compliant Code Examples
resource "kubernetes_cron_job" "demo2" {
metadata {
name = "demo"
}
spec {
concurrency_policy = "Replace"
failed_jobs_history_limit = 5
schedule = "1 0 * * *"
starting_deadline_seconds = 10
successful_jobs_history_limit = 10
job_template {
metadata {}
spec {
backoff_limit = 2
ttl_seconds_after_finished = 10
template {
metadata {}
spec {
container {
name = "hello"
image = "busybox"
command = ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
}
}
}
}
}
}
}
Non-Compliant Code Examples
resource "kubernetes_cron_job" "demo" {
metadata {
name = "demo"
}
spec {
concurrency_policy = "Replace"
failed_jobs_history_limit = 5
schedule = "1 0 * * *"
successful_jobs_history_limit = 10
job_template {
metadata {}
spec {
backoff_limit = 2
ttl_seconds_after_finished = 10
template {
metadata {}
spec {
container {
name = "hello"
image = "busybox"
command = ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
}
}
}
}
}
}
}