Skip to content

Commit 70c8e7a

Browse files
jamezrinaslilac
authored andcommitted
feat: add support for specifying LoadBalancer class name (#15838)
This PR adds support for configuring the loadBalancerClass via the chart values.
1 parent 72110d6 commit 70c8e7a

File tree

5 files changed

+207
-0
lines changed

5 files changed

+207
-0
lines changed

helm/coder/templates/service.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ spec:
3535
{{- with .Values.coder.service.externalTrafficPolicy }}
3636
externalTrafficPolicy: {{ . | quote }}
3737
{{- end }}
38+
{{- with .Values.coder.service.loadBalancerClass }}
39+
loadBalancerClass: {{ . | quote }}
40+
{{- end }}
3841
{{- end }}
3942
selector:
4043
{{- include "coder.selectorLabels" . | nindent 4 }}

helm/coder/tests/chart_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ var testCases = []testCase{
9696
name: "topology",
9797
expectedError: "",
9898
},
99+
{
100+
name: "svc_loadbalancer_class",
101+
expectedError: "",
102+
},
99103
}
100104

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

helm/coder/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ coder:
281281
# your cloud and specify it here in production to avoid accidental IP
282282
# address changes.
283283
loadBalancerIP: ""
284+
# coder.service.loadBalancerClass -- The class name of the LoadBalancer. See:
285+
# https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class
286+
loadBalancerClass: ""
284287
# coder.service.annotations -- The service annotations. See:
285288
# https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
286289
annotations: {}

0 commit comments

Comments
 (0)