Skip to content

Discoverable Alertmanager + fixes + documentation #57

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

Merged
merged 1 commit into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
cortex
562 changes: 562 additions & 0 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if and .Values.ingress.enabled .Values.nginx.enabled -}}
{{- $fullName := include "cortex.fullname" . -}}
{{- $svcPort := .Values.nginx.service.port -}}
{{- $svcPort := .Values.nginx.http_listen_port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
Expand Down
51 changes: 41 additions & 10 deletions templates/nginx-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ data:
worker_connections 4096; ## Default: 1024
}


http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
'"$http_user_agent" "$http_x_forwarded_for" $http_x_scope_orgid';
access_log /dev/stderr main;
sendfile on;
tcp_nopush on;
Expand All @@ -36,25 +37,55 @@ data:
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;

location = /healthz {
return 200 'alive';
}

location = /api/prom/push {
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local$request_uri;
}

# Distributor Config
location = /ring {
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local$request_uri;
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

location = /all_user_stats {
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local$request_uri;
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

location = /api/prom/push {
proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

# Query Config
location ~ /api/prom/.* {
proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc.cluster.local$request_uri;
proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

# Alertmanager Config
location ~ /api/prom/alertmanager/.* {
proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

location ~ /api/v1/alerts {
proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

location ~ /multitenant_alertmanager/status {
proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

# Ruler Config
location ~ /api/v1/rules {
proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

location ~ /ruler/ring {
proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}

# Config Config
location ~ /api/prom/configs/.* {
proxy_pass http://{{ template "cortex.fullname" . }}-configs.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}$request_uri;
}
}
}
{{- end}}
{{- end }}
5 changes: 5 additions & 0 deletions templates/ruler-dep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ spec:
- "-target=ruler"
- "-config.file=/etc/cortex/cortex.yaml"
- "-ruler.configs.url=http://{{ template "cortex.fullname" . }}-configs.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}"
{{- if .Values.config.ruler.enable_alertmanager_discovery }}
- "-ruler.alertmanager-discovery=true"
- "-ruler.alertmanager-url=http://_http-metrics._tcp.{{ template "cortex.name" . }}-alertmanager-headless/api/prom/alertmanager/"
{{- else }}
- "-ruler.alertmanager-url=http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.config.server.http_listen_port }}/api/prom/alertmanager/"
{{- end }}
{{- if .Values.memcached.enabled }}
- -store.chunks-cache.memcached.addresses=dns+{{ template "cortex.fullname" . }}-memcached.{{ .Release.Namespace }}.svc.cluster.local:11211
- -store.chunks-cache.memcached.timeout=100ms
Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ serviceAccount:
useExternalConfig: false
externalConfigSecretName: 'secret-with-config.yaml'
externalConfigVersion: '0'

config:
auth_enabled: false
ingester:
Expand Down Expand Up @@ -142,6 +143,8 @@ config:
expiration: 1h
memcached_client:
timeout: 1s
ruler:
enable_alertmanager_discovery: false
alertmanager:
external_url: '/api/prom/alertmanager'
frontend:
Expand Down