Skip to content

Commit

Permalink
Merge pull request kubecost#626 from kubecost/bolt/thanos-0.15-upgrade
Browse files Browse the repository at this point in the history
Upgrade Thanos to 0.15.0
  • Loading branch information
mbolt35 authored Sep 29, 2020
2 parents 5bc6e13 + a8f5083 commit 752b584
Show file tree
Hide file tree
Showing 11 changed files with 507 additions and 41 deletions.
4 changes: 2 additions & 2 deletions cost-analyzer/charts/thanos/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: 0.12.2
appVersion: 0.15.0
description: Thanos is a set of components that can be composed into a highly available metric system with unlimited storage capacity, which can be added seamlessly on top of existing Prometheus deployments.
name: thanos
keywords:
Expand All @@ -9,7 +9,7 @@ keywords:
sources:
- https://github.com/thanos-io/thanos
- https://github.com/banzaicloud/banzai-charts/tree/master/thanos
version: 0.12.2
version: 0.15.0
icon: https://raw.githubusercontent.com/thanos-io/thanos/master/website/static/Thanos-logo_full.svg
maintainers:
- name: Banzai Cloud
Expand Down
120 changes: 120 additions & 0 deletions cost-analyzer/charts/thanos/templates/query-frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{{ if .Values.queryFrontend.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }}
{{- with .Values.queryFrontend.deploymentAnnotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.queryFrontend.autoscaling.enabled }}
replicas: {{ .Values.queryFrontend.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.deploymentMatchLabels }}{{ toYaml . | indent 6 }}{{ end }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.labels }}{{ toYaml . | indent 8 }}{{ end }}
{{- with .Values.queryFrontend.annotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.metrics.annotations.enabled }}
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.queryFrontend.http.port }}"
{{- end }}
spec:
containers:
- name: thanos-query-frontend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "query-frontend"
- "--log.level={{ .Values.queryFrontend.logLevel }}"
- "--http-address=0.0.0.0:{{ .Values.queryFrontend.http.port }}"
- "--query-frontend.downstream-url=http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.query.http.port }}"
- "--query-range.split-interval={{ .Values.queryFrontend.splitInterval }}"
- "--query-range.max-retries-per-request={{ .Values.queryFrontend.maxRetriesPerRequest }}"
- "--query-range.max-query-length={{ .Values.queryFrontend.maxQueryLength }}"
- "--query-range.max-query-parallelism={{ .Values.queryFrontend.maxQueryParallelism }}"
- "--query-range.response-cache-max-freshness={{ .Values.queryFrontend.responseCacheMaxFreshness }}"
{{- if .Values.queryFrontend.responseCache.enabled }}
{{- with .Values.queryFrontend.responseCache }}
- |-
--query-range.response-cache-config=
config:
max_size: {{ quote .maxSize }}
max_size_items: {{ .maxSizeItems }}
validity: {{ quote .validity }}
type: "in-memory"
{{- end }}
{{- else if .Values.queryFrontend.responseCacheConfigFile }}
- "--query-range.response-cache-config-file={{ .Values.queryFrontend.responseCacheConfigFile }}"
{{- else if .Values.queryFrontend.responseCacheConfig }}
- |-
--query-range.response-cache-config={{ toYaml .Values.queryFrontend.responseCacheConfig | nindent 12 }}
{{- end }}
{{- if .Values.queryFrontend.compressResponses }}
- "--query-frontend.compress-responses"
{{- end }}
{{- if .Values.queryFrontend.partialResponse }}
- "--query-range.partial-response"
{{- end }}
{{- if .Values.queryFrontend.extraArgs }}
{{ toYaml .Values.queryFrontend.extraArgs | nindent 8 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.queryFrontend.http.port }}
resources:
{{ toYaml .Values.queryFrontend.resources | nindent 10 }}
env:
{{- toYaml .Values.queryFrontend.extraEnv | nindent 10 }}
volumeMounts:
{{- if .Values.queryFrontend.certSecretName }}
- mountPath: /etc/certs
name: {{ .Values.queryFrontend.certSecretName }}
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /-/healthy
port: http
volumes:
{{- if .Values.queryFrontend.certSecretName }}
- name: {{ .Values.queryFrontend.certSecretName }}
secret:
defaultMode: 420
secretName: {{ .Values.queryFrontend.certSecretName }}
{{- end }}
{{- with .Values.queryFrontend.securityContext }}
securityContext: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryFrontend.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryFrontend.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryFrontend.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryFrontend.serviceAccount }}
serviceAccountName: "{{ . }}"
{{- end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.queryFrontend.enabled }}
{{- if .Values.queryFrontend.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "thanos.componentname" (list $ "query-frontend") }}
minReplicas: {{ .Values.queryFrontend.autoscaling.minReplicas }}
maxReplicas: {{ .Values.queryFrontend.autoscaling.maxReplicas }}
metrics:
{{- with .Values.queryFrontend.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ . }}
{{- end }}
{{- with .Values.queryFrontend.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- end }}
45 changes: 45 additions & 0 deletions cost-analyzer/charts/thanos/templates/query-frontend-ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.http.ingress.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}-http
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
{{- if .Values.queryFrontend.http.ingress.labels }}
{{ toYaml .Values.queryFrontend.http.ingress.labels | indent 4 }}
{{- end }}
{{- with .Values.queryFrontend.http.ingress.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.queryFrontend.http.ingress.tls }}
tls:
{{- range .Values.queryFrontend.http.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
{{- if .secretName }}
secretName: {{ .secretName }}
{{- end}}
{{- end }}
{{- end }}
rules:
{{- range .Values.queryFrontend.http.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $.Values.queryFrontend.http.ingress.path }}
backend:
serviceName: {{ include "thanos.componentname" (list $ "query-frontend") }}-http
servicePort: {{ $.Values.queryFrontend.http.port }}
{{- end }}
{{- end }}


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }}
spec:
{{- if .Values.queryFrontend.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.queryFrontend.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.queryFrontend.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.queryFrontend.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/component: query-frontend
{{- end }}
32 changes: 32 additions & 0 deletions cost-analyzer/charts/thanos/templates/query-frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.queryFrontend.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}-http
{{- with .Values.queryFrontend.http.service.annotations }}
annotations: {{ toYaml .| nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }}
spec:
type: {{ .Values.queryFrontend.http.service.type }}
{{- if .Values.queryFrontend.http.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.queryFrontend.http.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.queryFrontend.http.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.http.service.matchLabels }}{{ toYaml . | indent 4 }}{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "thanos.componentname" (list $ "query-frontend") }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: query-frontend
{{ with .Values.queryFrontend.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }}
spec:
jobLabel: thanos-query
selector:
matchLabels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: query-frontend
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: http
interval: {{ .Values.queryFrontend.metrics.serviceMonitor.interval | default "15s" }}
{{- with .Values.queryFrontend.metrics.serviceMonitor.relabellings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
Loading

0 comments on commit 752b584

Please sign in to comment.