Skip to content

Commit

Permalink
feat: add restartPolicy prop to BackgroundWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzegorz Rajchman authored and mrliptontea committed Oct 17, 2022
1 parent 0470c26 commit 5165c0a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/background-worker/background-worker-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ export interface BackgroundWorkerProps
* @default { app: "<app label from chart>", role: "worker", instance: "<construct id>" }
*/
readonly selectorLabels?: { [key: string]: string };

/**
* Restart policy for all containers within the pod.
* @default "Always"
*/
readonly restartPolicy?: "Always" | "OnFailure" | "Never";
}
1 change: 1 addition & 0 deletions lib/background-worker/background-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class BackgroundWorker extends Construct {
props.automountServiceAccountToken ?? false,
imagePullSecrets: props.imagePullSecrets,
priorityClassName: props.priorityClassName,
restartPolicy: props.restartPolicy,
terminationGracePeriodSeconds: props.terminationGracePeriodSeconds,
volumes: props.volumes,
hostAliases: props.hostAliases,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ exports[`BackgroundWorker > Props > All the props 1`] = `
},
],
"priorityClassName": "high-priority",
"restartPolicy": "OnFailure",
"terminationGracePeriodSeconds": 300,
"volumes": [
{
Expand Down
1 change: 1 addition & 0 deletions test/background-worker/background-worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe("BackgroundWorker", () => {
imagePullSecrets: [{ name: "foo-secret" }],
priorityClassName: "high-priority",
revisionHistoryLimit: 5,
restartPolicy: "OnFailure",
affinity: {
podAntiAffinity: {
preferredDuringSchedulingIgnoredDuringExecution: [
Expand Down

0 comments on commit 5165c0a

Please sign in to comment.