diff --git a/charts/base-cluster/ci/limitrange-resourcequota-values.yaml b/charts/base-cluster/ci/limitrange-resourcequota-values.yaml new file mode 100644 index 000000000..72244c55d --- /dev/null +++ b/charts/base-cluster/ci/limitrange-resourcequota-values.yaml @@ -0,0 +1,59 @@ +global: + serviceLevelAgreement: None + namespaces: + main0: + resources: + defaults: + requests: + cpu: 50m + memory: 100Mi + limits: + cpu: 500m + memory: 300Mi + quotas: + limits.cpu: "1" + limits.memory: 1Gi + main1: + resources: + defaults: + requests: + cpu: 50m + memory: 100Mi + limits: + cpu: 500m + memory: 300Mi + main2: + resources: + defaults: + requests: + cpu: 50m + memory: 100Mi + quotas: + limits.cpu: "1" + limits.memory: 1Gi + main3: + resources: + defaults: + requests: + cpu: 50m + memory: 100Mi + main4: + resources: + defaults: + limits: + cpu: 500m + memory: 300Mi + quotas: + limits.cpu: "1" + limits.memory: 1Gi + main5: + resources: + defaults: + limits: + cpu: 500m + memory: 300Mi + main6: + resources: + quotas: + limits.cpu: "1" + limits.memory: 1Gi \ No newline at end of file diff --git a/charts/base-cluster/templates/global/namespaces.yaml b/charts/base-cluster/templates/global/namespaces.yaml index 059c204da..b4bff157d 100644 --- a/charts/base-cluster/templates/global/namespaces.yaml +++ b/charts/base-cluster/templates/global/namespaces.yaml @@ -20,11 +20,19 @@ spec: {{- if $namespace.resources.defaults -}} {{/* this section defines default limits */}} {{- with $namespace.resources.defaults.limits -}} - {{- $limits = set $limits "default" . -}} + {{- $defaultLimits := dict -}} + {{- range $resource, $limit := . -}} + {{- $defaultLimits = set $defaultLimits $resource (include "common.tplvalues.render" (dict "value" $limit "context" $)) -}} + {{- end -}} + {{- $limits = set $limits "default" $defaultLimits -}} {{- end -}} {{/* this section defines default requests */}} {{- with $namespace.resources.defaults.requests -}} - {{- $limits = set $limits "defaultRequest" . -}} + {{- $defaultRequests := dict -}} + {{- range $resource, $request := . -}} + {{- $defaultRequests = set $defaultRequests $resource (include "common.tplvalues.render" (dict "value" $request "context" $)) -}} + {{- end -}} + {{- $limits = set $limits "defaultRequest" $defaultRequests -}} {{- end -}} {{- end }} {{- end }} @@ -39,9 +47,11 @@ metadata: namespace: {{ $name }} labels: {{- include "common.labels.standard" $ | nindent 4 }} spec: - {{- $quotas := dict -}} {{- with $namespace.resources.quotas -}} - {{- $quotas = . }} + {{- $quotas := dict -}} + {{- range $resource, $quota := . -}} + {{- $quotas = set $quotas $resource (include "common.tplvalues.render" (dict "value" $quota "context" $)) -}} + {{- end }} hard: {{- $quotas | toYaml | nindent 4 }} {{- end }} {{- end }} diff --git a/charts/base-cluster/values.yaml b/charts/base-cluster/values.yaml index 314701aeb..5332e790f 100644 --- a/charts/base-cluster/values.yaml +++ b/charts/base-cluster/values.yaml @@ -10,17 +10,6 @@ global: condition: "{{ not (empty .Values.dns.provider) }}" additionalLabels: app.kubernetes.io/component: ingress - resources: - defaults: - requests: - cpu: 20m - memory: 100Mi - limits: - cpu: 100m - memory: 200Mi - quotas: - limits.cpu: "1" - limits.memory: 500Mi cert-manager: additionalLabels: app.kubernetes.io/component: cert-manager @@ -39,32 +28,10 @@ global: condition: "{{ .Values.ingress.enabled }}" additionalLabels: app.kubernetes.io/component: ingress - resources: - defaults: - requests: - cpu: 20m - memory: 100Mi - limits: - cpu: 100m - memory: 200Mi - quotas: - limits.cpu: "1" - limits.memory: 500Mi kyverno: condition: "{{ .Values.kyverno.enabled }}" additionalLabels: app.kubernetes.io/component: kyverno - resources: - defaults: - requests: - cpu: 350m - memory: 350Mi - limits: - cpu: 800m - memory: 800Mi - quotas: - limits.cpu: 1500m - limits.memory: 1500Mi monitoring: condition: "{{ or .Values.monitoring.prometheus.enabled .Values.monitoring.metricsServer.enabled }}" additionalLabels: @@ -74,12 +41,6 @@ global: requests: cpu: 20m memory: 100Mi - limits: - cpu: 100m - memory: 200Mi - quotas: - limits.cpu: "1" - limits.memory: 4000Mi loki: condition: "{{ .Values.monitoring.loki.enabled }}" additionalLabels: @@ -89,17 +50,6 @@ global: condition: "{{ .Values.monitoring.securityScanning.enabled }}" additionalLabels: app.kubernetes.io/component: security - resources: - defaults: - requests: - cpu: 100m - memory: 100Mi - limits: - cpu: 300m - memory: 1500Mi - quotas: - limits.cpu: 500Mi - limits.memory: 4Gi nfs-server-provisioner: condition: "{{ .Values.storage.readWriteMany.enabled }}" additionalLabels: @@ -109,17 +59,6 @@ global: condition: "{{ .Values.backup.enabled }}" additionalLabels: app.kubernetes.io/component: backup - resources: - defaults: - requests: - cpu: 100m - memory: 100Mi - limits: - cpu: 500m - memory: 500Mi - quotas: - limits.cpu: 1500Mi - limits.memory: 2Gi certificates: cluster-wildcard: dnsNames: |-