Skip to content

Commit

Permalink
Make job pod ImagePullPolicy configurable
Browse files Browse the repository at this point in the history
The same need we had for adjusting the job pod and GHA action
container's resources we also have for setting the imagePullPolicy.
  • Loading branch information
linosgian authored and benbz committed Feb 1, 2024
1 parent ae35f8a commit 7522e3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/k8s/src/hooks/prepare-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export function createContainerSpec(
const limit_memory = process.env.ACTIONS_POD_RESOURCE_LIMIT_MEMORY
const request_memory = process.env.ACTIONS_POD_RESOURCE_REQUEST_MEMORY
const request_cpu = process.env.ACTIONS_POD_RESOURCE_REQUEST_CPU
const imagePullPolicy = process.env.ACTIONS_POD_IMAGE_PULL_POLICY
resources.requests = {
...(request_cpu != undefined) && {cpu: request_cpu},
...(request_memory != undefined) && {memory: request_memory},
Expand All @@ -215,6 +216,7 @@ export function createContainerSpec(
const podContainer = {
name,
image: container.image,
imagePullPolicy: imagePullPolicy ? imagePullPolicy : "Always",
ports: containerPorts(container),
resources: resources
} as k8s.V1Container
Expand Down
2 changes: 2 additions & 0 deletions packages/k8s/src/hooks/run-container-step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function createContainerSpec(
const limit_memory = process.env.ACTIONS_POD_RESOURCE_LIMIT_MEMORY
const request_memory = process.env.ACTIONS_POD_RESOURCE_REQUEST_MEMORY
const request_cpu = process.env.ACTIONS_POD_RESOURCE_REQUEST_CPU
const imagePullPolicy = process.env.ACTIONS_POD_IMAGE_PULL_POLICY
resources.requests = {
...(request_cpu != undefined) && {cpu: request_cpu},
...(request_memory != undefined) && {memory: request_memory},
Expand All @@ -116,6 +117,7 @@ function createContainerSpec(
podContainer.name = JOB_CONTAINER_NAME
podContainer.image = container.image
podContainer.resources = resources
podContainer.imagePullPolicy = imagePullPolicy ? imagePullPolicy : "Always"
podContainer.workingDir = container.workingDirectory
podContainer.command = container.entryPoint
? [container.entryPoint]
Expand Down

0 comments on commit 7522e3f

Please sign in to comment.