From 7f3b03b2e26ada3abbb5eea4006b4c34210ac1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Archambault?= Date: Mon, 13 Jul 2026 08:27:19 -0400 Subject: [PATCH] feat: add ephemeral storage resource specs for job pods - provide defaults that keep existing pod creation usable without requiring new flags - low default ensures a minimal amount of storage is available on the Kubernetes node for scheduling --- .changes/unreleased/Feature-20260709-000001.yaml | 3 +++ bin/opslevel-runner-runner | 3 ++- src/cmd/root.go | 2 ++ src/pkg/k8s_config.go | 10 ++++++---- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/Feature-20260709-000001.yaml diff --git a/.changes/unreleased/Feature-20260709-000001.yaml b/.changes/unreleased/Feature-20260709-000001.yaml new file mode 100644 index 00000000..9edc6916 --- /dev/null +++ b/.changes/unreleased/Feature-20260709-000001.yaml @@ -0,0 +1,3 @@ +kind: Feature +body: Add configurable ephemeral-storage requests and limits for job pods via `job-pod-requests-ephemeral-storage` (default 64 MB) and `job-pod-limits-ephemeral-storage` (default 26624 MB) flags +time: 2026-07-09T00:00:01.000000Z diff --git a/bin/opslevel-runner-runner b/bin/opslevel-runner-runner index 61a9676a..9988b6f5 100755 --- a/bin/opslevel-runner-runner +++ b/bin/opslevel-runner-runner @@ -14,4 +14,5 @@ exec watchexec --watch "$SCRIPT_DIR/../src" --exts go,mod,sum --restart \ --runner-pod-namespace=default \ --job-pod-helper-image=localhost/opslevel-runner:dev \ --job-pod-requests-cpu="${OPSLEVEL_JOB_POD_REQUESTS_CPU:-50}" \ - --job-pod-requests-memory="${OPSLEVEL_JOB_POD_REQUESTS_MEMORY:-32}" + --job-pod-requests-memory="${OPSLEVEL_JOB_POD_REQUESTS_MEMORY:-32}" \ + --job-pod-requests-ephemeral-storage="${OPSLEVEL_JOB_POD_REQUESTS_EPHEMERAL_STORAGE:-32}" diff --git a/src/cmd/root.go b/src/cmd/root.go index 006794fa..b333480a 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -44,8 +44,10 @@ func init() { rootCmd.PersistentFlags().String("job-pod-namespace", "default", "The kubernetes namespace to create job pods in.") rootCmd.PersistentFlags().Int64("job-pod-requests-cpu", 1000, "The job pod resource requests cpu millicores.") rootCmd.PersistentFlags().Int64("job-pod-requests-memory", 1024, "The job pod resource requests in MB.") + rootCmd.PersistentFlags().Int64("job-pod-requests-ephemeral-storage", 64, "The job pod resource requests ephemeral-storage in MB.") rootCmd.PersistentFlags().Int64("job-pod-limits-cpu", 1000, "The job pod resource limits cpu millicores.") rootCmd.PersistentFlags().Int64("job-pod-limits-memory", 1024, "The job pod resource limits in MB.") + rootCmd.PersistentFlags().Int64("job-pod-limits-ephemeral-storage", 26624, "The job pod resource limits ephemeral-storage in MB.") rootCmd.PersistentFlags().String("job-pod-shell", "/bin/sh", "The job pod shell to use for commands run inside the pod.") rootCmd.PersistentFlags().String("job-pod-workdir", "/jobs", "The job pod working directory.") rootCmd.PersistentFlags().Int("job-pod-log-max-interval", 30, "The max amount of time between when pod logs are shipped to OpsLevel. Works in tandem with 'job-pod-log-max-size'") diff --git a/src/pkg/k8s_config.go b/src/pkg/k8s_config.go index e532c31c..cd83ad5a 100644 --- a/src/pkg/k8s_config.go +++ b/src/pkg/k8s_config.go @@ -40,12 +40,14 @@ func ReadPodConfig(path string) (*K8SPodConfig, error) { WorkingDir: viper.GetString("job-pod-workdir"), Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ - corev1.ResourceCPU: *resource.NewMilliQuantity(viper.GetInt64("job-pod-requests-cpu"), resource.DecimalSI), - corev1.ResourceMemory: *resource.NewQuantity(viper.GetInt64("job-pod-requests-memory")*1024*1024, resource.BinarySI), + corev1.ResourceCPU: *resource.NewMilliQuantity(viper.GetInt64("job-pod-requests-cpu"), resource.DecimalSI), + corev1.ResourceMemory: *resource.NewQuantity(viper.GetInt64("job-pod-requests-memory")*1024*1024, resource.BinarySI), + corev1.ResourceEphemeralStorage: *resource.NewQuantity(viper.GetInt64("job-pod-requests-ephemeral-storage")*1024*1024, resource.BinarySI), }, Limits: corev1.ResourceList{ - corev1.ResourceCPU: *resource.NewMilliQuantity(viper.GetInt64("job-pod-limits-cpu"), resource.DecimalSI), - corev1.ResourceMemory: *resource.NewQuantity(viper.GetInt64("job-pod-limits-memory")*1024*1024, resource.BinarySI), + corev1.ResourceCPU: *resource.NewMilliQuantity(viper.GetInt64("job-pod-limits-cpu"), resource.DecimalSI), + corev1.ResourceMemory: *resource.NewQuantity(viper.GetInt64("job-pod-limits-memory")*1024*1024, resource.BinarySI), + corev1.ResourceEphemeralStorage: *resource.NewQuantity(viper.GetInt64("job-pod-limits-ephemeral-storage")*1024*1024, resource.BinarySI), }, }, TerminationGracePeriodSeconds: 5,