From a6a1724f51d493a39a0d0aec90c6ea058749fc79 Mon Sep 17 00:00:00 2001 From: Andrew Kroenert Date: Thu, 29 Oct 2020 10:03:08 +1100 Subject: [PATCH 1/5] Pass additional Statefulset labels and any Annotations from values.yaml This addition to the statefulset template and values file allows custom labels to be passed into the metadata labels block AND annotations. Our usecase for annotations is to set our vault providers (vault.security.banzaicloud.io) vault-role for permission to get any secretes required (in this case, credentials.password) CLOUD-589 --- helm/pmm-server/templates/statefulset.yaml | 7 +++++++ helm/pmm-server/values.yaml | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/helm/pmm-server/templates/statefulset.yaml b/helm/pmm-server/templates/statefulset.yaml index efcd58e..dc1df2e 100644 --- a/helm/pmm-server/templates/statefulset.yaml +++ b/helm/pmm-server/templates/statefulset.yaml @@ -7,6 +7,13 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" +{{- if .Values.statefulSet.labels }} +{{ toYaml .Values.statefulSet.labels | indent 4 }} +{{- end }} + {{- with .Values.statefulSet.annotations }} + annotations: +{{ toYaml . | indent 4 }} + {{- end }} spec: serviceName: {{ template "percona.fullname" . }} replicas: 1 diff --git a/helm/pmm-server/values.yaml b/helm/pmm-server/values.yaml index 956cf52..ccb4c37 100644 --- a/helm/pmm-server/values.yaml +++ b/helm/pmm-server/values.yaml @@ -54,3 +54,8 @@ service: prometheus: configMap: name: "" + +## Pass Statefulset Annotations +statefulSet: + annotations: {} + labels: {} \ No newline at end of file From 8e87c088d80f742dc71ab9779195fe7a38d98684 Mon Sep 17 00:00:00 2001 From: Andrew Kroenert Date: Thu, 29 Oct 2020 10:16:15 +1100 Subject: [PATCH 2/5] Add options to readme, cleanup values, fix indenting Add options to the readme page Add new line in values EOF and edit comment to explain labels Change auto-indenting from editor on annotations with loop CLOUD-589 --- helm/pmm-server/README.md | 2 ++ helm/pmm-server/templates/statefulset.yaml | 4 ++-- helm/pmm-server/values.yaml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/helm/pmm-server/README.md b/helm/pmm-server/README.md index 1527f94..c4f1db3 100644 --- a/helm/pmm-server/README.md +++ b/helm/pmm-server/README.md @@ -45,6 +45,8 @@ The following tables lists the configurable parameters of the Percona chart and | `service.type` | Option specifying the [Kubernetes Service type](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) to be used | "" | | `service.loadBalancerIP` | IP address for the public access | "" | | `prometheus.configMap.name` | Name of k8s configMap with scrape_configs | "" | +| `statefulSet.labels` | Additional labels for the statefulset | "" | +| `statefulSet.annotations` | Annotations for the statefulset | "" | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. diff --git a/helm/pmm-server/templates/statefulset.yaml b/helm/pmm-server/templates/statefulset.yaml index dc1df2e..aa65960 100644 --- a/helm/pmm-server/templates/statefulset.yaml +++ b/helm/pmm-server/templates/statefulset.yaml @@ -10,10 +10,10 @@ metadata: {{- if .Values.statefulSet.labels }} {{ toYaml .Values.statefulSet.labels | indent 4 }} {{- end }} - {{- with .Values.statefulSet.annotations }} +{{- with .Values.statefulSet.annotations }} annotations: {{ toYaml . | indent 4 }} - {{- end }} +{{- end }} spec: serviceName: {{ template "percona.fullname" . }} replicas: 1 diff --git a/helm/pmm-server/values.yaml b/helm/pmm-server/values.yaml index ccb4c37..a584ed7 100644 --- a/helm/pmm-server/values.yaml +++ b/helm/pmm-server/values.yaml @@ -55,7 +55,7 @@ prometheus: configMap: name: "" -## Pass Statefulset Annotations +## Set Statefulset Labels and Annotations statefulSet: annotations: {} - labels: {} \ No newline at end of file + labels: {} From 22d5535a2365bb208ac368d2f854b7a2a40edf95 Mon Sep 17 00:00:00 2001 From: Andrew Kroenert Date: Tue, 3 Nov 2020 08:36:13 +1100 Subject: [PATCH 3/5] CLOUD-589 Add annotations and labels for the underlying pod --- helm/pmm-server/README.md | 2 ++ helm/pmm-server/templates/statefulset.yaml | 7 +++++++ helm/pmm-server/values.yaml | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/helm/pmm-server/README.md b/helm/pmm-server/README.md index c4f1db3..386391e 100644 --- a/helm/pmm-server/README.md +++ b/helm/pmm-server/README.md @@ -47,6 +47,8 @@ The following tables lists the configurable parameters of the Percona chart and | `prometheus.configMap.name` | Name of k8s configMap with scrape_configs | "" | | `statefulSet.labels` | Additional labels for the statefulset | "" | | `statefulSet.annotations` | Annotations for the statefulset | "" | +| `podTemplate.labels` | Additional labels to be passed to the underlying Pod | "" | +| `podTemplate.annotations` | Annotations for the Pod | "" | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. diff --git a/helm/pmm-server/templates/statefulset.yaml b/helm/pmm-server/templates/statefulset.yaml index aa65960..74d38e9 100644 --- a/helm/pmm-server/templates/statefulset.yaml +++ b/helm/pmm-server/templates/statefulset.yaml @@ -28,6 +28,13 @@ spec: labels: app: {{ template "percona.fullname" . }} component: pmm +{{- if .Values.podTemplate.labels }} +{{ toYaml .Values.podTemplate.labels | indent 8 }} +{{- end }} +{{- with .Values.podTemplate.annotations }} + annotations: +{{ toYaml . | indent 8 }} +{{- end }} spec: securityContext: supplementalGroups: [1000] diff --git a/helm/pmm-server/values.yaml b/helm/pmm-server/values.yaml index a584ed7..3e78312 100644 --- a/helm/pmm-server/values.yaml +++ b/helm/pmm-server/values.yaml @@ -59,3 +59,8 @@ prometheus: statefulSet: annotations: {} labels: {} + +## Set Pod Labels and Annotations +podTemplate: + annotations: {} + labels: {} From 80f4c175be13c46527391f3c38afe3ef2ec6df0c Mon Sep 17 00:00:00 2001 From: Andrew Kroenert Date: Tue, 3 Nov 2020 09:28:59 +1100 Subject: [PATCH 4/5] CLOUD-589 Move podTemplate values under statefulSet namespace for clarity --- helm/pmm-server/README.md | 4 ++-- helm/pmm-server/templates/statefulset.yaml | 4 ++-- helm/pmm-server/values.yaml | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/helm/pmm-server/README.md b/helm/pmm-server/README.md index 386391e..6f7d711 100644 --- a/helm/pmm-server/README.md +++ b/helm/pmm-server/README.md @@ -47,8 +47,8 @@ The following tables lists the configurable parameters of the Percona chart and | `prometheus.configMap.name` | Name of k8s configMap with scrape_configs | "" | | `statefulSet.labels` | Additional labels for the statefulset | "" | | `statefulSet.annotations` | Annotations for the statefulset | "" | -| `podTemplate.labels` | Additional labels to be passed to the underlying Pod | "" | -| `podTemplate.annotations` | Annotations for the Pod | "" | +| `statefulSet.podTemplate.labels` | Additional labels to be passed to the underlying Pod | "" | +| `statefulSet.podTemplate.annotations` | Annotations for the Pod | "" | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. diff --git a/helm/pmm-server/templates/statefulset.yaml b/helm/pmm-server/templates/statefulset.yaml index 74d38e9..b252b15 100644 --- a/helm/pmm-server/templates/statefulset.yaml +++ b/helm/pmm-server/templates/statefulset.yaml @@ -28,10 +28,10 @@ spec: labels: app: {{ template "percona.fullname" . }} component: pmm -{{- if .Values.podTemplate.labels }} +{{- if .Values.statefulSet.podTemplate.labels }} {{ toYaml .Values.podTemplate.labels | indent 8 }} {{- end }} -{{- with .Values.podTemplate.annotations }} +{{- with .Values.statefulSet.podTemplate.annotations }} annotations: {{ toYaml . | indent 8 }} {{- end }} diff --git a/helm/pmm-server/values.yaml b/helm/pmm-server/values.yaml index 3e78312..eff2dd9 100644 --- a/helm/pmm-server/values.yaml +++ b/helm/pmm-server/values.yaml @@ -59,8 +59,7 @@ prometheus: statefulSet: annotations: {} labels: {} - -## Set Pod Labels and Annotations -podTemplate: - annotations: {} - labels: {} + ## Set Pod Labels and Annotations + podTemplate: + annotations: {} + labels: {} From dcf3fa07412d7a6534991674322d058c7aef1324 Mon Sep 17 00:00:00 2001 From: Andrew Kroenert Date: Tue, 3 Nov 2020 09:34:22 +1100 Subject: [PATCH 5/5] CLOUD-589 Move podTemplate values under statefulSet namespace for clarity --- helm/pmm-server/templates/statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/pmm-server/templates/statefulset.yaml b/helm/pmm-server/templates/statefulset.yaml index b252b15..57cc3be 100644 --- a/helm/pmm-server/templates/statefulset.yaml +++ b/helm/pmm-server/templates/statefulset.yaml @@ -29,7 +29,7 @@ spec: app: {{ template "percona.fullname" . }} component: pmm {{- if .Values.statefulSet.podTemplate.labels }} -{{ toYaml .Values.podTemplate.labels | indent 8 }} +{{ toYaml .Values.statefulSet.podTemplate.labels | indent 8 }} {{- end }} {{- with .Values.statefulSet.podTemplate.annotations }} annotations: