Skip to content
Permalink
Browse files

configurable pod resource requirements (#513)

  • Loading branch information
nonsense committed Feb 10, 2020
1 parent 1989e0a commit d0fad49cb8990c5ef6a70dc3f34765071d46bda4
Showing with 10 additions and 2 deletions.
  1. +2 −0 env-example.toml
  2. +8 −2 pkg/runner/cluster_k8s.go
@@ -33,6 +33,8 @@ docker_tls_key_path = "/"
[run_strategies."cluster:k8s"]
outputs_bucket = "assets-s3-bucket"
outputs_bucket_region = "eu-central-1"
pod_resource_cpu = "100m"
pod_resource_memory = "100Mi"

[daemon]
listen = ":8080"
@@ -82,6 +82,10 @@ type ClusterK8sRunnerConfig struct {

// Region of the S3 bucket used for `outputs` from test plans
OutputsBucketRegion string `toml:"outputs_bucket_region"`

// Resources requested for each pod from the Kubernetes cluster
PodResourceMemory string `toml:"pod_resource_memory"`
PodResourceCPU string `toml:"pod_resource_cpu"`
}

// ClusterK8sRunner is a runner that creates a Docker service to launch as
@@ -387,6 +391,8 @@ func monitorTestplanRunState(ctx context.Context, pool *pool, log *zap.SugaredLo
}

func createPod(ctx context.Context, pool *pool, podName string, input *api.RunInput, runenv runtime.RunParams, env []v1.EnvVar, k8sNamespace string, g api.RunGroup, i int) error {
cfg := *input.RunnerConfig.(*ClusterK8sRunnerConfig)

client := pool.Acquire()
defer pool.Release(client)

@@ -436,8 +442,8 @@ func createPod(ctx context.Context, pool *pool, podName string, input *api.RunIn
},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceMemory: resource.MustParse("100Mi"),
v1.ResourceCPU: resource.MustParse("100m"),
v1.ResourceMemory: resource.MustParse(cfg.PodResourceMemory),
v1.ResourceCPU: resource.MustParse(cfg.PodResourceCPU),
},
},
},

0 comments on commit d0fad49

Please sign in to comment.
You can’t perform that action at this time.