diff --git a/chart/openfaas/README.md b/chart/openfaas/README.md index aa0f26dff..5dc9973bd 100644 --- a/chart/openfaas/README.md +++ b/chart/openfaas/README.md @@ -651,4 +651,6 @@ For legacy scaling in OpenFaaS Community Edition. | ----------------------- | ---------------------------------- | ---------------------------------------------------------- | | `prometheus.create` | Create the Prometheus component | `true` | | `prometheus.image` | Container image used for prometheus | See [values.yaml](./values.yaml) | +| `prometheus.retention.time` | When to remove old data from the prometheus db. | `15d` | +| `prometheus.retention.size` | The maximum number of bytes of storage blocks to retain. Units supported: B, KB, MB, GB, TB, PB, EB. 0 meaning disabled. See: [Prometheus storage](https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects)| `0` | | `prometheus.resources` | Resource limits and requests for prometheus containers | See [values.yaml](./values.yaml) | diff --git a/chart/openfaas/templates/prometheus-dep.yaml b/chart/openfaas/templates/prometheus-dep.yaml index 32521434c..a227ee431 100644 --- a/chart/openfaas/templates/prometheus-dep.yaml +++ b/chart/openfaas/templates/prometheus-dep.yaml @@ -37,6 +37,12 @@ spec: command: - "prometheus" - "--config.file=/etc/prometheus/prometheus.yml" + {{- if .Values.prometheus.retention.time }} + - "--storage.tsdb.retention.time={{.Values.prometheus.retention.time}}" + {{- end }} + {{- if .Values.prometheus.retention.size }} + - "--storage.tsdb.retention.size={{.Values.prometheus.retention.size}}" + {{- end }} imagePullPolicy: {{ .Values.openfaasImagePullPolicy }} livenessProbe: {{- if .Values.httpProbe }} diff --git a/chart/openfaas/values.yaml b/chart/openfaas/values.yaml index dce5efe1b..d7537e7f0 100644 --- a/chart/openfaas/values.yaml +++ b/chart/openfaas/values.yaml @@ -331,6 +331,8 @@ iam: prometheus: image: prom/prometheus:v2.51.2 create: true + retention: + time: 15d resources: requests: memory: "512Mi"