From c8aacdc251f220a3c7b350e15e48423f13ad762c Mon Sep 17 00:00:00 2001 From: manidharanupoju24 Date: Thu, 21 Dec 2023 13:01:26 -0600 Subject: [PATCH] feat(testkube): add custom labels and annotations through testkube-api helm chart --- ...mplate.yml.tmpl => job-template-spec.yml.tmpl} | 5 ----- charts/testkube-api/templates/configmap.yaml | 15 ++++++++++++++- charts/testkube-api/values.yaml | 8 ++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) rename charts/testkube-api/{job-template.yml.tmpl => job-template-spec.yml.tmpl} (97%) diff --git a/charts/testkube-api/job-template.yml.tmpl b/charts/testkube-api/job-template-spec.yml.tmpl similarity index 97% rename from charts/testkube-api/job-template.yml.tmpl rename to charts/testkube-api/job-template-spec.yml.tmpl index e35d5c080..8849b8747 100644 --- a/charts/testkube-api/job-template.yml.tmpl +++ b/charts/testkube-api/job-template-spec.yml.tmpl @@ -1,8 +1,3 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: "{{ .Name }}" - namespace: {{ .Namespace }} spec: {{- if gt .ActiveDeadlineSeconds 0 }} activeDeadlineSeconds: {{ .ActiveDeadlineSeconds }} diff --git a/charts/testkube-api/templates/configmap.yaml b/charts/testkube-api/templates/configmap.yaml index c73b50560..e529cf337 100644 --- a/charts/testkube-api/templates/configmap.yaml +++ b/charts/testkube-api/templates/configmap.yaml @@ -20,7 +20,20 @@ data: {{- if .Values.configValues }} {{ toYaml .Values.configValues | trimAll "|" | trim | indent 4 }} {{- else }} -{{ .Files.Get "job-template.yml.tmpl" | indent 4 }} + apiVersion: batch/v1 + kind: Job + metadata: + name: {{ printf "\"{{ .Name }}\"" }} + namespace: {{ printf "{{ .Namespace }}" }} + {{- if .Values.templates.labels }} + labels: + {{- include "global.tplvalues.render" ( dict "value" .Values.templates.labels "context" $ ) | nindent 8 }} + {{- end }} + {{- if .Values.templates.annotations }} + annotations: + {{- include "global.tplvalues.render" ( dict "value" .Values.templates.annotations "context" $ ) | nindent 8 }} + {{- end }} +{{ .Files.Get "job-template-spec.yml.tmpl" | indent 4 }} {{- end }} pvc-template.yml: |- {{ .Files.Get "pvc-template.yml.tmpl" | indent 4 }} diff --git a/charts/testkube-api/values.yaml b/charts/testkube-api/values.yaml index 3a5eab32a..2896ba8ee 100644 --- a/charts/testkube-api/values.yaml +++ b/charts/testkube-api/values.yaml @@ -116,8 +116,12 @@ templates: scraperContainer: "" ## Base64 encoded PVC Container template pvcContainer: "" - ## Base64 encoded Slave Pod template - slavePod: "" + ## Base64 encoded Slave Pod template + slavePod: "" + ## Map of labels to apply to the default Job template + labels: {} + ## Map of annotations to apply to the default Job template + annotations: {} ## base64 encoded executors.json alike data executors: ""