Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

feat: Allow changing emptyDir sizeLimit #311

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

christian-kreuzberger-dtx
Copy link
Contributor

@christian-kreuzberger-dtx christian-kreuzberger-dtx commented Jul 8, 2022

Fixes #170

Allows configuring emptyDir Size Limit

Note: I've chosen a helm value + env variable, as this approach is the least-breaking and gives most power the person that installs job-executor.

Signed-off-by: Christian Kreuzberger <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

Unit Test Results

126 tests   114 ✔️  2s ⏱️
  13 suites    12 💤
    1 files        0

Results for commit a4ea06a.

♻️ This comment has been updated with latest results.

Signed-off-by: Christian Kreuzberger <[email protected]>
@christian-kreuzberger-dtx christian-kreuzberger-dtx marked this pull request as ready for review July 8, 2022 11:50
Raffy23
Raffy23 previously approved these changes Jul 8, 2022
Copy link
Member

@Raffy23 Raffy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Christian Kreuzberger <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

The following Docker Images have been built:

  • keptncontrib/job-executor-service:0.2.4-dev-PR-311,keptncontrib/job-executor-service:0.2.4-dev-PR-311.202207081231
  • keptncontrib/job-executor-service-initcontainer:0.2.4-dev-PR-311,keptncontrib/job-executor-service-initcontainer:0.2.4-dev-PR-311.202207081231

Copy link
Contributor

@pchila pchila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure from the code if it's allowed to not specify an emptyDirSize in order to use a non-predetermined amount of ephmeral space on the node (in which case we are missing at least a test for it). Aside from that we just have a couple of typos to be fixed and maybe consolidate default values

@@ -4,6 +4,7 @@ metadata:
name: job-service-config
data:
job_namespace: "{{ .Release.Namespace }}"
job_emptydir_sizelimit: "{{ .Values.jobConfig.emptyDirSizeLimit | default "20Mi" }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means that it won't be possible not to specify a size and leave the management to the k8s host. I would suggest to leave the default in the values.yaml and remove it from here to allow users to specify "" as value already when installing.
Current solution would force users to manually modify the configmap to have no limit for emptyDir volumes...

@@ -38,6 +38,8 @@ type envConfig struct {
ConfigurationServiceURL string `envconfig:"CONFIGURATION_SERVICE" default:""`
// The k8s namespace the job will run in
JobNamespace string `envconfig:"JOB_NAMESPACE" required:"true"`
// Kubernetes Empty Dir Size Limit for every job (default: "20Mi")
JobEmtpyDirVolumeSizeLimit string `envconfig:"JOB_EMPTYDIR_SIZELIMIT" default:"20Mi"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another default value layer (so we have 3: values.yaml, default helm function in the configmap template and finally here in EnvConfig), it would get confusing as which value would be used.
For example: what is the value of the emptyDir size if I explicitly specify --set jobConfig.emptyDirSizeLimit="" during helm install ?

@@ -38,6 +38,8 @@ type envConfig struct {
ConfigurationServiceURL string `envconfig:"CONFIGURATION_SERVICE" default:""`
// The k8s namespace the job will run in
JobNamespace string `envconfig:"JOB_NAMESPACE" required:"true"`
// Kubernetes Empty Dir Size Limit for every job (default: "20Mi")
JobEmtpyDirVolumeSizeLimit string `envconfig:"JOB_EMPTYDIR_SIZELIMIT" default:"20Mi"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JobEmtpyDirVolumeSizeLimit string `envconfig:"JOB_EMPTYDIR_SIZELIMIT" default:"20Mi"`
JobEmptyDirVolumeSizeLimit string `envconfig:"JOB_EMPTYDIR_SIZELIMIT" default:"20Mi"`

@@ -130,6 +132,7 @@ func processKeptnCloudEvent(ctx context.Context, event cloudevents.Event, allowL
DefaultPodSecurityContext: DefaultPodSecurityContext,
AllowPrivilegedJobs: env.AllowPrivilegedJobs,
JobLabels: JobLabels,
JobEmtpyDirVolumeSizeLimit: env.JobEmtpyDirVolumeSizeLimit,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JobEmtpyDirVolumeSizeLimit: env.JobEmtpyDirVolumeSizeLimit,
JobEmptyDirVolumeSizeLimit: env.JobEmtpyDirVolumeSizeLimit,

quantity := resource.MustParse("20Mi")
if jobSettings.JobEmtpyDirVolumeSizeLimit != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with all the default values we have I am not sure that we can ever have an empty JobEmptyDirVolumeSizeLimit

Suggested change
if jobSettings.JobEmtpyDirVolumeSizeLimit != "" {
if jobSettings.JobEmptyDirVolumeSizeLimit != "" {

quantity := resource.MustParse("20Mi")
if jobSettings.JobEmtpyDirVolumeSizeLimit != "" {
quantity = resource.MustParse(jobSettings.JobEmtpyDirVolumeSizeLimit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
quantity = resource.MustParse(jobSettings.JobEmtpyDirVolumeSizeLimit)
quantity = resource.MustParse(jobSettings.JobEmptyDirVolumeSizeLimit)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: specify emptyDir sizeLimit in Job Config
3 participants