GuidesChangelogDiscussions
Log In

Job Management

You can use Ketch's provider for Terraform to provide developers with an easy way to deploy jobs across Kubernetes clusters.

Deploying Jobs

terraform {
  required_providers {
    ketch = {
      version = "0.0.1"
      source = "shipa-corp/ketch"
    }
  }
}

provider "ketch" {}

resource "ketch_job" "tf" {
  job {
    name = "t-job-3"
    framework = "t-f3"
    backoffLimit = 4
    policy {
      restartPolicy = "Never"
    }
    containers {
      name = "pi"
      image = "perl"
      command = [
        "perl",
        "-Mbignum=bpi",
        "-wle",
        "print bpi(2000)"
      ]
    }
  }
}

Specification

ComponentTypeDescription
namestringThe name of the job to be deployed by Ketch

Required: Yes
frameworkstringThe framework Ketch should use to deploy the job.

Required: Yes
backoffLimitintoSpecifies the number of retries before considering a Job as failed. The back-off limit is set by default to 6

Required: No
policystringJob restart policy.

Options:
- Never
- OnFailure

By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the backoffLimit described above. Once the backoffLimit has been reached the Job will be marked as failed and any running Pods will be terminated.

Required: Yes
containersstringThe Job container image and command details.

Required: Yes