Skip to content

Commit

Permalink
Merge branch 'main' into ruler/external-prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke authored Apr 16, 2024
2 parents 420df22 + 71f2180 commit 1b46350
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 20 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 58.1.2
version: 58.1.4
appVersion: v0.73.1
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ spec:
selector:
matchLabels:
app.kubernetes.io/name: thanos-ruler
thanos-ruler: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
thanos-ruler: {{ template "kube-prometheus-stack.thanosRuler.crname" . }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ spec:
labelSelector:
matchExpressions:
- {key: app.kubernetes.io/name, operator: In, values: [thanos-ruler]}
- {key: thanos-ruler, operator: In, values: [{{ template "kube-prometheus-stack.thanosRuler.name" . }}]}
- {key: thanos-ruler, operator: In, values: [{{ template "kube-prometheus-stack.thanosRuler.crname" . }}]}
{{- else if eq .Values.thanosRuler.thanosRulerSpec.podAntiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -154,7 +154,7 @@ spec:
labelSelector:
matchExpressions:
- {key: app.kubernetes.io/name, operator: In, values: [thanos-ruler]}
- {key: thanos-ruler, operator: In, values: [{{ template "kube-prometheus-stack.thanosRuler.name" . }}]}
- {key: thanos-ruler, operator: In, values: [{{ template "kube-prometheus-stack.thanosRuler.crname" . }}]}
{{- end }}
{{- if .Values.thanosRuler.thanosRulerSpec.tolerations }}
tolerations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ spec:
{{- end }}
selector:
app.kubernetes.io/name: thanos-ruler
thanos-ruler: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
thanos-ruler: {{ template "kube-prometheus-stack.thanosRuler.crname" . }}
type: "{{ .Values.thanosRuler.service.type }}"
{{- end }}
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3350,7 +3350,7 @@ prometheus:
image:
registry: quay.io
repository: prometheus/prometheus
tag: v2.51.1
tag: v2.51.2
sha: ""

## Tolerations for use with node taints
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
description: Prometheus Blackbox Exporter
name: prometheus-blackbox-exporter
version: 8.15.0
version: 8.15.1
appVersion: v0.25.0
home: https://github.com/prometheus/blackbox_exporter
sources:
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ containers:
- --listen-address=:{{ .Values.configReloader.containerPort }}
- --log-format={{ .Values.configReloader.config.logFormat }}
- --log-level={{ .Values.configReloader.config.logLevel }}
{{- with .Values.resources }}
{{- with .Values.configReloader.resources }}
resources:
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions charts/prometheus-memcached-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: prometheus-memcached-exporter
description: Prometheus exporter for Memcached metrics
type: application
version: 0.3.1
appVersion: "v0.14.2"
version: 0.3.2
appVersion: "v0.14.3"
home: https://github.com/prometheus/memcached_exporter
sources:
- https://github.com/prometheus/memcached_exporter
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-pushgateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "v1.8.0"
description: A Helm chart for prometheus pushgateway
name: prometheus-pushgateway
version: 2.11.0
version: 2.12.0
home: https://github.com/prometheus/pushgateway
sources:
- https://github.com/prometheus/pushgateway
Expand Down
12 changes: 6 additions & 6 deletions charts/prometheus-pushgateway/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Prometheus Pushgateway

This chart bootstraps a prometheus [pushgateway](http://github.com/prometheus/pushgateway) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
This chart bootstraps a Prometheus [Pushgateway](http://github.com/prometheus/pushgateway) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

An optional prometheus `ServiceMonitor` can be enabled, should you wish to use this gateway with a [Prometheus Operator](https://github.com/coreos/prometheus-operator).
An optional prometheus `ServiceMonitor` can be enabled, should you wish to use this gateway with [Prometheus Operator](https://github.com/coreos/prometheus-operator).

## Get Repository Info

<!-- textlint-disable terminology -->
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
<!-- textlint-enable -->
## Install Chart

```console
Expand All @@ -36,7 +36,7 @@ _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command doc
## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] [CHART] --install
helm upgrade [RELEASE_NAME] prometheus-community/prometheus-pushgateway --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
Expand Down
78 changes: 75 additions & 3 deletions charts/prometheus-pushgateway/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ Define Ingress apiVersion
{{- end }}
{{- end }}

{{/*
Define webConfiguration
*/}}
{{- define "prometheus-pushgateway.webConfiguration" -}}
basic_auth_users:
{{- range $k, $v := .Values.webConfiguration.basicAuthUsers }}
{{ $k }}: {{ htpasswd "" $v | trimPrefix ":"}}
{{- end }}
{{- end }}

{{/*
Define Authorization
*/}}
{{- define "prometheus-pushgateway.Authorization" -}}
{{- $users := keys .Values.webConfiguration.basicAuthUsers }}
{{- $user := first $users }}
{{- $password := index .Values.webConfiguration.basicAuthUsers $user }}
{{- $user }}:{{ $password }}
{{- end }}

{{/*
Returns pod spec
*/}}
Expand Down Expand Up @@ -143,21 +163,58 @@ containers:
env:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.extraArgs }}
{{- if or .Values.extraArgs .Values.webConfiguration }}
args:
{{- with .Values.extraArgs }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if .Values.webConfiguration }}
- --web.config.file=/etc/config/web-config.yaml
{{- end }}
{{- end }}
ports:
- name: metrics
containerPort: 9091
protocol: TCP
{{- if .Values.liveness.enabled }}
{{- $livenessCommon := omit .Values.liveness.probe "httpGet" }}
livenessProbe:
{{- toYaml .Values.liveness.probe | nindent 6 }}
{{- with .Values.liveness.probe }}
httpGet:
path: {{ .httpGet.path }}
port: {{ .httpGet.port }}
{{- if or .httpGet.httpHeaders $.Values.webConfiguration.basicAuthUsers }}
httpHeaders:
{{- if $.Values.webConfiguration.basicAuthUsers }}
- name: Authorization
value: Basic {{ include "prometheus-pushgateway.Authorization" $ | b64enc }}
{{- end }}
{{- with .httpGet.httpHeaders }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- toYaml $livenessCommon | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.readiness.enabled }}
{{- $readinessCommon := omit .Values.readiness.probe "httpGet" }}
readinessProbe:
{{- toYaml .Values.readiness.probe | nindent 6 }}
{{- with .Values.readiness.probe }}
httpGet:
path: {{ .httpGet.path }}
port: {{ .httpGet.port }}
{{- if or .httpGet.httpHeaders $.Values.webConfiguration.basicAuthUsers }}
httpHeaders:
{{- if $.Values.webConfiguration.basicAuthUsers }}
- name: Authorization
value: Basic {{ include "prometheus-pushgateway.Authorization" $ | b64enc }}
{{- end }}
{{- with .httpGet.httpHeaders }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- toYaml $readinessCommon | nindent 6 }}
{{- end }}
{{- end }}
{{- with .Values.resources }}
resources:
Expand All @@ -171,6 +228,10 @@ containers:
- name: storage-volume
mountPath: "{{ .Values.persistentVolume.mountPath }}"
subPath: "{{ .Values.persistentVolume.subPath }}"
{{- if .Values.webConfiguration }}
- name: web-config
mountPath: "/etc/config"
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 6 }}
{{- end }}
Expand Down Expand Up @@ -223,10 +284,21 @@ volumes:
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.webConfiguration }}
- name: web-config
secret:
secretName: {{ include "prometheus-pushgateway.fullname" . }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 2 }}
{{- else if $storageVolumeAsPVCTemplate }}
{{- if .Values.webConfiguration }}
- name: web-config
secret:
secretName: {{ include "prometheus-pushgateway.fullname" . }}
{{- else }}
[]
{{- end }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/prometheus-pushgateway/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.webConfiguration }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "prometheus-pushgateway.fullname" . }}
labels:
{{- include "prometheus-pushgateway.defaultLabels" . | nindent 4 }}
data:
web-config.yaml: {{ include "prometheus-pushgateway.webConfiguration" . | b64enc}}
{{- end }}
6 changes: 6 additions & 0 deletions charts/prometheus-pushgateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ resources: {}
# cpu: 100m
# memory: 30Mi

# -- Sets web configuration
# To enable basic authentication, provide basicAuthUsers as a map
webConfiguration: {}
# basicAuthUsers:
# username: password

liveness:
enabled: true
probe:
Expand Down

0 comments on commit 1b46350

Please sign in to comment.