Skip to content

Commit

Permalink
fix: cater for prom.promSpec.thanos
Browse files Browse the repository at this point in the history
Signed-off-by: ThameezBo <[email protected]>
  • Loading branch information
thameezb committed Oct 23, 2023
1 parent bfda60c commit 053dde4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
5 changes: 3 additions & 2 deletions charts/kube-prometheus-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an

### From 51.x to 52.x

This includes the ability to select between using existing secrets or create new secret objects for various thanosrule config. The defaults have not changed but if you were setting:
This includes the ability to select between using existing secrets or create new secret objects for various thanos config. The defaults have not changed but if you were setting:

- `thanosRuler.thanosRulerSpec.alertmanagersConfig` or
- `thanosRuler.thanosRulerSpec.objectStorageConfig` or
- `thanosRuler.thanosRulerSpec.queryConfig`
- `thanosRuler.thanosRulerSpec.queryConfig` or
- `prometheus.prometheusSpec.thanos.objectStorageConfig`

you will have to need to set `existingSecret` or `secret` based on your requirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,16 @@ spec:
{{- if not .Values.prometheus.agentMode }}
{{- if .Values.prometheus.prometheusSpec.thanos }}
thanos:
{{ toYaml .Values.prometheus.prometheusSpec.thanos | indent 4 }}
{{- omit .Values.prometheus.prometheusSpec.thanos "objectStorageConfig" | toYaml | indent 4 }}
{{- if .Values.prometheus.prometheusSpec.thanos.objectStorageConfig.existingSecret }}
objectStorageConfig:
key: "{{.Values.prometheus.prometheusSpec.thanos.objectStorageConfig.existingSecret.key }}"
name: "{{.Values.prometheus.prometheusSpec.thanos.objectStorageConfig.existingSecret.name }}"
{{- else if .Values.prometheus.prometheusSpec.thanos.objectStorageConfig.secret}}
objectStorageConfig:
key: object-storage-configs.yaml
name: {{ template "kube-prometheus-stack.fullname" . }}-prometheus
{{- end }}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.disableCompaction }}
disableCompaction: {{ .Values.prometheus.prometheusSpec.disableCompaction }}
Expand Down
17 changes: 17 additions & 0 deletions charts/kube-prometheus-stack/templates/prometheus/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.thanosRuler.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "kube-prometheus-stack.fullname" . }}-prometheus
namespace: {{ template "kube-prometheus-stack.namespace" . }}
labels:
app: {{ template "kube-prometheus-stack.name" . }}-prometheus
app.kubernetes.io/component: prometheus
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
data:
{{- with .Values.prometheusspec.thanos.objectStorageConfig }}
{{- if and .secret (not .existingSecret) }}
object-storage-configs.yaml: {{ toYaml .secret | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,23 @@ prometheus:
# - resourceName: "projects/$PROJECT_ID/secrets/testsecret/versions/latest"
# fileName: "objstore.yaml"
# objectStorageConfigFile: /var/secrets/object-store.yaml
## ObjectStorageConfig configures object storage in Thanos. Alternative to ObjectStorageConfigFile, and lower order priority.
# objectStorageConfig:
# # use existing secret, if configured, objectStorageConfig.secret will not be used
# existingSecret: {}
# # name: ""
# # key: ""
# # will render objectStorageConfig secret data and configure it to be used by Thanos custom resource,
# # ignored when prometheusspec.thanos.objectStorageConfig.existingSecret is set
# # https://thanos.io/tip/thanos/storage.md/#s3
# secret: {}
# # type: S3
# # config:
# # bucket: ""
# # endpoint: ""
# # region: ""
# # access_key: ""
# # secret_key: ""

## Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to a Prometheus pod.
## if using proxy extraContainer update targetPort with proxy container port
Expand Down

0 comments on commit 053dde4

Please sign in to comment.