Skip to content

Commit 4a0cd13

Browse files
committed
[ci] Add autoscaling to executors and make API_KEY external secret
Signed-off-by: Vihang Mehta <vihang@gimletlabs.ai>
1 parent 4566f5e commit 4a0cd13

2 files changed

Lines changed: 32 additions & 7 deletions

File tree

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: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
---
2-
replicas: 32
2+
replicas: 16
3+
4+
autoscaler:
5+
enabled: true
6+
minReplicas: 2
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+
averageValue: 20
317

418
resources:
519
limits:
620
memory: 8Gi
721
cpu: null
822
requests:
9-
cpu: null
23+
cpu: 4
1024
config:
1125
executor:
1226
app_target: "grpcs://remote.buildbuddy.io:443"
13-
api_key: $BB_EXECUTOR_API_KEY
1427
default_isolation_type: none
1528
docker_socket: ""
1629
enable_podman: false
@@ -41,7 +54,8 @@ image:
4154
customExecutorCommand:
4255
- /bin/sh
4356
- -c
44-
- 'sysctl -w net.ipv6.conf.lo.disable_ipv6=0 && /bb-executor/executor --server_type=buildbuddy-executor'
57+
- 'sysctl -w net.ipv6.conf.lo.disable_ipv6=0 &&
58+
/bb-executor/executor --server_type=buildbuddy-executor --executor.api_key=$API_KEY'
4559

4660
poolName: '"$IMAGE_TAG"'
4761

@@ -59,6 +73,12 @@ extraVolumes:
5973
emptyDir: {}
6074
- name: tmp
6175
emptyDir: {}
76+
extraEnvVars:
77+
- name: API_KEY
78+
valueFrom:
79+
secretKeyRef:
80+
name: buildbuddy-executor-api-key
81+
key: api-key
6282

6383
containerSecurityContext:
6484
privileged: true

0 commit comments

Comments
 (0)