|
1 | 1 | {{- if .Values.nginx.enabled }}
|
| 2 | +{{- $rootDomain := printf "%s.svc.%s:%d" .Release.Namespace .Values.clusterDomain (.Values.config.server.http_listen_port | int) }} |
2 | 3 | kind: ConfigMap
|
3 | 4 | apiVersion: v1
|
4 | 5 | metadata:
|
|
15 | 16 |
|
16 | 17 | events {
|
17 | 18 | worker_connections 4096; ## Default: 1024
|
18 |
| - } |
19 |
| -
|
| 19 | + } |
20 | 20 |
|
21 | 21 | http {
|
22 | 22 | default_type application/octet-stream;
|
@@ -46,64 +46,71 @@ data:
|
46 | 46 |
|
47 | 47 | # Distributor Config
|
48 | 48 | location = /ring {
|
49 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 49 | + proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; |
50 | 50 | }
|
51 | 51 |
|
52 | 52 | location = /all_user_stats {
|
53 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 53 | + proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; |
54 | 54 | }
|
55 | 55 |
|
56 | 56 | location = /api/prom/push {
|
57 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 57 | + proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; |
58 | 58 | }
|
59 | 59 |
|
60 | 60 | ## New Remote write API. Ref: https://cortexmetrics.io/docs/api/#remote-write
|
61 | 61 | location = /api/v1/push {
|
62 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 62 | + proxy_pass http://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; |
63 | 63 | }
|
64 | 64 |
|
65 |
| -
|
66 | 65 | # Alertmanager Config
|
67 | 66 | location ~ /api/prom/alertmanager/.* {
|
68 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 67 | + proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; |
69 | 68 | }
|
70 | 69 |
|
71 | 70 | location ~ /api/v1/alerts {
|
72 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 71 | + proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; |
73 | 72 | }
|
74 | 73 |
|
75 | 74 | location ~ /multitenant_alertmanager/status {
|
76 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 75 | + proxy_pass http://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; |
77 | 76 | }
|
78 | 77 |
|
79 | 78 | # Ruler Config
|
80 | 79 | location ~ /api/v1/rules {
|
81 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 80 | + proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ $rootDomain }}$request_uri; |
82 | 81 | }
|
83 | 82 |
|
84 | 83 | location ~ /ruler/ring {
|
85 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 84 | + proxy_pass http://{{ template "cortex.fullname" . }}-ruler.{{ $rootDomain }}$request_uri; |
86 | 85 | }
|
87 | 86 |
|
88 | 87 | # Config Config
|
89 | 88 | location ~ /api/prom/configs/.* {
|
90 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-configs.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 89 | + proxy_pass http://{{ template "cortex.fullname" . }}-configs.{{ $rootDomain }}$request_uri; |
91 | 90 | }
|
92 | 91 |
|
93 | 92 | # Query Config
|
94 | 93 | location ~ /api/prom/.* {
|
95 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 94 | + proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; |
96 | 95 | }
|
97 | 96 |
|
98 | 97 | ## New Query frontend APIs as per https://cortexmetrics.io/docs/api/#querier--query-frontend
|
99 | 98 | location ~ ^{{.Values.config.api.prometheus_http_prefix}}/api/v1/(read|metadata|labels|series|query_range|query) {
|
100 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 99 | + proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; |
101 | 100 | }
|
102 | 101 |
|
103 | 102 | location ~ {{.Values.config.api.prometheus_http_prefix}}/api/v1/label/.* {
|
104 |
| - proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.http_listen_port }}$request_uri; |
| 103 | + proxy_pass http://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; |
105 | 104 | }
|
106 |
| -
|
| 105 | + {{- if and (.Values.config.auth_enabled) (.Values.nginx.config.auth_orgs) }} |
| 106 | + # Auth orgs |
| 107 | + {{- range $org := compact .Values.nginx.config.auth_orgs | uniq }} |
| 108 | + location = /api/v1/push/{{ $org }} { |
| 109 | + proxy_set_header X-Scope-OrgID {{ $org }}; |
| 110 | + proxy_pass http://{{ template "cortex.fullname" $ }}-distributor.{{ $rootDomain }}$request_uri; |
| 111 | + } |
| 112 | + {{- end }} |
| 113 | + {{- end }} |
107 | 114 | }
|
108 | 115 | }
|
109 | 116 | {{- end }}
|
0 commit comments