Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ruler and ruler-svc template
Browse files Browse the repository at this point in the history
trouaux committed Nov 27, 2024
1 parent 84cd94e commit 709212f
Showing 3 changed files with 167 additions and 0 deletions.
33 changes: 33 additions & 0 deletions thanos/charts/templates/ruler-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
# SPDX-License-Identifier: Apache-2.0

{{ if .Values.ruler.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.thanos.query.annotations }}
annotations:
{{ toYaml .Values.thanos.query.annotations | nindent 8 }}
{{- end }}
labels:
{{- include "plugin.labels" . | nindent 4 }}
{{- include "thanos.labels" . | nindent 4 }}
{{- if .Values.thanos.ruler.serviceLabels }}
{{ toYaml .Values.thanos.ruler.serviceLabels | nindent 4 }}
{{- end }}
name: {{ include "release.name" . }}-ruler
spec:
ports:
- name: grpc
port: 10901
protocol: TCP
targetPort: grpc
- name: http
port: 10902
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/managed-by: {{ include "release.name" . }}
app.kubernetes.io/name: ruler

{{- end }}
87 changes: 87 additions & 0 deletions thanos/charts/templates/ruler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
# SPDX-License-Identifier: Apache-2.0

{{ if .Values.ruler.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "plugin.labels" . | nindent 4 }}
{{- include "thanos.labels" . | nindent 4 }}
{{- if .Values.thanos.ruler.deploymentLabels }}
{{ toYaml .Values.thanos.ruler.deploymentLabels | nindent 4 }}
{{- end }}
name: {{ include "release.name" . }}-ruler

spec:
image: "{{ .Values.thanos.image.repository }}:{{ .Values.thanos.image.tag | default .Chart.AppVersion }}"
paused: {{ $.Values.ruler.paused }}
logLevel: {{ default "info" $.Values.ruler.logLevel }}
{{- if $.Values.ruler.retention }}
retention: {{ $.Values.ruler.retention | quote }}
{{- end }}
{{- if $.Values.rbac.create }}
serviceAccountName: {{ $.Values.serviceAccount.name }}
{{- end }}
{{- if $.Values.ruler.externalPrefix }}
# if externalPrefix is set, the routePrefix must also be set so that http handlers can be registered there
externalPrefix: {{ $.Values.ruler.externalPrefix }}
routePrefix: {{ $.Values.ruler.externalPrefix }}
{{- end }}
{{- if $.Values.ruler.evaluationInterval }}
evaluationInterval: {{ $.Values.ruler.evaluationInterval }}
{{- end }}
ruleSelector: #???
matchLabels:
thanos-ruler: {{ include "release.name" . }}-ruler

# Select rules from all namespaces.
ruleNamespaceSelector: {}

# The labels to add to any alert when communicating with Alertmanager
labels:
region: {{ required ".Values.global.region missing" $.Values.global.region }}
{{- if $.Values.ruler.externalClusterLabels.enabled }}
cluster: {{ if $.Values.global.cluster }}{{ $.Values.global.cluster }}{{ else }}{{ $.Values.global.region }}
{{- end }}
cluster_type: {{ required ".Values.global.clusterType missing" $.Values.global.clusterType }}
{{- else }}
cluster: {{ required ".Values.global.region missing" $.Values.global.region }}
{{- end }}
alertQueryUrl: {{ $.Values.ruler.externalUrl }} # ???
{{ if required "$.Values.ruler.alertmanagers.hosts missing" $.Values.ruler.alertmanagers.hosts }}
alertmanagersConfig:
name: {{ include "release.name" . }}-alertmanager-config # ???
key: alertManagerConfig.yaml
{{- end }}

{{- if and $.Values.global.linkerd_enabled $.Values.global.linkerd_requested }}
podMetadata:
annotations:
linkerd.io/inject: enabled
{{- end }}

{{ if not $.Values.ruler.queryEndpoints }}
queryEndpoints:
- {{ include "release.name" . }}-query:10902 #???
{{- else }}
{{ toYaml $.Values.ruler.queryEndpoints | indent 4 }}
{{- end }}

{{- if $.Values.ruler.resources }}
resources:
{{ toYaml $.Values.ruler.resources | indent 4 }}
{{- end }}
{{- if $.Values.ruler.alertmanagers.authentication.enabled }}
containers:
- name: thanos-ruler
volumeMounts:
- mountPath: /etc/thanos/secrets/{{ include "release.name" . }}-ruler-alertmanager-sso-cert #???
name: {{ include "release.name" . }}-ruler-alertmanager-sso-cert #???
readOnly: true
volumes:
- name: {{ include "release.name" . }}-ruler-alertmanager-sso-cert #???
secret:
secretName: {{ include "release.name" . }}-ruler-alertmanager-sso-cert #???
{{- end }}
{{- end }}
47 changes: 47 additions & 0 deletions thanos/charts/values.yaml
Original file line number Diff line number Diff line change
@@ -2,11 +2,58 @@
# SPDX-License-Identifier: Apache-2.0

global:
clusterType:

region:
## Labels to apply to all resources
##
commonLabels: {}

# Create RBAC resources.
rbac:
create: true

# ServiceAccount to use for the Thanos.
# Note that a ServiceAccount with name `default` cannot be created.
# Instead the generated name will be used.
serviceAccount:
create: true

# Optional name of the service account.
# If not provided one will be generated in the format: thanos-<name>.
name: ""

ruler:
enabled: true

annotations:

deploymentLabels: {}

serviceLabels:

paused:

logLevel:

externalPrefix:

evaluationInterval:

externalClusterLabels:
enabled:

alertmanagers:
hosts:
authentication:
enabled:

queryEndpoints:

resources:

externalUrl: "https://"

thanos:
image:
repository: quay.io/thanos/thanos

0 comments on commit 709212f

Please sign in to comment.