From 3a41416a91d8e748e1ac2990c460c067eefbabad Mon Sep 17 00:00:00 2001 From: "jiaquan.xu" Date: Tue, 27 Jun 2023 16:49:52 +0000 Subject: [PATCH 1/7] update labels --- .../templates/deployment.yaml.tpl | 1 + charts/agent-stack-k8s/values.schema.json | 19 +++++++++++++++++++ charts/agent-stack-k8s/values.yaml | 3 +++ 3 files changed, 23 insertions(+) diff --git a/charts/agent-stack-k8s/templates/deployment.yaml.tpl b/charts/agent-stack-k8s/templates/deployment.yaml.tpl index 39eece02..bf2b08ec 100644 --- a/charts/agent-stack-k8s/templates/deployment.yaml.tpl +++ b/charts/agent-stack-k8s/templates/deployment.yaml.tpl @@ -11,6 +11,7 @@ spec: metadata: labels: app: {{ .Release.Name }} + {{- toYaml $.Values.labels | nindent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml.tpl") . | sha256sum }} checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml.tpl") . | sha256sum }} diff --git a/charts/agent-stack-k8s/values.schema.json b/charts/agent-stack-k8s/values.schema.json index 9b15dd30..bdc66081 100644 --- a/charts/agent-stack-k8s/values.schema.json +++ b/charts/agent-stack-k8s/values.schema.json @@ -36,6 +36,25 @@ } ] }, + "labels": { + "type": "object", + "default": {}, + "title": "The labels Schema", + "additionalProperties": { + "type": "object", + "default": {} + }, + "example": [ + { + "user": { + "user": "name" + }, + "project": { + "project": "project" + } + } + ] + }, "resources": { "type": "object", "default": {}, diff --git a/charts/agent-stack-k8s/values.yaml b/charts/agent-stack-k8s/values.yaml index 9b202fc2..83dd7c26 100644 --- a/charts/agent-stack-k8s/values.yaml +++ b/charts/agent-stack-k8s/values.yaml @@ -10,3 +10,6 @@ resources: requests: cpu: 100m memory: 100Mi + +labels: + user: "user" From cd5c0db3176617fdd42818a13b087acc48ffdaa6 Mon Sep 17 00:00:00 2001 From: "jiaquan.xu" Date: Thu, 29 Jun 2023 21:33:39 +0000 Subject: [PATCH 2/7] add helper --- charts/agent-stack-k8s/templates/_helper.tpl | 6 ++++++ charts/agent-stack-k8s/templates/deployment.yaml.tpl | 3 +-- charts/agent-stack-k8s/values.schema.json | 12 ++++-------- charts/agent-stack-k8s/values.yaml | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 charts/agent-stack-k8s/templates/_helper.tpl diff --git a/charts/agent-stack-k8s/templates/_helper.tpl b/charts/agent-stack-k8s/templates/_helper.tpl new file mode 100644 index 00000000..9d6fe2e4 --- /dev/null +++ b/charts/agent-stack-k8s/templates/_helper.tpl @@ -0,0 +1,6 @@ +{{/* Generate basic labels */}} +{{- define "mychart.labels" }} + labels: + app: {{ .Release.Name }} + {{- toYaml $.Values.labels | nindent 8 }} +{{- end }} \ No newline at end of file diff --git a/charts/agent-stack-k8s/templates/deployment.yaml.tpl b/charts/agent-stack-k8s/templates/deployment.yaml.tpl index bf2b08ec..81edb69f 100644 --- a/charts/agent-stack-k8s/templates/deployment.yaml.tpl +++ b/charts/agent-stack-k8s/templates/deployment.yaml.tpl @@ -10,8 +10,7 @@ spec: template: metadata: labels: - app: {{ .Release.Name }} - {{- toYaml $.Values.labels | nindent 8 }} + {{- template "mychart.labels" }} annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml.tpl") . | sha256sum }} checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml.tpl") . | sha256sum }} diff --git a/charts/agent-stack-k8s/values.schema.json b/charts/agent-stack-k8s/values.schema.json index bdc66081..65768a27 100644 --- a/charts/agent-stack-k8s/values.schema.json +++ b/charts/agent-stack-k8s/values.schema.json @@ -41,17 +41,13 @@ "default": {}, "title": "The labels Schema", "additionalProperties": { - "type": "object", - "default": {} + "type": "string", + "default": "" }, "example": [ { - "user": { - "user": "name" - }, - "project": { - "project": "project" - } + "user": "name", + "project": "project" } ] }, diff --git a/charts/agent-stack-k8s/values.yaml b/charts/agent-stack-k8s/values.yaml index 83dd7c26..81783fb5 100644 --- a/charts/agent-stack-k8s/values.yaml +++ b/charts/agent-stack-k8s/values.yaml @@ -11,5 +11,5 @@ resources: cpu: 100m memory: 100Mi -labels: - user: "user" +labels: {} + From bad2705aa91d58a62afe8d41212020c421ce67d6 Mon Sep 17 00:00:00 2001 From: "jiaquan.xu" Date: Fri, 30 Jun 2023 18:49:36 +0000 Subject: [PATCH 3/7] update label app --- charts/agent-stack-k8s/templates/_helper.tpl | 6 +++--- charts/agent-stack-k8s/templates/deployment.yaml.tpl | 2 +- charts/agent-stack-k8s/values.schema.json | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/agent-stack-k8s/templates/_helper.tpl b/charts/agent-stack-k8s/templates/_helper.tpl index 9d6fe2e4..87541958 100644 --- a/charts/agent-stack-k8s/templates/_helper.tpl +++ b/charts/agent-stack-k8s/templates/_helper.tpl @@ -1,6 +1,6 @@ {{/* Generate basic labels */}} -{{- define "mychart.labels" }} - labels: +{{- define "agent-stack-k8s.labels" }} + labels: + {{- toYaml $.Values.labels }} app: {{ .Release.Name }} - {{- toYaml $.Values.labels | nindent 8 }} {{- end }} \ No newline at end of file diff --git a/charts/agent-stack-k8s/templates/deployment.yaml.tpl b/charts/agent-stack-k8s/templates/deployment.yaml.tpl index 81edb69f..cddf6b58 100644 --- a/charts/agent-stack-k8s/templates/deployment.yaml.tpl +++ b/charts/agent-stack-k8s/templates/deployment.yaml.tpl @@ -10,7 +10,7 @@ spec: template: metadata: labels: - {{- template "mychart.labels" }} +{{- include "agent-stack-k8s.labels" | indent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml.tpl") . | sha256sum }} checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml.tpl") . | sha256sum }} diff --git a/charts/agent-stack-k8s/values.schema.json b/charts/agent-stack-k8s/values.schema.json index 65768a27..bd1162a1 100644 --- a/charts/agent-stack-k8s/values.schema.json +++ b/charts/agent-stack-k8s/values.schema.json @@ -40,6 +40,8 @@ "type": "object", "default": {}, "title": "The labels Schema", + "description": "label app is reserved, user input lable app is not allowed", + "not": { "required": [ "app" ] }, "additionalProperties": { "type": "string", "default": "" From ff97ebc5445b4c43d0954f766c63ef685938edc2 Mon Sep 17 00:00:00 2001 From: Jiaquan Xu <51104986+jiaquan1@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:31:29 -0700 Subject: [PATCH 4/7] Update charts/agent-stack-k8s/values.schema.json Co-authored-by: Narthana Epa --- charts/agent-stack-k8s/values.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/agent-stack-k8s/values.schema.json b/charts/agent-stack-k8s/values.schema.json index bd1162a1..a702439d 100644 --- a/charts/agent-stack-k8s/values.schema.json +++ b/charts/agent-stack-k8s/values.schema.json @@ -40,7 +40,7 @@ "type": "object", "default": {}, "title": "The labels Schema", - "description": "label app is reserved, user input lable app is not allowed", + "description": "label app is reserved, user input label app is not allowed", "not": { "required": [ "app" ] }, "additionalProperties": { "type": "string", From d24dabe8b2ec7a7dc93e92d7987f1e8b208b4b70 Mon Sep 17 00:00:00 2001 From: Jiaquan Xu <51104986+jiaquan1@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:31:42 -0700 Subject: [PATCH 5/7] Update charts/agent-stack-k8s/templates/deployment.yaml.tpl Co-authored-by: Narthana Epa --- charts/agent-stack-k8s/templates/deployment.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/agent-stack-k8s/templates/deployment.yaml.tpl b/charts/agent-stack-k8s/templates/deployment.yaml.tpl index cddf6b58..59294db1 100644 --- a/charts/agent-stack-k8s/templates/deployment.yaml.tpl +++ b/charts/agent-stack-k8s/templates/deployment.yaml.tpl @@ -10,7 +10,7 @@ spec: template: metadata: labels: -{{- include "agent-stack-k8s.labels" | indent 8 }} +{{- include "agent-stack-k8s.labels" . | indent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml.tpl") . | sha256sum }} checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml.tpl") . | sha256sum }} From 1a16c2a8a21c89ff969d64e187a6d92eeb9872ce Mon Sep 17 00:00:00 2001 From: Jiaquan Xu <51104986+jiaquan1@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:33:00 -0700 Subject: [PATCH 6/7] Update _helper.tpl --- charts/agent-stack-k8s/templates/_helper.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/agent-stack-k8s/templates/_helper.tpl b/charts/agent-stack-k8s/templates/_helper.tpl index 87541958..101ba90b 100644 --- a/charts/agent-stack-k8s/templates/_helper.tpl +++ b/charts/agent-stack-k8s/templates/_helper.tpl @@ -3,4 +3,4 @@ labels: {{- toYaml $.Values.labels }} app: {{ .Release.Name }} -{{- end }} \ No newline at end of file +{{- end }} From 019e8fff1fd85569660109d4a6ab80d252f0f5da Mon Sep 17 00:00:00 2001 From: "jiaquan.xu" Date: Tue, 4 Jul 2023 04:49:59 +0000 Subject: [PATCH 7/7] update indent --- charts/agent-stack-k8s/templates/_helper.tpl | 7 +++---- charts/agent-stack-k8s/templates/deployment.yaml.tpl | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/charts/agent-stack-k8s/templates/_helper.tpl b/charts/agent-stack-k8s/templates/_helper.tpl index 101ba90b..598b74f0 100644 --- a/charts/agent-stack-k8s/templates/_helper.tpl +++ b/charts/agent-stack-k8s/templates/_helper.tpl @@ -1,6 +1,5 @@ {{/* Generate basic labels */}} -{{- define "agent-stack-k8s.labels" }} - labels: - {{- toYaml $.Values.labels }} - app: {{ .Release.Name }} +{{- define "agent-stack-k8s.labels" }} +{{- toYaml $.Values.labels }} +app: {{ .Release.Name }} {{- end }} diff --git a/charts/agent-stack-k8s/templates/deployment.yaml.tpl b/charts/agent-stack-k8s/templates/deployment.yaml.tpl index 59294db1..569a159b 100644 --- a/charts/agent-stack-k8s/templates/deployment.yaml.tpl +++ b/charts/agent-stack-k8s/templates/deployment.yaml.tpl @@ -10,7 +10,7 @@ spec: template: metadata: labels: -{{- include "agent-stack-k8s.labels" . | indent 8 }} +{{- include "agent-stack-k8s.labels" . | nindent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml.tpl") . | sha256sum }} checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml.tpl") . | sha256sum }}