diff --git a/thanos/charts/Chart.yaml b/thanos/charts/Chart.yaml index 729d0c2b..55f154b7 100644 --- a/thanos/charts/Chart.yaml +++ b/thanos/charts/Chart.yaml @@ -11,7 +11,7 @@ maintainers: name: thanos sources: - https://github.com/cloudoperators/greenhouse-extensions -version: 0.1.7 +version: 0.1.8 # thanos-release appVersion: v0.35.0 keywords: diff --git a/thanos/charts/templates/compactor-svc.yaml b/thanos/charts/templates/compactor-svc.yaml index 3db2c27a..1ef63512 100644 --- a/thanos/charts/templates/compactor-svc.yaml +++ b/thanos/charts/templates/compactor-svc.yaml @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 +{{ if and .Values.thanos.compactor.enabled (not .Values.thanos.query.standalone) }} apiVersion: v1 kind: Service metadata: @@ -24,3 +25,4 @@ spec: selector: app.kubernetes.io/managed-by: {{ include "release.name" . }} app.kubernetes.io/name: compactor +{{ end }} diff --git a/thanos/charts/templates/compactor.yaml b/thanos/charts/templates/compactor.yaml index 7c0f3940..730a75bf 100644 --- a/thanos/charts/templates/compactor.yaml +++ b/thanos/charts/templates/compactor.yaml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 -{{ if .Values.thanos.compactor.enabled }} +{{ if and .Values.thanos.compactor.enabled (not .Values.thanos.query.standalone) }} apiVersion: apps/v1 kind: Deployment metadata: diff --git a/thanos/charts/templates/pvc.yaml b/thanos/charts/templates/pvc.yaml index efaaf81a..3e592066 100644 --- a/thanos/charts/templates/pvc.yaml +++ b/thanos/charts/templates/pvc.yaml @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 +{{ if and .Values.thanos.compactor.enabled (not .Values.thanos.query.standalone) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -21,3 +22,4 @@ spec: resources: requests: storage: {{ default "100Gi" .Values.thanos.compactor.volume.size }} +{{ end }} diff --git a/thanos/charts/templates/ruler/alertmanager-config.yaml b/thanos/charts/templates/ruler/alertmanager-config.yaml index 5f1a35e7..7962a741 100644 --- a/thanos/charts/templates/ruler/alertmanager-config.yaml +++ b/thanos/charts/templates/ruler/alertmanager-config.yaml @@ -1,4 +1,4 @@ -{{ if .Values.thanos.ruler.alertmanagers.enabled }} +{{ if and .Values.thanos.ruler.alertmanagers.enabled .Values.thanos.ruler.enabled (not .Values.thanos.query.standalone) }} apiVersion: v1 kind: Secret metadata: diff --git a/thanos/charts/templates/ruler/alertmanager-sso-secret.yaml b/thanos/charts/templates/ruler/alertmanager-sso-secret.yaml index 9c7ee903..e1a67739 100644 --- a/thanos/charts/templates/ruler/alertmanager-sso-secret.yaml +++ b/thanos/charts/templates/ruler/alertmanager-sso-secret.yaml @@ -1,4 +1,4 @@ -{{ if and .Values.thanos.ruler.alertmanagers.authentication.enabled .Values.thanos.ruler.alertmanagers.enabled }} +{{ if and .Values.thanos.ruler.alertmanagers.authentication.enabled .Values.thanos.ruler.alertmanagers.enabled .Values.thanos.ruler.enabled (not .Values.thanos.query.standalone) }} apiVersion: v1 kind: Secret type: Opaque diff --git a/thanos/charts/templates/ruler/ruler.yaml b/thanos/charts/templates/ruler/ruler.yaml index c25f8a39..847c776d 100644 --- a/thanos/charts/templates/ruler/ruler.yaml +++ b/thanos/charts/templates/ruler/ruler.yaml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 -{{ if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.thanos.ruler.enabled }} +{{ if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.thanos.ruler.enabled (not .Values.thanos.query.standalone) }} apiVersion: monitoring.coreos.com/v1 kind: ThanosRuler metadata: diff --git a/thanos/charts/templates/store-svc.yaml b/thanos/charts/templates/store-svc.yaml index f0631ffc..e7d9607c 100644 --- a/thanos/charts/templates/store-svc.yaml +++ b/thanos/charts/templates/store-svc.yaml @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 +{{ if and .Values.thanos.store.enabled (not .Values.thanos.query.standalone) }} apiVersion: v1 kind: Service metadata: @@ -28,3 +29,4 @@ spec: selector: app.kubernetes.io/managed-by: {{ include "release.name" . }} app.kubernetes.io/name: store +{{ end }} diff --git a/thanos/charts/templates/store.yaml b/thanos/charts/templates/store.yaml index 8d7da81f..3bf6660a 100644 --- a/thanos/charts/templates/store.yaml +++ b/thanos/charts/templates/store.yaml @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors # SPDX-License-Identifier: Apache-2.0 +{{ if and .Values.thanos.store.enabled (not .Values.thanos.query.standalone) }} apiVersion: apps/v1 kind: Deployment metadata: @@ -111,3 +112,4 @@ spec: secretName: {{ include "release.name" . }}-metrics-objectstore - name: data emptyDir: {} +{{ end }} diff --git a/thanos/charts/templates/tests/test-thanos-config.yaml b/thanos/charts/templates/tests/test-thanos-config.yaml index 250e94f2..f711befd 100644 --- a/thanos/charts/templates/tests/test-thanos-config.yaml +++ b/thanos/charts/templates/tests/test-thanos-config.yaml @@ -22,19 +22,30 @@ data: DETIK_CLIENT_NAME="kubectl" - @test "Verify successful deployment and running status of {{ .Release.Name }} compactor, query and store" { - verify "there is 1 deployment named '{{ .Release.Name }}-compactor'" + @test "Verify {{ .Release.Name }} Query" { verify "there is 1 deployment named '{{ .Release.Name }}-query'" - verify "there is 1 deployment named '{{ .Release.Name }}-store'" - verify "there is 1 service named '{{ .Release.Name }}-compactor'" verify "there is 1 service named '{{ .Release.Name }}-query'" - verify "there is 1 service named '{{ .Release.Name }}-store'" - try "at most 2 times every 5s to get pods named '{{ .Release.Name }}-compactor' and verify that '.status.phase' is 'running'" try "at most 4 times every 5s to get pods named '{{ .Release.Name }}-query' and verify that '.status.phase' is 'running'" - try "at most 4 times every 5s to get pods named '{{ .Release.Name }}-store' and verify that '.status.phase' is 'running'" } - {{ if .Values.thanos.ruler.enabled }} + {{ if and .Values.thanos.store.enabled (not .Values.thanos.query.standalone) }} + @test "Verify {{ .Release.Name }} Store" { + verify "there is 1 deployment named '{{ .Release.Name }}-store'" + verify "there is 1 service named '{{ .Release.Name }}-store'" + try "at most 4 times every 5s to get pods named '{{ .Release.Name }}-store' and verify that '.status.phase' is 'running'" + } + {{ end }} + + {{ if and .Values.thanos.compactor.enabled (not .Values.thanos.query.standalone) }} + @test "Verify {{ .Release.Name }} Compactor" { + verify "there is 1 deployment named '{{ .Release.Name }}-compactor'" + verify "there is 1 service named '{{ .Release.Name }}-compactor'" + try "at most 3 times every 5s to get pods named '{{ .Release.Name }}-compactor' and verify that '.status.phase' is 'running'" + try "at most 3 times every 5s to get persistentvolumeclaims named '{{ .Release.Name }}-compactor' and verify that '.status.phase' is 'Bound'" + } + {{ end }} + + {{ if and .Values.thanos.ruler.enabled (not .Values.thanos.query.standalone) }} @test "Verify succesful creation, running status and rulefiles population of Thanos Ruler" { verify "there is 1 statefulset named 'thanos-ruler-{{ .Release.Name }}'" verify "there is 1 service named 'thanos-ruler-operated'" @@ -42,8 +53,4 @@ data: try "at most 3 times every 5s to get configmaps named '.*(ruler)+.*(rulefiles)+.*' and verify that '.data' matches '.*yaml.*'" } {{ end }} - - @test "Verify successful creation and bound status of {{ .Release.Name }} persistent volume claims" { - try "at most 3 times every 5s to get persistentvolumeclaims named '{{ .Release.Name }}-compactor' and verify that '.status.phase' is 'Bound'" - } {{- end -}} diff --git a/thanos/charts/values.yaml b/thanos/charts/values.yaml index b4f2e48c..385c664b 100644 --- a/thanos/charts/values.yaml +++ b/thanos/charts/values.yaml @@ -50,16 +50,21 @@ thanos: additionalArgs: [] # - something.route-foo=/lol + deploymentLabels: {} + containerLabels: serviceLabels: annotations: + # if this is a standalone query, store endpoints need to be added here, otherwise the query does nothing. stores: [] store: + # if this is a standalone Thanos Query, we wouldn't want a store. + enabled: true # adding additional arguments additionalArgs: [] @@ -82,6 +87,7 @@ thanos: # if this is a standalone Thanos Query, we wouldn't want a compactor enabled: true # TODO: store secret needs to be present and can not be provisioned automatically + logLevel: containerLabels: [] diff --git a/thanos/plugindefinition.yaml b/thanos/plugindefinition.yaml index 343834dc..c6aba9b2 100644 --- a/thanos/plugindefinition.yaml +++ b/thanos/plugindefinition.yaml @@ -10,7 +10,7 @@ spec: helmChart: name: thanos repository: "oci://ghcr.io/cloudoperators/greenhouse-extensions/charts" - version: 0.1.7 + version: 0.1.8 options: - default: null description: CLI param for Thanos Query @@ -69,6 +69,21 @@ spec: name: thanos.query.standalone required: false type: bool + - default: true + description: Enable Thanos Store + name: thanos.store.enabled + required: false + type: bool + - default: true + description: Enable Thanos Compactor + name: thanos.compactor.enabled + required: false + type: bool + - default: true + description: Enable Thanos Ruler + name: thanos.ruler.enabled + required: false + type: bool - default: [] description: Automatically filled if Query is not standalone. If multiple Prometheis are deployed, all Prometheus, Thanos Query and Thanos Store services need to be added to this list manually e.g. kube-monitoring-prometheus:10901 or thanos-store:10901. name: thanos.query.stores @@ -103,4 +118,4 @@ spec: description: TLS key for communication with Alertmanager required: false type: secret - version: 0.2.7 + version: 0.2.8