import { Resource, ResourceProps } from './base'; import { ApiObject, ApiObjectMetadataDefinition } from 'cdk8s'; import { Construct } from 'constructs'; import { RestartPolicy, PodTemplateProps, IPodTemplate } from './pod'; import { Duration } from './duration'; import { Container } from './container'; import { IServiceAccount } from './service-account'; import { Volume } from './volume'; /** * (experimental) Properties for initialization of `Job`. * * @experimental */ export interface JobProps extends ResourceProps, PodTemplateProps { /** * (experimental) Limits the lifetime of a Job that has finished execution (either Complete or Failed). * * If this field is set, after the Job finishes, it is eligible to * be automatically deleted. When the Job is being deleted, its lifecycle * guarantees (e.g. finalizers) will be honored. If this field is set to zero, * the Job becomes eligible to be deleted immediately after it finishes. This * field is alpha-level and is only honored by servers that enable the * `TTLAfterFinished` feature. * * @default - If this field is unset, the Job won't be automatically deleted. * @experimental */ readonly ttlAfterFinished?: Duration; } /** * (experimental) A Job creates one or more Pods and ensures that a specified number of them successfully terminate. * * As pods successfully complete, * the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. * Deleting a Job will clean up the Pods it created. A simple case is to create one Job object in order to reliably run one Pod to completion. * The Job object will start a new Pod if the first Pod fails or is deleted (for example due to a node hardware failure or a node reboot). * You can also use a Job to run multiple Pods in parallel. * * @experimental */ export declare class Job extends Resource implements IPodTemplate { /** * (experimental) TTL before the job is deleted after it is finished. * * @experimental */ readonly ttlAfterFinished?: Duration; /** * (experimental) The underlying cdk8s API object. * * @see base.Resource.apiObject * @experimental */ protected readonly apiObject: ApiObject; private readonly _podTemplate; /** * @experimental */ constructor(scope: Construct, id: string, props?: JobProps); /** * (experimental) Provides read/write access to the underlying pod metadata of the resource. * * @experimental */ get podMetadata(): ApiObjectMetadataDefinition; /** * (experimental) The containers belonging to the pod. * * Use `addContainer` to add containers. * * @experimental */ get containers(): Container[]; /** * (experimental) The volumes associated with this pod. * * Use `addVolume` to add volumes. * * @experimental */ get volumes(): Volume[]; /** * (experimental) Restart policy for all containers within the pod. * * @experimental */ get restartPolicy(): RestartPolicy | undefined; /** * (experimental) The service account used to run this pod. * * @experimental */ get serviceAccount(): IServiceAccount | undefined; /** * (experimental) Add a container to the pod. * * @experimental */ addContainer(container: Container): void; /** * (experimental) Add a volume to the pod. * * @experimental */ addVolume(volume: Volume): void; }