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 committed Mar 27, 2023
1 parent cb50f5f commit dbedc2e
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 @@ -167,6 +167,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 @@ -178,6 +179,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 @@ -85,6 +85,7 @@ function createPodSpec(
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 @@ -96,6 +97,7 @@ function createPodSpec(
podContainer.name = JOB_CONTAINER_NAME
podContainer.image = container.image
podContainer.resources = resources
podContainer.imagePullPolicy = imagePullPolicy ? imagePullPolicy : "Always"

const { entryPoint, entryPointArgs } = container
container.entryPoint = 'sh'
Expand Down

0 comments on commit dbedc2e

Please sign in to comment.