The Deployment metadata inlined the annotation and label logic with nested `if` blocks, which duplicated the fallback handling and made the empty-value cases hard to follow. Moving the rendering into `gitea.deployment.annotations` and `gitea.deployment.labels` keeps the manifest declarative and allows other resources to reuse the same merge semantics later on. The helpers are consumed through `with (include ... | fromYaml)` so that an empty result never emits a dangling `annotations:` key. Labels always render because `gitea.labels` is never empty, which keeps Argo CD from reporting drift. Inside the label helper the user labels are appended with an untrimmed newline, otherwise they would be concatenated onto the last line of `gitea.labels` and `fromYaml` would silently return an `Error` map instead of failing the render. The metadata attributes are additionally sorted alphabetically to follow the chart conventions. Unit tests now cover the previously untested `deployment.annotations` value and assert that the base labels keep rendering despite the new `with` guard. Co-authored-by: Copilot <copilot@github.com>
16 lines
316 B
Smarty
16 lines
316 B
Smarty
{{/* annotations */}}
|
|
|
|
{{- define "gitea.deployment.annotations" -}}
|
|
{{- with .Values.deployment.annotations }}
|
|
{{- toYaml . -}}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/* labels */}}
|
|
|
|
{{- define "gitea.deployment.labels" -}}
|
|
{{ include "gitea.labels" . }}
|
|
{{- with .Values.deployment.labels }}
|
|
{{ toYaml . }}
|
|
{{- end }}
|
|
{{- end }} |