From 54531ce059d1156a615749485e11e2f30143ea16 Mon Sep 17 00:00:00 2001 From: Kirill Buev Date: Mon, 10 Mar 2025 14:44:30 +0300 Subject: [PATCH] [bitnami/grafana-tempo] Add persistence options for Grafana Tempo metrics generator (#31495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [bitnami/grafana-tempo] Add persistence options for Grafana Tempo metrics generator Signed-off-by: Kirill Buev * Update CHANGELOG.md Signed-off-by: Bitnami Containers * Update CHANGELOG.md Signed-off-by: Bitnami Containers * Update CHANGELOG.md Signed-off-by: Bitnami Containers * Update CHANGELOG.md Signed-off-by: Bitnami Containers * Add major release notes at README.md Signed-off-by: Miguel Ruiz Signed-off-by: Miguel Ruiz --------- Signed-off-by: Kirill Buev Signed-off-by: Bitnami Containers Signed-off-by: Carlos Rodríguez Hernández Signed-off-by: Miguel Ruiz Co-authored-by: Bitnami Containers Co-authored-by: Carlos Rodríguez Hernández Co-authored-by: Miguel Ruiz --- bitnami/grafana-tempo/CHANGELOG.md | 8 ++- bitnami/grafana-tempo/Chart.yaml | 2 +- bitnami/grafana-tempo/README.md | 19 +++++- .../{deployment.yaml => statefulset.yaml} | 64 +++++++++++++++++-- bitnami/grafana-tempo/values.yaml | 42 ++++++++++++ 5 files changed, 127 insertions(+), 8 deletions(-) rename bitnami/grafana-tempo/templates/metrics-generator/{deployment.yaml => statefulset.yaml} (74%) diff --git a/bitnami/grafana-tempo/CHANGELOG.md b/bitnami/grafana-tempo/CHANGELOG.md index c735c69eef..2e8b8bdd7b 100644 --- a/bitnami/grafana-tempo/CHANGELOG.md +++ b/bitnami/grafana-tempo/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## 3.8.8 (2025-03-05) +## 4.0.0 (2025-03-10) -* [bitnami/grafana-tempo] Release 3.8.8 ([#32293](https://github.com/bitnami/charts/pull/32293)) +* [bitnami/grafana-tempo] Add persistence options for Grafana Tempo metrics generator ([#31495](https://github.com/bitnami/charts/pull/31495)) + +## 3.8.8 (2025-03-05) + +* [bitnami/grafana-tempo] Release 3.8.8 (#32293) ([db224f4](https://github.com/bitnami/charts/commit/db224f45293da4a8d9ef81b3e1620272f4e83c8c)), closes [#32293](https://github.com/bitnami/charts/issues/32293) ## 3.8.7 (2025-02-19) diff --git a/bitnami/grafana-tempo/Chart.yaml b/bitnami/grafana-tempo/Chart.yaml index a585e986f7..d7fa54aa78 100644 --- a/bitnami/grafana-tempo/Chart.yaml +++ b/bitnami/grafana-tempo/Chart.yaml @@ -39,4 +39,4 @@ maintainers: name: grafana-tempo sources: - https://github.com/bitnami/charts/tree/main/bitnami/grafana-tempo -version: 3.8.8 +version: 4.0.0 diff --git a/bitnami/grafana-tempo/README.md b/bitnami/grafana-tempo/README.md index 66e1920e73..9a2d4df177 100644 --- a/bitnami/grafana-tempo/README.md +++ b/bitnami/grafana-tempo/README.md @@ -519,6 +519,19 @@ The [Bitnami grafana-tempo](https://github.com/bitnami/containers/tree/main/bitn | `metricsGenerator.pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable. Defaults to `1` if both `metricsGenerator.pdb.minAvailable` and `metricsGenerator.pdb.maxUnavailable` are empty. | `""` | | `metricsGenerator.enableServiceLinks` | Whether information about services should be injected into pod's environment variable | `true` | +### Metrics Generator Persistence Parameters + +| Name | Description | Value | +| -------------------------------------------- | -------------------------------------------------------------------------------- | ------------------- | +| `metricsGenerator.persistence.enabled` | Enable persistence in Metrics Generator instances | `false` | +| `metricsGenerator.persistence.existingClaim` | Name of an existing PVC to use | `""` | +| `metricsGenerator.persistence.storageClass` | PVC Storage Class for Metrics Generator data volume | `""` | +| `metricsGenerator.persistence.subPath` | The subdirectory of the volume to mount to | `""` | +| `metricsGenerator.persistence.accessModes` | PVC Access modes | `["ReadWriteOnce"]` | +| `metricsGenerator.persistence.size` | PVC Storage Request for Metrics Generator data volume | `8Gi` | +| `metricsGenerator.persistence.annotations` | Additional PVC annotations | `{}` | +| `metricsGenerator.persistence.selector` | Selector to match an existing Persistent Volume for Metrics Generator's data PVC | `{}` | + ### Metrics Generator Traffic Exposure Parameters | Name | Description | Value | @@ -1109,6 +1122,10 @@ Find more information about how to deal with common errors related to Bitnami's ## Upgrading +### To 4.0.0 + +The `metrics-generator` component kind has switched from a 'Deployment' to a 'Statefulset'. More details at [Github issue](https://github.com/bitnami/charts/pull/31495). + ### To 3.8.0 This version introduces image verification for security purposes. To disable it, set `global.security.allowInsecureImages` to `true`. More details at [GitHub issue](https://github.com/bitnami/charts/issues/30850). @@ -1153,4 +1170,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. diff --git a/bitnami/grafana-tempo/templates/metrics-generator/deployment.yaml b/bitnami/grafana-tempo/templates/metrics-generator/statefulset.yaml similarity index 74% rename from bitnami/grafana-tempo/templates/metrics-generator/deployment.yaml rename to bitnami/grafana-tempo/templates/metrics-generator/statefulset.yaml index 393d19ca78..c8683c6237 100644 --- a/bitnami/grafana-tempo/templates/metrics-generator/deployment.yaml +++ b/bitnami/grafana-tempo/templates/metrics-generator/statefulset.yaml @@ -4,7 +4,7 @@ SPDX-License-Identifier: APACHE-2.0 */}} apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} -kind: Deployment +kind: StatefulSet metadata: name: {{ template "grafana-tempo.metrics-generator.fullname" . }} namespace: {{ .Release.Namespace | quote }} @@ -16,12 +16,13 @@ metadata: spec: replicas: {{ .Values.metricsGenerator.replicaCount }} {{- if .Values.metricsGenerator.updateStrategy }} - strategy: {{- toYaml .Values.metricsGenerator.updateStrategy | nindent 4 }} + updateStrategy: {{- toYaml .Values.metricsGenerator.updateStrategy | nindent 4 }} {{- end }} {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.metricsGenerator.podLabels .Values.commonLabels ) "context" . ) }} selector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: metrics-generator + serviceName: {{ template "grafana-tempo.metrics-generator.fullname" . }} template: metadata: annotations: @@ -70,6 +71,36 @@ spec: {{- if .Values.metricsGenerator.initContainers }} {{- include "common.tplvalues.render" (dict "value" .Values.metricsGenerator.initContainers "context" $) | nindent 8 }} {{- end }} + {{- if and .Values.volumePermissions.enabled .Values.metricsGenerator.persistence.enabled }} + - name: volume-permissions + image: {{ include "grafana-tempo.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - /bin/bash + args: + - -ec + - | + mkdir -p {{ .Values.tempo.dataDir }}{{- if .Values.metricsGenerator.persistence.subPath }}/{{ .Values.metricsGenerator.persistence.subPath }}{{- end }} + {{- if and .Values.metricsGenerator.podSecurityContext.enabled .Values.metricsGenerator.containerSecurityContext.enabled }} + find {{ .Values.tempo.dataDir }}{{- if .Values.metricsGenerator.persistence.subPath }}/{{ .Values.metricsGenerator.persistence.subPath }}{{- end }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.metricsGenerator.containerSecurityContext.runAsUser }}:{{ .Values.metricsGenerator.podSecurityContext.fsGroup }} + {{- end }} + {{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }} + securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }} + {{- else }} + securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.volumePermissions.resources }} + resources: {{- include "common.tplvalues.render" (dict "value" .Values.volumePermissions.resources "context" $) | nindent 12 }} + {{- else if ne .Values.volumePermissions.resourcesPreset "none" }} + resources: {{- include "common.resources.preset" (dict "type" .Values.volumePermissions.resourcesPreset) | nindent 12 }} + {{- end }} + volumeMounts: + - name: empty-dir + mountPath: /tmp + subPath: tmp-dir + - name: data + mountPath: {{ .Values.tempo.dataDir }} + {{- end }} containers: - name: grafana-tempo-metrics-generator image: {{ template "grafana-tempo.image" . }} @@ -164,8 +195,6 @@ spec: volumes: - name: empty-dir emptyDir: {} - - name: data - emptyDir: {} - name: tempo-config configMap: name: {{ template "grafana-tempo.tempoConfigmapName" . }} @@ -175,3 +204,30 @@ spec: {{- if .Values.metricsGenerator.extraVolumes }} {{- include "common.tplvalues.render" (dict "value" .Values.metricsGenerator.extraVolumes "context" $) | nindent 8 }} {{- end }} + {{- if not .Values.metricsGenerator.persistence.enabled }} + - name: data + emptyDir: {} + {{- else }} + volumeClaimTemplates: + - metadata: + name: data + {{- if or .Values.metricsGenerator.persistence.annotations .Values.commonAnnotations }} + {{- $claimAnnotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.metricsGenerator.persistence.annotations .Values.commonAnnotations ) "context" . ) }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $claimAnnotations "context" $) | nindent 10 }} + {{- end }} + {{- if .Values.commonLabels }} + labels: {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 10 }} + {{- end }} + spec: + accessModes: + {{- range .Values.metricsGenerator.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.metricsGenerator.persistence.size | quote }} + {{- if .Values.metricsGenerator.persistence.selector }} + selector: {{- include "common.tplvalues.render" (dict "value" .Values.metricsGenerator.persistence.selector "context" $) | nindent 10 }} + {{- end }} + {{- include "common.storage.class" (dict "persistence" .Values.metricsGenerator.persistence "global" .Values.global) | nindent 8 }} + {{- end }} diff --git a/bitnami/grafana-tempo/values.yaml b/bitnami/grafana-tempo/values.yaml index 98f91e2c14..6a85afb3d3 100644 --- a/bitnami/grafana-tempo/values.yaml +++ b/bitnami/grafana-tempo/values.yaml @@ -1271,6 +1271,48 @@ metricsGenerator: ## enableServiceLinks: true + ## @section Metrics Generator Persistence Parameters + + ## Enable persistence using Persistent Volume Claims + ## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/ + ## + persistence: + ## @param metricsGenerator.persistence.enabled Enable persistence in Metrics Generator instances + ## + enabled: false + ## @param metricsGenerator.persistence.existingClaim Name of an existing PVC to use + ## + existingClaim: "" + ## @param metricsGenerator.persistence.storageClass PVC Storage Class for Metrics Generator data volume + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + storageClass: "" + ## @param metricsGenerator.persistence.subPath The subdirectory of the volume to mount to + ## + subPath: "" + ## @param metricsGenerator.persistence.accessModes PVC Access modes + ## + accessModes: + - ReadWriteOnce + ## @param metricsGenerator.persistence.size PVC Storage Request for Metrics Generator data volume + ## + size: 8Gi + ## @param metricsGenerator.persistence.annotations Additional PVC annotations + ## + annotations: {} + ## @param metricsGenerator.persistence.selector Selector to match an existing Persistent Volume for Metrics Generator's data PVC + ## If set, the PVC can't have a PV dynamically provisioned for it + ## E.g. + ## selector: + ## matchLabels: + ## app: my-app + ## + selector: {} + ## @section Metrics Generator Traffic Exposure Parameters ## metricsGenerator service parameters