Skip to content

Commit 8836c15

Browse files
committed
fix limit of resources in quota
Signed-off-by: IvanHunters <[email protected]>
1 parent 506f17f commit 8836c15

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎hack/e2e-install-cozystack.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ spec:
190190
isolated: true
191191
monitoring: false
192192
resourceQuotas:
193+
cpu: "60"
193194
memory: "64Gi"
194195
storage: "100Gi"
195196
seaweedfs: false

‎packages/apps/tenant/templates/quota.yaml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,19 @@ metadata:
77
spec:
88
hard:
99
{{- include "cozy-lib.resources.flatten" (list .Values.resourceQuotas $) | nindent 6 }}
10+
---
11+
apiVersion: v1
12+
kind: LimitRange
13+
metadata:
14+
name: tenant-range-limits
15+
namespace: {{ include "tenant.name" . }}
16+
spec:
17+
limits:
18+
- default:
19+
cpu: "250m"
20+
memory: "1Gi"
21+
defaultRequest:
22+
cpu: "100m"
23+
memory: "128Mi"
24+
type: Container
1025
{{- end }}

‎packages/library/cozy-lib/templates/_resources.tpl‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595
{{- end }}
9696
{{- range $k, $v := $args }}
9797
{{- if eq $k "cpu" }}
98+
{{- $vcpuRequestF64 := (include "cozy-lib.resources.toFloat" $v) | float64 }}
99+
{{- $cpuRequestF64 := divf $vcpuRequestF64 $cpuAllocationRatio }}
100+
{{- $_ := set $output.requests $k ($cpuRequestF64 | toString) }}
101+
{{- $_ := set $output.limits $k ($v | toString) }}
98102
{{- else if eq $k "memory" }}
99103
{{- $vMemoryRequestF64 := (include "cozy-lib.resources.toFloat" $v) | float64 }}
100104
{{- $memoryRequestF64 := divf $vMemoryRequestF64 $memoryAllocationRatio }}

0 commit comments

Comments
 (0)