Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control-service: remove hardcoded image pull policy from job deployer #2557

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ spec:
value: "{{ .Values.webHooks.postDelete.internalErrorsRetries }}"
- name: DATAJOBS_AUTHORIZATION_JWT_CLAIM_USERNAME
value: "{{ .Values.security.authorization.jwtClaimUsername }}"
- name: DATAJOBS_DEPLOYER_IMAGE_PULL_POLICY
value: "{{ .Values.dataJob.deployer.imagePullPolicy }}"
- name: KRB5_CONFIG
value: "/etc/secrets/krb5.conf"
- name: VDK_OPTIONS_INI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,9 @@ dataJob:
# In case of negative number it will be subtracted from the {{end_time}}.
# If left blank, defaults to 0.
endTimeOffsetSeconds: 0
deployer:
# imagePullPolicy for data job images deployed to K8S.
imagePullPolicy: "IfNotPresent"
deployment:
initContainer:
## Resources set on Data Job initContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class JobImageDeployer {
@Value("${datajobs.deployment.readOnlyRootFilesystem:}")
private boolean readOnlyRootFilesystem;

@Value("${datajobs.deployer.imagePullPolicy:IfNotPresent}")
private String jobImagePullPolicy;

private static final String VOLUME_NAME = "vdk";
private static final String VOLUME_MOUNT_PATH = "/vdk";
private static final String EPHEMERAL_VOLUME_NAME = "tmpfs";
Expand Down Expand Up @@ -245,7 +248,7 @@ private void updateCronJob(DataJob dataJob, JobDeployment jobDeployment, String
jobContainerEnvVars,
List.of(),
List.of(volumeMount, secretVolumeMount, ephemeralVolumeMount),
"Always",
jobImagePullPolicy,
defaultConfigurations.dataJobRequests(),
defaultConfigurations.dataJobLimits(),
null,
Expand All @@ -266,15 +269,11 @@ private void updateCronJob(DataJob dataJob, JobDeployment jobDeployment, String
Map.of(),
List.of(),
List.of(volumeMount, secretVolumeMount, ephemeralVolumeMount),
"Always",
jobImagePullPolicy,
kubernetesResources.dataJobInitContainerRequests(),
kubernetesResources.dataJobInitContainerLimits(),
null,
vdkCommand);
// TODO: changing imagePullPolicy to IfNotPresent might be necessary optimization when running
// thousands of jobs.
// At the moment Always is chosen because it's possible to have a change in image that is not
// detected.

var jobLabels = getJobLabels(dataJob, jobDeployment);
var jobAnnotations =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ mail.smtp.port=${MAIL_SMTP_PORT:25}
# See https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
datajobs.deployment.builder.imagePullPolicy=IfNotPresent

# Set imagePullPolicy of the JobImageDeployer
# - the service that deploys data job images to K8S
datajobs.deployer.imagePullPolicy=${DATAJOBS_DEPLOYER_IMAGE_PULL_POLICY:IfNotPresent}

datajobs.deployment.builder.securitycontext.runAsUser=${DATAJOBS_DEPLOYMENT_BUILDER_SECURITY_CONTEXT_RUN_AS_USER:0}
datajobs.deployment.builder.securitycontext.runAsGroup=${DATAJOBS_DEPLOYMENT_BUILDER_SECURITY_CONTEXT_RUN_AS_GROUP:1000}
datajobs.deployment.builder.securitycontext.fsGroup=${DATAJOBS_DEPLOYMENT_BUILDER_SECURITY_CONTEXT_FS_GROUP:1000}
Expand Down