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

Commit

Permalink
feat: Allow changing emptyDir sizeLimit
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kreuzberger <[email protected]>
  • Loading branch information
christian-kreuzberger-dtx committed Jul 8, 2022
1 parent 7bd83dc commit 974f14c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The following table lists the configurable parameters of the job-executor-servic
| `jobConfig.labels` | Additional labels that are added to all kubernetes jobs | `{}` |
| `jobConfig.networkPolicy.enabled` | Enable a network policy for jobs such that they can not access blocked networks defined in blockCIDRS | `false` |
| `jobConfig.networkPolicy.blockCIDRs` | A list of networks that should not be accessible from jobs | `false` |
| `jobConfig.emptyDirSizeLimit` | Size Limit of emptyDirs created for jobs | `"20Mi"` |
| `remoteControlPlane.autoDetect.enabled` | Enables auto detection of a Keptn installation | `false` |
| `remoteControlPlane.autoDetect.namespace` | Namespace which should be used by the auto-detection | `""` |
| `remoteControlPlane.api.protocol` | Used protocol (http, https | `"https"` |
Expand Down
1 change: 1 addition & 0 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: job-service-config
data:
job_namespace: "{{ .Release.Namespace }}"
job_emptydir_sizelimit: "{{ .Values.jobConfig.emptyDirSizeLimit | default "20Mi" }}"
init_container_image: "{{ .Values.jobexecutorserviceinitcontainer.image.repository }}:{{ .Values.jobexecutorserviceinitcontainer.image.tag | default .Chart.AppVersion }}"
default_resource_limits_cpu: "1"
default_resource_limits_memory: "512Mi"
Expand Down
5 changes: 5 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ spec:
configMapKeyRef:
name: job-service-config
key: job_namespace
- name: JOB_EMPTYDIR_SIZELIMIT
valueFrom:
configMapKeyRef:
name: job-service-config
key: job_emptydir_sizelimit
- name: INIT_CONTAINER_IMAGE
valueFrom:
configMapKeyRef:
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobConfig:
# "172.16.0.0/12",
# "192.168.0.0/16"
]
emptyDirSizeLimit: "20Mi" # Size Limit for emptyDirs for each job (/keptn - containing resources)

imagePullSecrets: [ ] # Secrets to use for container registry credentials

Expand Down
3 changes: 3 additions & 0 deletions cmd/job-executor-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
// The token of the keptn API
KeptnAPIToken string `envconfig:"KEPTN_API_TOKEN"`
// The init container image to use
Expand Down Expand Up @@ -130,6 +132,7 @@ func processKeptnCloudEvent(ctx context.Context, event cloudevents.Event, allowL
DefaultPodSecurityContext: DefaultPodSecurityContext,
AllowPrivilegedJobs: env.AllowPrivilegedJobs,
JobLabels: JobLabels,
JobEmtpyDirVolumeSizeLimit: env.JobEmtpyDirVolumeSizeLimit,
TaskDeadlineSeconds: TaskDeadlineSecondsPtr,
JesDeploymentName: env.FullDeploymentName,
},
Expand Down
5 changes: 5 additions & 0 deletions docs/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ args:
- /keptn/locust/basic.py
```

#### Increase Volume Size for files

By default, `/keptn` reserves `"20Mi"` (20 Mebibyte) as part of an `emptyDir`. This value can be modified at your own
risk by setting the Helm Value `jobConfig.emptyDirSizeLimit`, e.g., `--set jobConfig.emptyDirSizeLimit=50Mi`.

### Silent mode

Actions can be run in silent mode, meaning no `.started/.finished` events will be sent by the job-executor-service. This
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8sutils/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type JobSettings struct {
AllowPrivilegedJobs bool
TaskDeadlineSeconds *int64
JobLabels map[string]string
JobEmtpyDirVolumeSizeLimit string
JesDeploymentName string
}

Expand Down Expand Up @@ -116,8 +117,7 @@ func (k8s *K8sImpl) CreateK8sJob(
// TODO configure from outside:
jobVolumeMountPath := "/keptn"

// TODO configure from outside:
quantity := resource.MustParse("20Mi")
quantity := resource.MustParse(jobSettings.JobEmtpyDirVolumeSizeLimit)

jobResourceRequirements := jobSettings.DefaultResourceRequirements
if task.Resources != nil {
Expand Down

0 comments on commit 974f14c

Please sign in to comment.