Skip to content

Commit 6b4bcea

Browse files
authored
Add support to set service account annotations (#151)
1 parent d5098c7 commit 6b4bcea

24 files changed

+76
-2
lines changed

charts/sourcegraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Use `**BREAKING**:` to denote a breaking change
1111
### Added
1212

1313
- Add new example `envoy` to enable HTTP trailers using Envoy Filter [#148](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/148)
14+
- Add support to configure service account annotations [#151](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/151)
1415

1516
## 3.41.0
1617

charts/sourcegraph/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ In addition to the documented values, all services also support the following va
2222
- `<serviceName>.podSecurityContext` - [learn more](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod)
2323
- `<serviceName>.args` - override default container args
2424
- `<serviceName>.env` - consult `values.yaml` file
25+
- `<serviceName>.serivceAccount.create` - create service account for service
26+
- `<serviceName>.serviceAccount.annotations` - Annotations for the service-specific service account
2527

2628
| Key | Type | Default | Description |
2729
|-----|------|---------|-------------|

charts/sourcegraph/README.md.gotmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ In addition to the documented values, all services also support the following va
2222
- `<serviceName>.podSecurityContext` - [learn more](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod)
2323
- `<serviceName>.args` - override default container args
2424
- `<serviceName>.env` - consult `values.yaml` file
25+
- `<serviceName>.serivceAccount.create` - create service account for service
26+
- `<serviceName>.serviceAccount.annotations` - Annotations for the service-specific service account
2527

2628
{{ template "chart.valuesTable" . }}

charts/sourcegraph/templates/_helpers.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ serviceAccountName: {{ include "sourcegraph.serviceAccountName" (list $top $serv
5353
{{- end }}
5454
{{- end }}
5555

56+
{{- define "sourcegraph.serviceAccountAnnotations" -}}
57+
{{- $top := index . 0 }}
58+
{{- $service := index . 1 }}
59+
{{- with (index $top.Values $service "serviceAccount" "annotations") }}
60+
annotations:
61+
{{- . | toYaml | trim | nindent 4 }}
62+
{{- end }}
63+
{{- end }}
64+
5665
{{/*
5766
Create the docker image reference and allow it to be overridden on a per-service basis
5867
Default tags are toggled between a global and service-specific setting by the

charts/sourcegraph/templates/cadvisor/cadvisor.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ metadata:
77
category: rbac
88
deploy: sourcegraph
99
app.kubernetes.io/component: cadvisor
10+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "cadvisor") | trim | nindent 2 }}
1011
name: {{ include "sourcegraph.serviceAccountName" (list . "cadvisor") }}
1112
{{- end }}

charts/sourcegraph/templates/codeinsights-db/codeinsights-db.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ metadata:
66
category: rbac
77
deploy: sourcegraph
88
app.kubernetes.io/component: codeinsights-db
9+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "codeInsightsDB") | trim | nindent 2 }}
910
name: {{ include "sourcegraph.serviceAccountName" (list . "codeInsightsDB") }}
1011
{{- end }}

charts/sourcegraph/templates/codeintel-db/codeintel-db.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ metadata:
66
category: rbac
77
deploy: sourcegraph
88
app.kubernetes.io/component: codeintel-db
9+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "codeIntelDB") | trim | nindent 2 }}
910
name: {{ include "sourcegraph.serviceAccountName" (list . "codeIntelDB") }}
1011
{{- end }}

charts/sourcegraph/templates/frontend/sourcegraph-frontend.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ metadata:
1010
category: rbac
1111
deploy: sourcegraph
1212
app.kubernetes.io/component: frontend
13+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "frontend") | trim | nindent 2 }}
1314
name: {{ include "sourcegraph.serviceAccountName" (list . "frontend") }}
1415
{{- end }}

charts/sourcegraph/templates/github-proxy/github-proxy.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ metadata:
66
category: rbac
77
deploy: sourcegraph
88
app.kubernetes.io/component: github-proxy
9+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "githubProxy") | trim | nindent 2 }}
910
name: {{ include "sourcegraph.serviceAccountName" (list . "githubProxy") }}
1011
{{- end }}

charts/sourcegraph/templates/gitserver/gitserver.ServiceAccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ metadata:
66
category: rbac
77
deploy: sourcegraph
88
app.kubernetes.io/component: gitserver
9+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "gitserver") | trim | nindent 2 }}
910
name: {{ include "sourcegraph.serviceAccountName" (list . "gitserver") }}
1011
{{- end }}

0 commit comments

Comments
 (0)