Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 164b816

Browse files
authored
feat(helm): add commandArgs for custom entrypoint (#8567)
1 parent 611fbd8 commit 164b816

File tree

5 files changed

+205
-2
lines changed

5 files changed

+205
-2
lines changed

helm/templates/coder.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ spec:
6363
command:
6464
{{- toYaml .Values.coder.command | nindent 12 }}
6565
args:
66-
{{- if .Values.coder.workspaceProxy }}
66+
{{- if .Values.coder.commandArgs }}
67+
{{- toYaml .Values.coder.commandArgs | nindent 12 }}
68+
{{- else }}
69+
{{- if .Values.coder.workspaceProxy }}
6770
- wsproxy
68-
{{- end }}
71+
{{- end }}
6972
- server
73+
{{- end }}
7074
resources:
7175
{{- toYaml .Values.coder.resources | nindent 12 }}
7276
lifecycle:

helm/tests/chart_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ var TestCases = []TestCase{
5252
name: "command",
5353
expectedError: "",
5454
},
55+
{
56+
name: "command_args",
57+
expectedError: "",
58+
},
5559
}
5660

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

helm/tests/testdata/command_args.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coder:
2+
image:
3+
tag: latest
4+
commandArgs:
5+
- arg1
6+
- arg2

helm/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ coder:
277277
command:
278278
- /opt/coder
279279

280+
# coder.commandArgs -- Set arguments for the entrypoint command of the Coder pod.
281+
commandArgs: []
282+
280283
# extraTemplates -- Array of extra objects to deploy with the release. Strings
281284
# are evaluated as a template and can use template expansions and functions. All
282285
# other objects are used as yaml.

0 commit comments

Comments
 (0)