Skip to content

Commit 66f2d52

Browse files
authored
Introduce worker service (sourcegraph#3082)
1 parent 7c705c0 commit 66f2d52

File tree

6 files changed

+111
-0
lines changed

6 files changed

+111
-0
lines changed

base/worker/worker.Deployment.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
annotations:
5+
description: Manages background processes.
6+
labels:
7+
deploy: sourcegraph
8+
sourcegraph-resource-requires: no-cluster-admin
9+
app.kubernetes.io/component: worker
10+
name: worker
11+
spec:
12+
minReadySeconds: 10
13+
replicas: 1
14+
revisionHistoryLimit: 10
15+
selector:
16+
matchLabels:
17+
app: worker
18+
strategy:
19+
rollingUpdate:
20+
maxSurge: 1
21+
maxUnavailable: 1
22+
type: RollingUpdate
23+
template:
24+
metadata:
25+
labels:
26+
deploy: sourcegraph
27+
app: worker
28+
spec:
29+
containers:
30+
- name: worker
31+
env:
32+
- name: POD_NAME
33+
valueFrom:
34+
fieldRef:
35+
fieldPath: metadata.name
36+
image: index.docker.io/sourcegraph/worker:insiders@sha256:c724fc8d29c30135d30e41a798b6a7688b5eda0a3b9a7b74753faf7028c02b41
37+
terminationMessagePolicy: FallbackToLogsOnError
38+
livenessProbe:
39+
httpGet:
40+
path: /healthz
41+
port: debug
42+
scheme: HTTP
43+
initialDelaySeconds: 60
44+
timeoutSeconds: 5
45+
readinessProbe:
46+
httpGet:
47+
path: /ready
48+
port: debug
49+
scheme: HTTP
50+
periodSeconds: 5
51+
timeoutSeconds: 5
52+
ports:
53+
- containerPort: 3189
54+
name: http
55+
- containerPort: 6060
56+
name: debug
57+
resources:
58+
limits:
59+
cpu: "2"
60+
memory: 4G
61+
requests:
62+
cpu: 500m
63+
memory: 2G
64+
securityContext:
65+
runAsUser: 0

base/worker/worker.Service.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
prometheus.io/port: "6060"
6+
sourcegraph.prometheus/scrape: "true"
7+
labels:
8+
app: worker
9+
deploy: sourcegraph
10+
sourcegraph-resource-requires: no-cluster-admin
11+
app.kubernetes.io/component: worker
12+
name: worker
13+
spec:
14+
ports:
15+
- name: http
16+
port: 3189
17+
targetPort: http
18+
- name: debug
19+
port: 6060
20+
targetPort: debug
21+
selector:
22+
app: worker
23+
type: ClusterIP

overlays/bases/deployments/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ resources:
4141
- base/github-proxy/github-proxy.Deployment.yaml
4242
- base/repo-updater/repo-updater.Service.yaml
4343
- base/repo-updater/repo-updater.Deployment.yaml
44+
- base/worker/worker.Deployment.yaml
45+
- base/worker/worker.Service.yaml
4446
- base/gitserver/gitserver.Service.yaml
4547
- base/gitserver/gitserver.StatefulSet.yaml
4648
- base/precise-code-intel/worker.Deployment.yaml

overlays/minikube/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ patchesJson6902:
4545
group: apps
4646
version: v1
4747
path: delete-resources.yaml
48+
- target:
49+
kind: Deployment
50+
name: worker
51+
group: apps
52+
version: v1
53+
path: delete-resources.yaml
4854
- target:
4955
kind: Deployment
5056
name: pgsql

overlays/non-root/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ patchesStrategicMerge:
1919
- query-runner/query-runner.Deployment.yaml
2020
- redis/redis-cache.Deployment.yaml
2121
- redis/redis-store.Deployment.yaml
22+
- worker/worker.Deployment.yaml
2223
- repo-updater/repo-updater.Deployment.yaml
2324
- searcher/searcher.Deployment.yaml
2425
- symbols/symbols.Deployment.yaml
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: worker
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: worker
10+
securityContext:
11+
# Required to prevent escalations to root.
12+
allowPrivilegeEscalation: false
13+
runAsUser: 100
14+
runAsGroup: 101

0 commit comments

Comments
 (0)