From aeec18029090e374ed0f85d82d3863f2a0c6a8f1 Mon Sep 17 00:00:00 2001 From: "jerry.fang" Date: Fri, 26 Apr 2024 11:28:22 +0800 Subject: [PATCH 1/2] feat(): add cost tag for cronjobs --- cronjob/Chart.yaml | 2 +- cronjob/templates/_argo_cron_workflow.tpl | 2 ++ cronjob/templates/_k8s_cronjob.tpl | 4 ++++ cronjob/templates/cronjob.yaml | 2 ++ cronjob/values.yaml | 5 +++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cronjob/Chart.yaml b/cronjob/Chart.yaml index d2e8690d..227ab753 100644 --- a/cronjob/Chart.yaml +++ b/cronjob/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 description: Helm chart with simple cronjob template name: cronjob -version: 0.7.5 +version: 0.7.6 appVersion: 1.0.0 tillerVersion: ">=2.14.3" diff --git a/cronjob/templates/_argo_cron_workflow.tpl b/cronjob/templates/_argo_cron_workflow.tpl index 0ba0ff54..6fad4e42 100644 --- a/cronjob/templates/_argo_cron_workflow.tpl +++ b/cronjob/templates/_argo_cron_workflow.tpl @@ -3,6 +3,7 @@ podMetadata: labels: name: {{ .Values.name }} + businessid: {{ .Values.businessid | quote }} annotations: {{- range $key, $value := .Values.annotations }} {{ $key | quote }} : {{ $value | quote }} @@ -10,6 +11,7 @@ workflowMetadata: labels: name: {{ .Values.name }} + businessid: {{ .Values.businessid | quote }} annotations: {{- range $key, $value := .Values.annotations }} {{ $key | quote }} : {{ $value | quote }} diff --git a/cronjob/templates/_k8s_cronjob.tpl b/cronjob/templates/_k8s_cronjob.tpl index 6418d55f..5d77a2a2 100644 --- a/cronjob/templates/_k8s_cronjob.tpl +++ b/cronjob/templates/_k8s_cronjob.tpl @@ -1,6 +1,8 @@ {{- define "cronjob.k8s_cronjob" -}} jobTemplate: metadata: + labels: + businessid: {{ .Values.businessid | quote }} annotations: cronjob_name: {{ .Values.name }} spec: @@ -8,6 +10,8 @@ activeDeadlineSeconds: {{ .Values.job.timeout }} template: metadata: + labels: + businessid: {{ .Values.businessid | quote }} annotations: cronjob_name: {{ .Values.name }} {{- range $key, $value := .Values.annotations }} diff --git a/cronjob/templates/cronjob.yaml b/cronjob/templates/cronjob.yaml index d835bab0..da9a8a7e 100644 --- a/cronjob/templates/cronjob.yaml +++ b/cronjob/templates/cronjob.yaml @@ -10,6 +10,8 @@ kind: CronJob metadata: name: {{ .Values.name }} namespace: {{ .Release.Namespace }} + labels: + businessid: {{ $.Values.businessid | quote}} spec: schedule: {{ .Values.schedule | quote }} # If "kind" eq to "CronWorkflow", timezone can be set. If "kind" eq to "CronWorkflow" and timezone are not set, "Asia/Taipei" will be used diff --git a/cronjob/values.yaml b/cronjob/values.yaml index 833d9e34..8267e3ae 100644 --- a/cronjob/values.yaml +++ b/cronjob/values.yaml @@ -17,6 +17,11 @@ kind: "CronJob" # Starting Deadline Seconds of cron job. Will be assign to spec.startingDeadlineSeconds. startingDeadlineSeconds: {} +# counting cost by team +businessid: "" +# example +# businessid: "000000042462041525" + job: # Number of retries if error occurred retries: 1 From 42e410d52ed8e7f9ab5d3bf6dc385d92c874c900 Mon Sep 17 00:00:00 2001 From: "jerry.fang" Date: Thu, 2 May 2024 14:21:03 +0800 Subject: [PATCH 2/2] feat(): change version --- cronjob/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronjob/Chart.yaml b/cronjob/Chart.yaml index 227ab753..80a1ec6d 100644 --- a/cronjob/Chart.yaml +++ b/cronjob/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 description: Helm chart with simple cronjob template name: cronjob -version: 0.7.6 +version: 0.8.0 appVersion: 1.0.0 tillerVersion: ">=2.14.3"