Skip to content

Commit 5b62461

Browse files
committed
refactor: replace full Nginx config file with httpSnippet and serverSnippet in Loki values.
1 parent e6f58d9 commit 5b62461

File tree

1 file changed

+11
-58
lines changed

1 file changed

+11
-58
lines changed

lgtm-stack/terraform/values/loki-values.yaml

Lines changed: 11 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -148,65 +148,18 @@ gateway:
148148
readOnly: true
149149

150150
nginxConfig:
151-
file: |2
151+
httpSnippet: |
152+
# Determine if authentication is required based on the tenant ID
153+
# The 'default' tenant is used by global infra and smoke tests, so we bypass auth for it.
154+
map {{ print "$" }}http_x_scope_orgid {{ print "$" }}auth_realm {
155+
"default" "off";
156+
"" "off";
157+
default "Loki Tenant Authentication";
158+
}
159+
serverSnippet: |
160+
auth_basic {{ print "$" }}auth_realm;
161+
auth_basic_user_file /etc/nginx/secrets/.htpasswd;
152162
153-
worker_processes 5;
154-
error_log /dev/stderr;
155-
pid /tmp/nginx.pid;
156-
worker_rlimit_nofile 8192;
157-
events {
158-
worker_connections 4096;
159-
}
160-
http {
161-
client_body_temp_path /tmp/client_temp;
162-
proxy_temp_path /tmp/proxy_temp_path;
163-
fastcgi_temp_path /tmp/fastcgi_temp;
164-
uwsgi_temp_path /tmp/uwsgi_temp;
165-
scgi_temp_path /tmp/scgi_temp;
166-
default_type application/octet-stream;
167-
log_format main '{{ print "$" }}remote_addr - {{ print "$" }}remote_user [{{ print "$" }}time_local] "{{ print "$" }}request" {{ print "$" }}status';
168-
access_log /dev/stderr main;
169-
170-
# Determine if authentication is required based on the tenant ID
171-
# The 'default' tenant is used by global infra and smoke tests, so we bypass auth for it.
172-
map {{ print "$" }}http_x_scope_orgid {{ print "$" }}auth_realm {
173-
"default" "off";
174-
"" "off";
175-
default "Loki Tenant Authentication";
176-
}
177-
178-
server {
179-
listen 8080;
180-
181-
# Health check path (must be open for k8s probes)
182-
location = / {
183-
return 200 'OK';
184-
auth_basic off;
185-
}
186-
187-
# Log push paths (selecitvely authenticated via map)
188-
location ~ ^/(loki/api/v1/push|otlp/v1/logs|api/prom/push) {
189-
auth_basic {{ print "$" }}auth_realm;
190-
auth_basic_user_file /etc/nginx/secrets/.htpasswd;
191-
proxy_pass http://monitoring-loki-distributor.observability.svc.cluster.local:3100;
192-
proxy_http_version 1.1;
193-
}
194-
195-
# Log query/read paths (selectively authenticated via map)
196-
location / {
197-
auth_basic {{ print "$" }}auth_realm;
198-
auth_basic_user_file /etc/nginx/secrets/.htpasswd;
199-
proxy_pass http://monitoring-loki-query-frontend.observability.svc.cluster.local:3100;
200-
proxy_http_version 1.1;
201-
}
202-
203-
# Readiness path for distributor
204-
location = /ready {
205-
proxy_pass http://monitoring-loki-distributor.observability.svc.cluster.local:3100;
206-
auth_basic off;
207-
}
208-
}
209-
}
210163
211164
backend:
212165
replicas: 0

0 commit comments

Comments
 (0)