add more fields and tests

This commit is contained in:
Nikola Jokic
2026-01-15 21:24:52 +01:00
parent 0bb603edc8
commit a7a4eb481a
5 changed files with 284 additions and 3 deletions

View File

@@ -63,6 +63,41 @@ Takes a map of user labels and removes the ones with "actions.github.com/" prefi
{{- $processed | toYaml -}}
{{- end }}
{{/*
Takes a map of user annotations and removes reserved ones.
Reserved annotations are managed by ARC/controllers and should not be set by users:
- actions.github.com/cleanup-*
- actions.github.com/values-hash
*/}}
{{- define "gha-process-annotations" -}}
{{- $userAnnotations := . -}}
{{- $processed := dict -}}
{{- range $key, $value := $userAnnotations -}}
{{- if not (or (hasPrefix "actions.github.com/cleanup-" $key) (eq $key "actions.github.com/values-hash")) -}}
{{- $_ := set $processed $key $value -}}
{{- end -}}
{{- end -}}
{{- $processed | toYaml -}}
{{- end }}
{{/*
Create the annotations for the autoscaling runner set.
Order of precedence:
1) resource.all.metadata.annotations
2) resource.autoscalingRunnerSet.metadata.annotations
Reserved annotations are excluded from both levels.
*/}}
{{- define "autoscaling-runner-set.annotations" -}}
{{- $global := include "gha-process-annotations" (.Values.resource.all.metadata.annotations | default (dict)) | fromYaml -}}
{{- $resource := include "gha-process-annotations" (.Values.resource.autoscalingRunnerSet.metadata.annotations | default (dict)) | fromYaml -}}
{{- $annotations := mergeOverwrite $global $resource -}}
{{- range $k, $v := $annotations }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}

View File

@@ -5,6 +5,9 @@ metadata:
namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
labels:
{{- include "autoscaling-runner-set.labels" . | nindent 4 }}
annotations:
{{- include "autoscaling-runner-set.annotations" . | nindent 4 }}
actions.github.com/values-hash: {{ toJson .Values | sha256sum | trunc 63 }}
spec:
githubConfigUrl: {{ required ".Values.auth.url is required" (trimSuffix "/" .Values.auth.url) | quote }}
@@ -36,7 +39,7 @@ spec:
certificatePath: {{ .Values.secretResolution.azureKeyVault.certificatePath }}
secretKey: {{ .Values.secretResolution.azureKeyVault.secretKey }}
{{- else }}
{{- fail "Unsupported keyVault type: " .Values.secretResolution.type }}
{{- fail (printf "Unsupported keyVault type: %s" .Values.secretResolution.type) }}
{{- end }}
{{- end }}
@@ -93,5 +96,4 @@ spec:
template:
spec:
containers:
# {{- include "container-spec.runner" . | nindent 8 }}
containers: