fix(resources): do not render zero-ed extra resources

This commit is contained in:
Stavros kois
2024-03-25 02:43:06 +02:00
parent e5638e8d27
commit 4fbb7f9a24
3 changed files with 5 additions and 3 deletions

View File

@@ -70,6 +70,7 @@ tests:
nvidia.com/gpu: 1
some-resource: 1
some-other-resource: 0
some-string-resource: "0"
asserts:
- documentIndex: &deploymentDoc 0
isKind:
@@ -87,7 +88,6 @@ tests:
memory: 4Gi
nvidia.com/gpu: 1
some-resource: 1
some-other-resource: 0
requests:
cpu: 10m
memory: 50Mi
@@ -132,7 +132,6 @@ tests:
limits:
cpu: 2000m
memory: 4Gi
some-resource: 0
some-other-resource: 2
requests:
cpu: 10m

View File

@@ -15,7 +15,7 @@ maintainers:
name: common
sources: null
type: library
version: 20.2.4
version: 20.2.5
annotations:
artifacthub.io/category: "integration-delivery"
artifacthub.io/license: "BUSL-1.1"

View File

@@ -37,6 +37,9 @@ limits:
{{- end -}}
{{- if not $objectData.resources.excludeExtra -}}
{{- range $k, $v := (omit $resources.limits "cpu" "memory") }} {{/* Omit cpu and memory, as they are handled above */}}
{{- if or (not $v) (eq (toString $v) "0") -}}
{{ continue }}
{{- end }}
{{ $k }}: {{ $v }}
{{- end -}}
{{- end -}}