Skip to content

Commit b8b9af0

Browse files
committed
caddy: abstract individual services into objects in values.yaml
1 parent 30130eb commit b8b9af0

File tree

2 files changed

+40
-37
lines changed

2 files changed

+40
-37
lines changed

resources/charts/caddy/templates/configmap.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ metadata:
66
{{- include "caddy.labels" . | nindent 4 }}
77
data:
88
Caddyfile: |
9-
{{- .Values.caddyConfig | nindent 4 }}
9+
:80 {
10+
respond /live 200
11+
respond /ready 200
12+
13+
root * /usr/share/caddy
14+
file_server
15+
16+
{{- range .Values.services }}
17+
handle_path {{ .path }}* {
18+
reverse_proxy {{ .host }}:{{ .port }}
19+
}
20+
{{- end }}
21+
}
1022
index: |
11-
{{- .Values.htmlConfig | nindent 4 }}
23+
<!DOCTYPE html>
24+
<html lang="en">
25+
<head>
26+
<meta charset="UTF-8">
27+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
28+
<title>Warnet Dashboard</title>
29+
</head>
30+
<body>
31+
<h1>Welcome to the Warnet dashboard</h1>
32+
<p>You can access the following services:</p>
33+
<ul>
34+
{{- range .Values.services }}
35+
<li><a href="{{ .path }}">{{ .title }}</a></li>
36+
{{- end }}
37+
</ul>
38+
</body>
39+
</html>

resources/charts/caddy/values.yaml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -86,38 +86,13 @@ volumeMounts:
8686

8787
port: 80
8888

89-
caddyConfig: |
90-
:80 {
91-
respond /live 200
92-
respond /ready 200
93-
94-
root * /usr/share/caddy
95-
file_server
96-
97-
handle_path /fork-observer/* {
98-
reverse_proxy fork-observer:2323
99-
}
100-
101-
handle_path /grafana/* {
102-
reverse_proxy loki-grafana:80
103-
}
104-
105-
}
106-
107-
htmlConfig: |
108-
<!DOCTYPE html>
109-
<html lang="en">
110-
<head>
111-
<meta charset="UTF-8">
112-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
113-
<title>Welcome</title>
114-
</head>
115-
<body>
116-
<h1>Welcome to the Warnet dashboard</h1>
117-
<p>You can access the following services:</p>
118-
<ul>
119-
<li><a href="/grafana/">Grafana</a></li>
120-
<li><a href="/fork-observer/">Fork Observer</a></li>
121-
</ul>
122-
</body>
123-
</html>
89+
services:
90+
- title: Grafana
91+
path: /grafana/
92+
host: loki-grafana
93+
port: 80
94+
- title: Fork Observer
95+
path: /fork-observer/
96+
host: fork-observer
97+
port: 2323
98+

0 commit comments

Comments
 (0)