Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executors: deploy on k8s #4224

Merged
merged 10 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions configure/executor/docker-daemon.ConfigMap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
data:
daemon.json: |
{ "insecure-registries":["private-docker-registry:5000"] }

kind: ConfigMap
metadata:
labels:
deploy: executor
name: docker-config
namespace: default
113 changes: 113 additions & 0 deletions configure/executor/executor.Deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: executor
namespace: default
labels:
deploy: sourcegraph
spec:
selector:
matchLabels:
app: executor
minReadySeconds: 10
replicas: 1
revisionHistoryLimit: 10
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: executor
spec:
containers:
- name: executor
image: index.docker.io/sourcegraph/executor:insiders
imagePullPolicy: Always
livenessProbe:
exec:
command:
- pgrep
- executor
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 5
readinessProbe:
exec:
command:
- pgrep
- executor
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 5
terminationMessagePolicy: FallbackToLogsOnError
# Refer to https://docs.sourcegraph.com/admin/deploy_executors_binary#step-2-setup-environment-variables on how to populate these variables
env:
- name: EXECUTOR_FRONTEND_URL
value:
- name: EXECUTOR_FRONTEND_PASSWORD
value:
- name: EXECUTOR_USE_FIRECRACKER
value: "false"
- name: EXECUTOR_QUEUE_NAME
value:
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: SRC_ACCESS_TOKEN
value:
- name: SRC_ENDPOINT
value:
volumeMounts:
- mountPath: /tmp
name: shared-data
- name: dind
image: docker:20.10.22-dind
securityContext:
privileged: true
command:
- 'dockerd'
- '--tls=false'
- '--mtu=1200'
- '--registry-mirror=http://private-docker-registry:5000'
- '--host=tcp://0.0.0.0:2375'
livenessProbe:
exec:
command:
- pgrep
- dockerd
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 5
readinessProbe:
exec:
command:
- pgrep
- dockerd
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 5
env:
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
ports:
- containerPort: 2375
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: shared-data
- mountPath: /etc/docker/daemon.json
subPath: daemon.json
name: docker-config
volumes:
- name: shared-data
emptyDir:
sizeLimit: 5Gi
- name: docker-config
configMap:
defaultMode: 420
name: docker-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: private-docker-registry
namespace: default
labels:
app: private-docker-registry
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: private-docker-registry
template:
metadata:
labels:
app: private-docker-registry
spec:
containers:
- image: index.docker.io/registry:2
name: private-docker-registry
imagePullPolicy: IfNotPresent
env:
- name: REGISTRY_PROXY_REMOTEURL
value: http://registry-1.docker.io
ports:
- containerPort: 5000
name: registry
livenessProbe:
httpGet:
path: /
port: registry
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: registry
scheme: HTTP
periodSeconds: 5
timeoutSeconds: 5
volumeMounts:
- mountPath: /var/lib/registry
name: cache
volumes:
- name: cache
persistentVolumeClaim:
claimName: private-docker-registry
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: private-docker-registry
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: sourcegraph
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: private-docker-registry
name: private-docker-registry
namespace: default
spec:
ports:
- name: http
port: 5000
protocol: TCP
targetPort: 5000
selector:
app: private-docker-registry
type: ClusterIP