Skip to content

Commit 8b018a0

Browse files
authored
Revert "Remove symbols statefulset (#675)"
This reverts commit 422af6d.
1 parent 422af6d commit 8b018a0

File tree

12 files changed

+291
-15
lines changed

12 files changed

+291
-15
lines changed

charts/sourcegraph/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Use `**BREAKING**:` to denote a breaking change
1111
- Fix Pod Disruption Budget for sourcegraph-frontend
1212
- Added a startup probe to the gitserver statefulset to give it time to run the on-disk migration from repo names to repo IDs
1313
- The repo-updater service is no longer needed and has been removed from the chart.
14-
- The symbols service is no longer needed and has been removed from the chart. Consider merging env vars and resource overrides given to symbols into searcher before upgrading.
1514

1615
## 5.10.0
1716

charts/sourcegraph/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ In addition to the documented values, all services also support the following va
298298
| searcher.resources | object | `{"limits":{"cpu":"2","memory":"2G"},"requests":{"cpu":"500m","memory":"500M"}}` | Resource requests & limits for the `searcher` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
299299
| searcher.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `searcher` |
300300
| searcher.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
301-
| searcher.storageSize | string | `"52Gi"` | Size of the PVC for searcher pods to store cache data |
301+
| searcher.storageSize | string | `"26Gi"` | Size of the PVC for searcher pods to store cache data |
302302
| sourcegraph.affinity | object | `{}` | Global Affinity, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
303303
| sourcegraph.image.defaultTag | string | `"{{ .Chart.AppVersion }}"` | Global docker image tag |
304304
| sourcegraph.image.pullPolicy | string | `"IfNotPresent"` | Global docker image pull policy |
@@ -320,6 +320,16 @@ In addition to the documented values, all services also support the following va
320320
| storageClass.parameters | object | `{}` | Extra parameters of storageClass, consult your cloud provider persistent storage documentation |
321321
| storageClass.provisioner | string | `"kubernetes.io/gce-pd"` | Name of the storageClass provisioner, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner) and consult your cloud provider persistent storage documentation |
322322
| storageClass.type | string | `"pd-ssd"` | Value of `type` key in storageClass `parameters`, consult your cloud provider persistent storage documentation |
323+
| symbols.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `symbols` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
324+
| symbols.image.defaultTag | string | `"6.0.0@sha256:7f91048d1966add54b199755c77a5c3ca84b7f57bb5d2ffb65113da7f100b051"` | Docker image tag for the `symbols` image |
325+
| symbols.image.name | string | `"symbols"` | Docker image name for the `symbols` image |
326+
| symbols.name | string | `"symbols"` | Name used by resources. Does not affect service names or PVCs. |
327+
| symbols.podSecurityContext | object | `{"fsGroup":101,"fsGroupChangePolicy":"OnRootMismatch","runAsUser":100}` | Security context for the `symbols` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
328+
| symbols.replicaCount | int | `1` | Number of `symbols` pod |
329+
| symbols.resources | object | `{"limits":{"cpu":"2","memory":"2G"},"requests":{"cpu":"500m","memory":"500M"}}` | Resource requests & limits for the `symbols` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
330+
| symbols.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `symbols` |
331+
| symbols.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
332+
| symbols.storageSize | string | `"12Gi"` | Size of the PVC for symbols pods to store cache data |
323333
| syntacticCodeIntel.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `syntactic-code-intel-worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
324334
| syntacticCodeIntel.enabled | bool | `false` | |
325335
| syntacticCodeIntel.image.defaultTag | string | `"6.0.0@sha256:50bdeb38b196f0fc21404969016bf8263f78144292e905867e93480f66c8251c"` | Docker image tag for the `syntactic-code-intel-worker` image |

charts/sourcegraph/examples/advanced-scheduling/override.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ searcher:
9393
app: searcher
9494
weight: 100
9595

96+
symbols:
97+
replicaCount: 3
98+
affinity:
99+
podAntiAffinity:
100+
preferredDuringSchedulingIgnoredDuringExecution:
101+
- podAffinityTerm:
102+
topologyKey: kubernetes.io/hostname
103+
labelSelector:
104+
matchLabels:
105+
<<: *commonSelectorLabels
106+
app: symbols
107+
weight: 100
108+
96109
worker:
97110
replicaCount: 3
98111
affinity:

charts/sourcegraph/examples/basic/override.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,14 @@ searcher:
6464
requests:
6565
cpu: 500m
6666
memory: 1G
67+
68+
symbols:
69+
resources:
70+
limits:
71+
cpu: "4"
72+
memory: 4G
73+
ephemeral-storage: "10G"
74+
requests:
75+
cpu: "1"
76+
memory: 1G
77+
ephemeral-storage: "10G"

charts/sourcegraph/examples/common-modifications/override.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,19 @@ searcher:
183183
ephemeral-storage: 25G
184184
memory: 500M
185185

186+
187+
symbols:
188+
replicaCount: 1
189+
resources:
190+
limits:
191+
cpu: "2"
192+
ephemeral-storage: 12G
193+
memory: 2G
194+
requests:
195+
cpu: 500m
196+
ephemeral-storage: 10G
197+
memory: 500M
198+
186199
syntectServer:
187200
replicaCount: 1
188201
resources:

charts/sourcegraph/examples/gcp/override.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ searcher:
7474
SRC_LOG_FORMAT:
7575
value: json_gcp
7676

77+
symbols:
78+
env:
79+
SRC_LOG_FORMAT:
80+
value: json_gcp
81+
7782
syntectServer:
7883
env:
7984
SRC_LOG_FORMAT:

charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,11 @@ spec:
5656
{{- $item | toYaml | nindent 10 }}
5757
{{- end }}
5858
- name: SEARCHER_CACHE_SIZE_MB
59-
# Set the cache size to ~45% of the PVC size
59+
# Set the cache size to ~90% of the PVC size
6060
{{- if .Values.searcher.storageSize }}
61-
value: {{ trimSuffix "Gi" .Values.searcher.storageSize | mul 450 | quote }}
61+
value: {{ trimSuffix "Gi" .Values.searcher.storageSize | mul 900 | quote }}
6262
{{- else }}
63-
# This value is ~45% of the default value for
64-
# storageSize in the VolumeClaimTemplate below
65-
value: "23400"
66-
{{- end }}
67-
- name: SYMBOLS_CACHE_SIZE_MB
68-
# Set the cache size to ~45% of the PVC size
69-
{{- if .Values.searcher.storageSize }}
70-
value: {{ trimSuffix "Gi" .Values.searcher.storageSize | mul 450 | quote }}
71-
{{- else }}
72-
# This value is ~45% of the default value for
63+
# This value is ~90% of the default value for
7364
# storageSize in the VolumeClaimTemplate below
7465
value: "23400"
7566
{{- end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
prometheus.io/port: "6060"
6+
sourcegraph.prometheus/scrape: "true"
7+
{{- if .Values.symbols.serviceAnnotations }}
8+
{{- toYaml .Values.symbols.serviceAnnotations | nindent 4 }}
9+
{{- end }}
10+
labels:
11+
app: symbols
12+
deploy: sourcegraph
13+
app.kubernetes.io/component: symbols
14+
{{- if .Values.symbols.serviceLabels }}
15+
{{- toYaml .Values.symbols.serviceLabels | nindent 4 }}
16+
{{- end }}
17+
name: symbols
18+
spec:
19+
clusterIP: None
20+
ports:
21+
- name: http
22+
port: 3184
23+
targetPort: http
24+
- name: debug
25+
port: 6060
26+
targetPort: debug
27+
selector:
28+
{{- include "sourcegraph.selectorLabels" . | nindent 4 }}
29+
app: symbols
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- if .Values.symbols.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
labels:
6+
category: rbac
7+
deploy: sourcegraph
8+
app.kubernetes.io/component: symbols
9+
{{- include "sourcegraph.serviceAccountAnnotations" (list . "symbols") | trim | nindent 2 }}
10+
name: {{ include "sourcegraph.serviceAccountName" (list . "symbols") }}
11+
{{- end }}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
annotations:
5+
description: Backend for symbols operations.
6+
labels:
7+
{{- include "sourcegraph.labels" . | nindent 4 }}
8+
{{- if .Values.symbols.labels }}
9+
{{- toYaml .Values.symbols.labels | nindent 4 }}
10+
{{- end }}
11+
deploy: sourcegraph
12+
app.kubernetes.io/component: symbols
13+
name: {{ .Values.symbols.name }}
14+
spec:
15+
replicas: {{ .Values.symbols.replicaCount }}
16+
revisionHistoryLimit: {{ .Values.sourcegraph.revisionHistoryLimit }}
17+
selector:
18+
matchLabels:
19+
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
20+
app: symbols
21+
updateStrategy:
22+
type: RollingUpdate
23+
serviceName: symbols
24+
template:
25+
metadata:
26+
annotations:
27+
kubectl.kubernetes.io/default-container: symbols
28+
{{- include "sourcegraph.redisChecksum" . | nindent 8 }}
29+
{{- if .Values.sourcegraph.podAnnotations }}
30+
{{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }}
31+
{{- end }}
32+
{{- if .Values.symbols.podAnnotations }}
33+
{{- toYaml .Values.symbols.podAnnotations | nindent 8 }}
34+
{{- end }}
35+
labels:
36+
{{- include "sourcegraph.selectorLabels" . | nindent 8 }}
37+
{{- if .Values.sourcegraph.podLabels }}
38+
{{- toYaml .Values.sourcegraph.podLabels | nindent 8 }}
39+
{{- end }}
40+
{{- if .Values.symbols.podLabels }}
41+
{{- toYaml .Values.symbols.podLabels | nindent 8 }}
42+
{{- end }}
43+
deploy: sourcegraph
44+
app: symbols
45+
spec:
46+
containers:
47+
- name: symbols
48+
env:
49+
{{- include "sourcegraph.redisConnection" .| nindent 8 }}
50+
{{- range $name, $item := .Values.symbols.env}}
51+
- name: {{ $name }}
52+
{{- $item | toYaml | nindent 10 }}
53+
{{- end }}
54+
- name: SYMBOLS_CACHE_SIZE_MB
55+
# Set the cache size to ~90% of the PVC size
56+
{{- if .Values.symbols.storageSize }}
57+
value: {{ trimSuffix "Gi" .Values.symbols.storageSize | mul 900 | quote }}
58+
{{- else }}
59+
# This value is ~90% of the default value for
60+
# storageSize in the VolumeClaimTemplate below
61+
value: "10800"
62+
{{- end }}
63+
- name: POD_NAME
64+
valueFrom:
65+
fieldRef:
66+
fieldPath: metadata.name
67+
- name: SYMBOLS_CACHE_DIR
68+
value: /mnt/cache/$(POD_NAME)
69+
- name: TMPDIR
70+
value: /mnt/tmp
71+
{{- include "sourcegraph.openTelemetryEnv" . | nindent 8 }}
72+
image: {{ include "sourcegraph.image" (list . "symbols" ) }}
73+
imagePullPolicy: {{ .Values.sourcegraph.image.pullPolicy }}
74+
{{- with .Values.symbols.args }}
75+
args:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
78+
terminationMessagePolicy: FallbackToLogsOnError
79+
livenessProbe:
80+
httpGet:
81+
path: /healthz
82+
port: http
83+
scheme: HTTP
84+
initialDelaySeconds: 60
85+
timeoutSeconds: 5
86+
readinessProbe:
87+
httpGet:
88+
path: /healthz
89+
port: http
90+
scheme: HTTP
91+
periodSeconds: 5
92+
timeoutSeconds: 5
93+
ports:
94+
- containerPort: 3184
95+
name: http
96+
- containerPort: 6060
97+
name: debug
98+
volumeMounts:
99+
- mountPath: /mnt/cache
100+
name: cache
101+
- mountPath: /mnt/tmp
102+
name: tmp
103+
{{- if .Values.symbols.extraVolumeMounts }}
104+
{{- toYaml .Values.symbols.extraVolumeMounts | nindent 8 }}
105+
{{- end }}
106+
{{- if not .Values.sourcegraph.localDevMode }}
107+
resources:
108+
{{- toYaml .Values.symbols.resources | nindent 10 }}
109+
{{- end }}
110+
securityContext:
111+
{{- toYaml .Values.symbols.containerSecurityContext | nindent 10 }}
112+
{{- if .Values.symbols.extraContainers }}
113+
{{- toYaml .Values.symbols.extraContainers | nindent 6 }}
114+
{{- end }}
115+
securityContext:
116+
{{- toYaml .Values.symbols.podSecurityContext | nindent 8 }}
117+
{{- include "sourcegraph.nodeSelector" (list . "symbols" ) | trim | nindent 6 }}
118+
{{- include "sourcegraph.affinity" (list . "symbols" ) | trim | nindent 6 }}
119+
{{- include "sourcegraph.tolerations" (list . "symbols" ) | trim | nindent 6 }}
120+
{{- with .Values.sourcegraph.imagePullSecrets }}
121+
imagePullSecrets:
122+
{{- toYaml . | nindent 8 }}
123+
{{- end }}
124+
{{- include "sourcegraph.renderServiceAccountName" (list . "symbols") | trim | nindent 6 }}
125+
volumes:
126+
- emptyDir: {}
127+
name: cache
128+
- emptyDir: {}
129+
name: tmp
130+
{{- if .Values.symbols.extraVolumes }}
131+
{{- toYaml .Values.symbols.extraVolumes | nindent 6 }}
132+
{{- end }}
133+
{{- if .Values.symbols.priorityClassName }}
134+
priorityClassName: {{ .Values.symbols.priorityClassName }}
135+
{{- end }}
136+
volumeClaimTemplates:
137+
- metadata:
138+
name: cache
139+
spec:
140+
accessModes:
141+
- ReadWriteOnce
142+
resources:
143+
requests:
144+
storage: {{ .Values.symbols.storageSize | default "12Gi" }}
145+
storageClassName: {{ .Values.storageClass.name }}

0 commit comments

Comments
 (0)