Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] fixes thanos configs #3918

Merged
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 51.9.4
version: 52.0.0
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
68 changes: 68 additions & 0 deletions charts/kube-prometheus-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,74 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen

A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.

### 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:

- `thanosRuler.thanosRulerSpec.alertmanagersConfig` or
- `thanosRuler.thanosRulerSpec.objectStorageConfig` or
- `thanosRuler.thanosRulerSpec.queryConfig`

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

For instance, the `thanosRuler.thanosRulerSpec.alertmanagersConfig` used to be configured as follow:

```yaml
thanosRuler:
thanosRulerSpec:
alertmanagersConfig:
alertmanagers:
- api_version: v2
http_config:
basic_auth:
username: some_user
password: some_pass
static_configs:
- alertmanager.thanos.io
scheme: http
timeout: 10s
```

But it now moved to:

```yaml
thanosRuler:
thanosRulerSpec:
alertmanagersConfig:
secret:
alertmanagers:
- api_version: v2
http_config:
basic_auth:
username: some_user
password: some_pass
static_configs:
- alertmanager.thanos.io
scheme: http
timeout: 10s
```

or the `thanosRuler.thanosRulerSpec.objectStorageConfig` used to be configured as follow:

```yaml
thanosRuler:
thanosRulerSpec:
objectStorageConfig:
name: existing-secret-not-created-by-this-chart
key: object-storage-configs.yaml
```

But it now moved to:

```yaml
thanosRuler:
thanosRulerSpec:
objectStorageConfig:
existingSecret:
name: existing-secret-not-created-by-this-chart
key: object-storage-configs.yaml
```

### From 50.x to 51.x

