Skip to content

chore: set default requests/limits in helm chart #16844

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

Merged
merged 5 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions helm/coder/tests/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ var testCases = []testCase{
name: "securitycontext",
expectedError: "",
},
{
name: "custom_resources",
expectedError: "",
},
{
name: "partial_resources",
expectedError: "",
},
}

type testCase struct {
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_1.golden
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_1_coder.golden
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_2.golden
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_2_coder.golden
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_3.golden
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/auto_access_url_3_coder.golden
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/command.golden
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/command_args.golden
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/command_args_coder.golden
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
8 changes: 7 additions & 1 deletion helm/coder/tests/testdata/command_coder.golden
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ spec:
path: /healthz
port: http
scheme: HTTP
resources: {}
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
Expand Down
201 changes: 201 additions & 0 deletions helm/coder/tests/testdata/custom_resources.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
---
# Source: coder/templates/coder.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {}
labels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: coder
app.kubernetes.io/part-of: coder
app.kubernetes.io/version: 0.1.0
helm.sh/chart: coder-0.1.0
name: coder
namespace: default
---
# Source: coder/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: coder-workspace-perms
namespace: default
rules:
- apiGroups: [""]
resources: ["pods"]
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
---
# Source: coder/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "coder"
namespace: default
subjects:
- kind: ServiceAccount
name: "coder"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: coder-workspace-perms
---
# Source: coder/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: coder
namespace: default
labels:
helm.sh/chart: coder-0.1.0
app.kubernetes.io/name: coder
app.kubernetes.io/instance: release-name
app.kubernetes.io/part-of: coder
app.kubernetes.io/version: "0.1.0"
app.kubernetes.io/managed-by: Helm
annotations:
{}
spec:
type: LoadBalancer
sessionAffinity: None
ports:
- name: "http"
port: 80
targetPort: "http"
protocol: TCP
nodePort:
externalTrafficPolicy: "Cluster"
selector:
app.kubernetes.io/name: coder
app.kubernetes.io/instance: release-name
---
# Source: coder/templates/coder.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations: {}
labels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: coder
app.kubernetes.io/part-of: coder
app.kubernetes.io/version: 0.1.0
helm.sh/chart: coder-0.1.0
name: coder
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/name: coder
template:
metadata:
annotations: {}
labels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: coder
app.kubernetes.io/part-of: coder
app.kubernetes.io/version: 0.1.0
helm.sh/chart: coder-0.1.0
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/instance
operator: In
values:
- coder
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- args:
- server
command:
- /opt/coder
env:
- name: CODER_HTTP_ADDRESS
value: 0.0.0.0:8080
- name: CODER_PROMETHEUS_ADDRESS
value: 0.0.0.0:2112
- name: CODER_ACCESS_URL
value: http://coder.default.svc.cluster.local
- name: KUBE_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: CODER_DERP_SERVER_RELAY_URL
value: http://$(KUBE_POD_IP):8080
image: ghcr.io/coder/coder:latest
imagePullPolicy: IfNotPresent
lifecycle: {}
livenessProbe:
httpGet:
path: /healthz
port: http
scheme: HTTP
name: coder
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
port: http
scheme: HTTP
resources:
limits:
cpu: 4000m
memory: 8192Mi
requests:
cpu: 1000m
memory: 2048Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
seccompProfile:
type: RuntimeDefault
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder
terminationGracePeriodSeconds: 60
volumes: []
10 changes: 10 additions & 0 deletions helm/coder/tests/testdata/custom_resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coder:
image:
tag: latest
resources:
limits:
cpu: 4000m
memory: 8192Mi
requests:
cpu: 1000m
memory: 2048Mi
Loading
Loading