Skip to content

Commit a204985

Browse files
[Backport 6.1.x] feat: add runAsUser and runAsGroup to executor (#642)
The start of a resolution for [REL-690](https://linear.app/sourcegraph/issue/REL-690/add-runasuser-runasgroup-fsgroup-to-executor-helm-chart). Need to test this out to see how it works. There are sample overrides in [this thread](https://sourcegraph.slack.com/archives/C0418GDBT7S/p1738581012896529?thread_ts=1738580801.517539&amp;cid=C0418GDBT7S) ### Checklist - [x] Follow the [manual testing process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md) - [ ] Update [changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md) - [ ] Update [Kubernetes update doc](https://docs.sourcegraph.com/admin/updates/kubernetes) ### Test plan Run the example overrides from the thread and see if the executor runs and doesn&#39;t fail. In particular we want a _named_ user that is not privileged. <br> Backport 45e5817 from #632 Co-authored-by: Anish Lakhwara <[email protected]>
1 parent 4ba75fb commit a204985

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

charts/sourcegraph-executor/k8s/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ In addition to the documented values, the `executor` and `private-docker-registr
8989
| executor.queueName | string | `""` | The name of the queue to pull jobs from to. Possible values: batches and codeintel. **Either this or queueNames is required.** |
9090
| executor.queueNames | list | `[]` | The names of multiple queues to pull jobs from to. Possible values: batches and codeintel. **Either this or queueName is required.** |
9191
| executor.replicas | int | `1` | |
92+
| executor.securityContext | object | `{"fsGroup":null,"privileged":false,"runAsGroup":null,"runAsUser":null}` | The containerSecurityContext for the executor image |
9293
| executor.storageSize | string | `"10Gi"` | The storage size of the PVC attached to the executor deployment. |
9394
| executor.tolerations | list | `[]` | Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
9495
| sourcegraph.affinity | object | `{}` | Affinity, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |

charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ spec:
4444
{{- include "executor.labels" . | nindent 8 }}
4545
spec:
4646
securityContext:
47-
fsGroup: {{ .Values.executor.kubernetesJob.fsGroup }}
47+
fsGroup: {{ .Values.executor.securityContext.fsGroup }}
48+
runAsUser: {{ .Values.executor.securityContext.runAsUser }}
49+
runAsGroup: {{ .Values.executor.securityContext.runAsGroup }}
4850
serviceAccountName: sg-executor
4951
containers:
5052
- name: executor
5153
image: {{ include "sourcegraph.image" (list . "executor") }}
5254
imagePullPolicy: {{ .Values.sourcegraph.image.pullPolicy }}
55+
securityContext:
56+
privileged: {{ .Values.executor.securityContext.privileged }}
5357
ports:
5458
- containerPort: 6060
5559
name: debug

charts/sourcegraph-executor/k8s/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ executor:
9090
namespace: "default"
9191
# -- The path to the kubeconfig file. If not specified, the in-cluster config is used.
9292
kubeconfigPath: ""
93+
# -- The containerSecurityContext for the executor image
94+
securityContext:
95+
# @default -- nil; accepts [0, 2147483647]
96+
runAsUser:
97+
# @default -- nil; accepts [0, 2147483647]
98+
runAsGroup:
99+
# @default -- nil; accepts [0, 2147483647]
100+
fsGroup:
101+
# @default -- false; accepts [true, false]
102+
privileged: false
93103

94104
kubernetesJob:
95105
# -- The number of seconds after which a Kubernetes job will be terminated.

0 commit comments

Comments
 (0)