This version upgrades Prometheus-Operator to v0.68.0, Prometheus to 2.47.0 and Thanos to v0.32.2
Expand Down
21 changes: 17 additions & 4 deletions charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ spec:
alertmanagersUrl:
{{ toYaml .Values.thanosRuler.thanosRulerSpec.alertmanagersUrl | indent 4 }}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig }}
{{- if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.existingSecret }}
alertmanagersConfig:
key: "{{.Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.existingSecret.key }}"
name: "{{.Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.existingSecret.name }}"
{{- else if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.secret }}
alertmanagersConfig:
key: alertmanager-configs.yaml
name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
Expand All @@ -80,9 +84,14 @@ spec:
queryEndpoints:
{{ toYaml .Values.thanosRuler.thanosRulerSpec.queryEndpoints | indent 4 }}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.queryConfig }}
{{- if .Values.thanosRuler.thanosRulerSpec.queryConfig.existingSecret }}
queryConfig:
key: "{{.Values.thanosRuler.thanosRulerSpec.queryConfig.existingSecret.key }}"
name: "{{.Values.thanosRuler.thanosRulerSpec.queryConfig.existingSecret.name }}"
{{- else if .Values.thanosRuler.thanosRulerSpec.queryConfig.secret }}
queryConfig:
{{ toYaml .Values.thanosRuler.thanosRulerSpec.queryConfig | indent 4 }}
key: query-configs.yaml
name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.resources }}
resources:
Expand All @@ -99,7 +108,11 @@ spec:
storage:
{{ toYaml .Values.thanosRuler.thanosRulerSpec.storage | indent 4 }}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.objectStorageConfig }}
{{- if .Values.thanosRuler.thanosRulerSpec.objectStorageConfig.existingSecret }}
objectStorageConfig:
key: "{{.Values.thanosRuler.thanosRulerSpec.objectStorageConfig.existingSecret.key }}"
name: "{{.Values.thanosRuler.thanosRulerSpec.objectStorageConfig.existingSecret.name }}"
{{- else if .Values.thanosRuler.thanosRulerSpec.objectStorageConfig.secret }}
objectStorageConfig:
key: object-storage-configs.yaml
name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
Expand Down
21 changes: 15 additions & 6 deletions charts/kube-prometheus-stack/templates/thanos-ruler/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ metadata:
app: {{ include "kube-prometheus-stack.thanosRuler.name" . }}
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
data:
{{- if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig }}
alertmanager-configs.yaml: {{ toYaml .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig | b64enc | quote }}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.objectStorageConfig }}
object-storage-configs.yaml: {{ toYaml .Values.thanosRuler.thanosRulerSpec.objectStorageConfig | b64enc | quote }}
{{- end }}
{{- with .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig }}
{{- if and .secret (not .existingSecret) }}
alertmanager-configs.yaml: {{ toYaml .secret | b64enc | quote }}
{{- end }}
{{- end }}
{{- with .Values.thanosRuler.thanosRulerSpec.objectStorageConfig }}
{{- if and .secret (not .existingSecret) }}
object-storage-configs.yaml: {{ toYaml .secret | b64enc | quote }}
{{- end }}
{{- end }}
{{- with .Values.thanosRuler.thanosRulerSpec.queryConfig }}
{{- if and .secret (not .existingSecret) }}
query-configs.yaml: {{ toYaml .secret | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
61 changes: 49 additions & 12 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3961,16 +3961,24 @@ thanosRuler:

## AlertmanagerConfig define configuration for connecting to alertmanager.
## Only available with Thanos v0.10.0 and higher. Maps to the alertmanagers.config Thanos Ruler arg.
alertmanagersConfig: {}
# - api_version: v2
# http_config:
# basic_auth:
# username: some_user
# password: some_pass
# static_configs:
# - alertmanager.thanos.io
# scheme: http
# timeout: 10s
alertmanagersConfig:
# use existing secret, if configured, alertmanagersConfig.secret will not be used
existingSecret: {}
# name: ""
# key: ""
# will render render alertmanagersConfig secret data and configure it to be used by Thanos Ruler custom resource, ignored when alertmanagersConfig.existingSecret is set
# https://thanos.io/tip/components/rule.md/#alertmanager
secret: {}
# alertmanagers:
# - api_version: v2
# http_config:
# basic_auth:
# username: some_user
# password: some_pass
# static_configs:
# - alertmanager.thanos.io
# scheme: http
# timeout: 10s

## DEPRECATED. Define URLs to send alerts to Alertmanager. For Thanos v0.10.0 and higher, alertmanagersConfig should be used instead.
## Note: this field will be ignored if alertmanagersConfig is specified. Maps to the alertmanagers.url Thanos Ruler arg.
Expand All @@ -3987,7 +3995,21 @@ thanosRuler:

## ObjectStorageConfig configures object storage in Thanos. Alternative to
## ObjectStorageConfigFile, and lower order priority.
objectStorageConfig: {}
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 Ruler custom resource, ignored when alertmanagersConfig.existingSecret is set
thameezb marked this conversation as resolved.
Show resolved Hide resolved
# https://thanos.io/tip/thanos/storage.md/#s3
secret: {}
# type: S3
# config:
# bucket: ""
# endpoint: ""
# region: ""
# access_key: ""
# secret_key: ""

## ObjectStorageConfigFile specifies the path of the object storage configuration file.
## When used alongside with ObjectStorageConfig, ObjectStorageConfigFile takes precedence.
Expand All @@ -3999,7 +4021,22 @@ thanosRuler:

## Define configuration for connecting to thanos query instances. If this is defined, the queryEndpoints field will be ignored.
## Maps to the query.config CLI argument. Only available with thanos v0.11.0 and higher.
queryConfig: {}
queryConfig:
# use existing secret, if configured, queryConfig.secret will not be used
existingSecret: {}
# name: ""
# key: ""
# render queryConfig secret data and configure it to be used by Thanos Ruler custom resource, ignored when queryConfig.existingSecret is set
# https://thanos.io/tip/components/rule.md/#query-api
secret: {}
# - http_config:
# basic_auth:
# username: some_user
# password: some_pass
# static_configs:
# - URL
# scheme: http
# timeout: 10s

## Labels configure the external label pairs to ThanosRuler. A default replica
## label `thanos_ruler_replica` will be always added as a label with the value
Expand Down