Skip to content

Commit 301198f

Browse files
authored
[ci] Add autoscaling to executors and make API_KEY external secret (#2188)
Summary: This adds autoscaling and moves the secret to be externally specified. Relevant Issues: N/A Type of change: /kind infra Test Plan: Check this CI run and see if the executors scale up. Signed-off-by: Vihang Mehta <vihang@gimletlabs.ai>
1 parent 4566f5e commit 301198f

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

k8s/devinfra/buildbuddy-executor/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ Bazel RBE with Buildbuddy
44
To install buildbuddy executor to a k8s cluster, run the following from the workspace root.
55

66
```bash
7+
export BB_EXECUTOR_API_KEY=""
8+
export NAMESPACE=""
9+
710
helm repo add buildbuddy https://helm.buildbuddy.io
811

9-
BB_EXECUTOR_API_KEY=<api_key> \
12+
kubectl create namespace "${NAMESPACE}" || true
13+
kubectl create secret -n "${NAMESPACE}" generic buildbuddy-executor-api-key --from-literal=api-key="${BB_EXECUTOR_API_KEY}" || true
14+
1015
IMAGE_TAG="$(grep DOCKER_IMAGE_TAG "docker.properties" | cut -d= -f2)" \
11-
envsubst < k8s/devinfra/buildbuddy-executor/values.yaml | \
12-
helm upgrade --install -f - buildbuddy buildbuddy/buildbuddy-executor --create-namespace -n pixie-executors
16+
envsubst '$IMAGE_TAG' < k8s/devinfra/buildbuddy-executor/values.yaml | \
17+
helm upgrade --install -f - buildbuddy buildbuddy/buildbuddy-executor -n "${NAMESPACE}"
1318
```

k8s/devinfra/buildbuddy-executor/values.yaml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
11
---
2-
replicas: 32
2+
replicas: 16
3+
4+
autoscaler:
5+
enabled: true
6+
minReplicas: 8
7+
maxReplicas: 48
8+
metrics:
9+
- type: ContainerResource
10+
containerResource:
11+
name: cpu
12+
container: buildbuddy-executor
13+
target:
14+
# These executors idle at a very low CPU usage, so any utilization should trigger some scaling.
15+
type: Utilization
16+
averageUtilization: 20
317

418
resources:
519
limits:
620
memory: 8Gi
721
cpu: null
822
requests:
9-
cpu: null
23+
cpu: 4
1024
config:
25+
server_type: buildbuddy-executor
1126
executor:
1227
app_target: "grpcs://remote.buildbuddy.io:443"
13-
api_key: $BB_EXECUTOR_API_KEY
28+
api_key: "${API_KEY}"
1429
default_isolation_type: none
1530
docker_socket: ""
1631
enable_podman: false
1732
enable_oci: false
1833
enable_bare_runner: true
19-
local_cache_size_bytes: 375000000000 # 375GB
34+
local_cache_size_bytes: 20000000000 # 20GB
2035
millicpu: 4000
2136

2237
extraInitContainers:
@@ -41,7 +56,7 @@ image:
4156
customExecutorCommand:
4257
- /bin/sh
4358
- -c
44-
- 'sysctl -w net.ipv6.conf.lo.disable_ipv6=0 && /bb-executor/executor --server_type=buildbuddy-executor'
59+
- 'sysctl -w net.ipv6.conf.lo.disable_ipv6=0 && /bb-executor/executor'
4560

4661
poolName: '"$IMAGE_TAG"'
4762

@@ -59,6 +74,12 @@ extraVolumes:
5974
emptyDir: {}
6075
- name: tmp
6176
emptyDir: {}
77+
extraEnvVars:
78+
- name: API_KEY
79+
valueFrom:
80+
secretKeyRef:
81+
name: buildbuddy-executor-api-key
82+
key: api-key
6283

6384
containerSecurityContext:
6485
privileged: true

0 commit comments

Comments
 (0)