Job
Source:
src/AWS/EKS/Job.ts
Run-to-completion Kubernetes compute on Amazon EKS — the Kubernetes analog
of AWS.ECS.Task.
Job provisions a Kubernetes Job (or CronJob when schedule is set)
via server-side apply, a pod-identity IAM role + PodIdentityAssociation
and service account, and a container image from exactly one of three
sources flat on props: main (bundle an inline Effect program whose impl
returns { run }), context (build your own Dockerfile), or image (a
registry reference, mirrored into ECR). Bindings attach env vars to the pod
and IAM policy statements to the pod-identity role, exactly like
AWS.EKS.Deployment.
Creating a Job
Section titled “Creating a Job”Remote image (external — no Effect runtime in the container)
const migrate = yield* AWS.EKS.Job("DbMigrate", { cluster, image: "ghcr.io/acme/migrator:v3", backoffLimit: 2,});Inline Effect program with a DynamoDB binding
const seed = yield* AWS.EKS.Job( "SeedData", { cluster, main: import.meta.url }, Effect.gen(function* () { const putItem = yield* AWS.DynamoDB.PutItem(table); return { run: Effect.gen(function* () { yield* putItem({ Item: { id: { S: "seed" } } }); }), }; }).pipe(Effect.provide(AWS.DynamoDB.PutItemHttp)),);Tagged Effect program
export class Backfill extends AWS.EKS.Job<Backfill, { progress: () => Effect.Effect<number>;}>()("Backfill") {}
export default Backfill.make( { cluster, main: import.meta.url, backoffLimit: 1 }, Effect.gen(function* () { return { run: Effect.gen(function* () { }), progress: () => Effect.succeed(0), }; }),);Scheduling
Section titled “Scheduling”const nightly = yield* AWS.EKS.Job("NightlyBackfill", { cluster, main: import.meta.url, schedule: "0 3 * * *",});