Skip to content

Commit 667d9a7

Browse files
authored
chore: add workspaceProxy to helm chart (#7398)
1 parent 164146c commit 667d9a7

11 files changed

+241
-3
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(wildcard cli/*.tpl
526526
go test ./cli -run="Test(CommandHelp|ServerYAML)" -update
527527
touch "$@"
528528

529-
helm/tests/testdata/.gen-golden: $(wildcard helm/tests/testdata/*.golden) $(GO_SRC_FILES)
529+
helm/tests/testdata/.gen-golden: $(wildcard helm/tests/testdata/*.yaml) $(wildcard helm/tests/testdata/*.golden) $(GO_SRC_FILES)
530530
go test ./helm/tests -run=TestUpdateGoldenFiles -update
531531
touch "$@"
532532

helm/.helmignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
.vscode/
2424
Makefile
2525
artifacthub-repo.yml
26+
27+
tests

helm/templates/coder.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ spec:
6060
- name: coder
6161
image: {{ include "coder.image" . | quote }}
6262
imagePullPolicy: {{ .Values.coder.image.pullPolicy }}
63+
command:
64+
- /opt/coder
65+
args:
66+
{{- if .Values.coder.workspaceProxy }}
67+
- proxy
68+
{{- end }}
69+
- server
6370
resources:
6471
{{- toYaml .Values.coder.resources | nindent 12 }}
6572
lifecycle:

helm/tests/chart_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ var TestCases = []TestCase{
4444
name: "labels_annotations",
4545
expectedError: "",
4646
},
47+
{
48+
name: "workspace_proxy",
49+
expectedError: "",
50+
},
4751
}
4852

4953
type TestCase struct {

helm/tests/testdata/default_values.golden

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ spec:
134134
- name: coder
135135
image: "ghcr.io/coder/coder:latest"
136136
imagePullPolicy: IfNotPresent
137+
command:
138+
- /opt/coder
139+
args:
140+
- server
137141
resources:
138142
{}
139143
lifecycle:

helm/tests/testdata/labels_annotations.golden

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ spec:
140140
- name: coder
141141
image: "ghcr.io/coder/coder:latest"
142142
imagePullPolicy: IfNotPresent
143+
command:
144+
- /opt/coder
145+
args:
146+
- server
143147
resources:
144148
{}
145149
lifecycle:

helm/tests/testdata/sa.golden

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ spec:
134134
- name: coder
135135
image: "ghcr.io/coder/coder:latest"
136136
imagePullPolicy: IfNotPresent
137+
command:
138+
- /opt/coder
139+
args:
140+
- server
137141
resources:
138142
{}
139143
lifecycle:

helm/tests/testdata/tls.golden

+4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ spec:
138138
- name: coder
139139
image: "ghcr.io/coder/coder:latest"
140140
imagePullPolicy: IfNotPresent
141+
command:
142+
- /opt/coder
143+
args:
144+
- server
141145
resources:
142146
{}
143147
lifecycle:
+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
# Source: coder/templates/coder.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: "coder"
7+
annotations:
8+
{}
9+
labels:
10+
helm.sh/chart: coder-0.1.0
11+
app.kubernetes.io/name: coder
12+
app.kubernetes.io/instance: release-name
13+
app.kubernetes.io/part-of: coder
14+
app.kubernetes.io/version: "0.1.0"
15+
app.kubernetes.io/managed-by: Helm
16+
---
17+
# Source: coder/templates/rbac.yaml
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: Role
20+
metadata:
21+
name: coder-workspace-perms
22+
rules:
23+
- apiGroups: [""]
24+
resources: ["pods"]
25+
verbs: ["*"]
26+
- apiGroups: [""]
27+
resources: ["persistentvolumeclaims"]
28+
verbs: ["*"]
29+
---
30+
# Source: coder/templates/rbac.yaml
31+
apiVersion: rbac.authorization.k8s.io/v1
32+
kind: RoleBinding
33+
metadata:
34+
name: "coder"
35+
subjects:
36+
- kind: ServiceAccount
37+
name: "coder"
38+
roleRef:
39+
apiGroup: rbac.authorization.k8s.io
40+
kind: Role
41+
name: coder-workspace-perms
42+
---
43+
# Source: coder/templates/service.yaml
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: coder
48+
labels:
49+
helm.sh/chart: coder-0.1.0
50+
app.kubernetes.io/name: coder
51+
app.kubernetes.io/instance: release-name
52+
app.kubernetes.io/part-of: coder
53+
app.kubernetes.io/version: "0.1.0"
54+
app.kubernetes.io/managed-by: Helm
55+
annotations:
56+
{}
57+
spec:
58+
type: LoadBalancer
59+
sessionAffinity: ClientIP
60+
ports:
61+
- name: "http"
62+
port: 80
63+
targetPort: "http"
64+
protocol: TCP
65+
externalTrafficPolicy: "Cluster"
66+
selector:
67+
app.kubernetes.io/name: coder
68+
app.kubernetes.io/instance: release-name
69+
---
70+
# Source: coder/templates/coder.yaml
71+
apiVersion: apps/v1
72+
kind: Deployment
73+
metadata:
74+
name: coder
75+
labels:
76+
helm.sh/chart: coder-0.1.0
77+
app.kubernetes.io/name: coder
78+
app.kubernetes.io/instance: release-name
79+
app.kubernetes.io/part-of: coder
80+
app.kubernetes.io/version: "0.1.0"
81+
app.kubernetes.io/managed-by: Helm
82+
annotations:
83+
{}
84+
spec:
85+
replicas: 1
86+
selector:
87+
matchLabels:
88+
app.kubernetes.io/name: coder
89+
app.kubernetes.io/instance: release-name
90+
template:
91+
metadata:
92+
labels:
93+
helm.sh/chart: coder-0.1.0
94+
app.kubernetes.io/name: coder
95+
app.kubernetes.io/instance: release-name
96+
app.kubernetes.io/part-of: coder
97+
app.kubernetes.io/version: "0.1.0"
98+
app.kubernetes.io/managed-by: Helm
99+
annotations:
100+
{}
101+
spec:
102+
serviceAccountName: "coder"
103+
restartPolicy: Always
104+
terminationGracePeriodSeconds: 60
105+
affinity:
106+
podAntiAffinity:
107+
preferredDuringSchedulingIgnoredDuringExecution:
108+
- podAffinityTerm:
109+
labelSelector:
110+
matchExpressions:
111+
- key: app.kubernetes.io/instance
112+
operator: In
113+
values:
114+
- coder
115+
topologyKey: kubernetes.io/hostname
116+
weight: 1
117+
containers:
118+
- name: coder
119+
image: "ghcr.io/coder/coder:latest"
120+
imagePullPolicy: IfNotPresent
121+
command:
122+
- /opt/coder
123+
args:
124+
- proxy
125+
- server
126+
resources:
127+
{}
128+
lifecycle:
129+
{}
130+
env:
131+
- name: CODER_HTTP_ADDRESS
132+
value: "0.0.0.0:8080"
133+
- name: CODER_PROMETHEUS_ADDRESS
134+
value: "0.0.0.0:2112"
135+
# Set the default access URL so a `helm apply` works by default.
136+
# See: https://github.com/coder/coder/issues/5024
137+
- name: CODER_ACCESS_URL
138+
value: "http://coder.default.svc.cluster.local"
139+
# Used for inter-pod communication with high-availability.
140+
- name: KUBE_POD_IP
141+
valueFrom:
142+
fieldRef:
143+
fieldPath: status.podIP
144+
- name: CODER_DERP_SERVER_RELAY_URL
145+
value: "http://$(KUBE_POD_IP):8080"
146+
147+
- name: CODER_PRIMARY_ACCESS_URL
148+
value: https://dev.coder.com
149+
- name: CODER_PROXY_SESSION_TOKEN
150+
valueFrom:
151+
secretKeyRef:
152+
key: token
153+
name: coder-workspace-proxy-session-token
154+
ports:
155+
- name: "http"
156+
containerPort: 8080
157+
protocol: TCP
158+
securityContext:
159+
allowPrivilegeEscalation: false
160+
readOnlyRootFilesystem: null
161+
runAsGroup: 1000
162+
runAsNonRoot: true
163+
runAsUser: 1000
164+
seccompProfile:
165+
type: RuntimeDefault
166+
readinessProbe:
167+
httpGet:
168+
path: /api/v2/buildinfo
169+
port: "http"
170+
scheme: "HTTP"
171+
livenessProbe:
172+
httpGet:
173+
path: /api/v2/buildinfo
174+
port: "http"
175+
scheme: "HTTP"
176+
volumeMounts: []
177+
volumes: []
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
coder:
2+
workspaceProxy: true
3+
4+
image:
5+
tag: latest
6+
7+
env:
8+
- name: CODER_PRIMARY_ACCESS_URL
9+
value: "https://dev.coder.com"
10+
- name: CODER_PROXY_SESSION_TOKEN
11+
valueFrom:
12+
secretKeyRef:
13+
name: coder-workspace-proxy-session-token
14+
key: token

helm/values.yaml

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
# coder -- Primary configuration for `coder server`.
22
coder:
3-
# coder.replicaCount -- The number of Kubernetes deployment replicas.
4-
# This should only be increased if High Availability is enabled.
3+
# coder.replicaCount -- The number of Kubernetes deployment replicas. This
4+
# should only be increased if High Availability is enabled.
5+
#
56
# This is an Enterprise feature. Contact sales@coder.com.
67
replicaCount: 1
78

9+
# coder.workspaceProxy -- Whether or not this deployment of Coder is a Coder
10+
# Workspace Proxy. Workspace Proxies reduce the latency between the user and
11+
# their workspace for web connections (workspace apps and web terminal) and
12+
# proxied connections from the CLI. Workspace Proxies are optional and only
13+
# recommended for geographically sparse teams.
14+
#
15+
# Make sure you set CODER_PRIMARY_ACCESS_URL and CODER_PROXY_SESSION_TOKEN in
16+
# the environment below. You can get a proxy token using the CLI:
17+
# coder proxy create \
18+
# --name "proxy-name" \
19+
# --display-name "Proxy Name" \
20+
# --icon "/emojis/xyz.png"
21+
#
22+
# This is an Enterprise feature. Contact sales@coder.com
23+
# Docs: https://coder.com/docs/v2/latest/admin/workspace-proxies
24+
workspaceProxy: false
25+
826
# coder.image -- The image to use for Coder.
927
image:
1028
# coder.image.repo -- The repository of the image.

0 commit comments

Comments
 (0)