Skip to content

Commit

Permalink
feat(base-cluster/limitrange-quotas): add default values to every nam…
Browse files Browse the repository at this point in the history
…espace
  • Loading branch information
marvinWolff committed Dec 13, 2023
1 parent e12f272 commit 8552925
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions charts/base-cluster/templates/global/namespaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,28 @@ metadata:
{{- with $namespace.additionalLabels -}}
{{- . | toYaml | nindent 4 -}}
{{- end }}
{{ if $namespace.resources }}
---
{{- if $namespace.resources.defaults }}
apiVersion: v1
kind: LimitRange
metadata:
name: {{ $name }}
namespace: {{ $name }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
spec:
{{- $limits := dict "type" "Container" -}}
{{/* this section defines default limits */}}
{{- with $namespace.resources.defaults.limits -}}
{{- $limits = set $limits "default" . -}}
{{- end -}}

{{/* this section defines default requests */}}
{{- with $namespace.resources.defaults.requests -}}
{{- $limits = set $limits "defaultRequest" . -}}
{{- $limits := dict "type" "Container" "defaultRequest" (dict "cpu" "100m" "memory" "100Mi") -}}
{{ if $namespace.resources }}
{{- if $namespace.resources.defaults -}}
{{/* this section defines default limits */}}
{{- with $namespace.resources.defaults.limits -}}
{{- $limits = set $limits "default" . -}}
{{- end -}}
{{/* this section defines default requests */}}
{{- with $namespace.resources.defaults.requests -}}
{{- $limits = set $limits "defaultRequest" . -}}
{{- end -}}
{{- end }}
{{- end }}
limits: {{- list $limits | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{ if $namespace.resources }}
{{ if $namespace.resources.quotas }}
---
Expand Down

0 comments on commit 8552925

Please sign in to comment.