Skip to content

Commit f489806

Browse files
committed
Change smarter-k3s-edge to be able to be embedded in another website
Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
1 parent f7c09be commit f489806

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

charts/smarter-k3s-edge/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: smarter-k3s-edge
3-
version: 0.0.9
3+
version: 0.0.10
44
type: application
55
appVersion: v1.25.3-k3s1
66
description: K3s server on kubernetes

charts/smarter-k3s-edge/templates/common.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ data:
8181
add_header X-Content-Type-Options nosniff;
8282
root /var/www/html;
8383
server_name _;
84-
location / {
84+
location {{ .Values.configuration.wwwpath }} {
8585
# First attempt to serve request as file, then
8686
# as directory, then fall back to displaying a 404.
8787
try_files $uri $uri/ =404;
@@ -150,14 +150,14 @@ data:
150150
echo -e "US\n\n\nSmarter\n\n"{{ default .Values.configuration.hostIP .Values.configuration.externalHostIP }}"\n\n" | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
151151
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
152152
{{- end }}
153-
mkdir -p /var/www/html
153+
mkdir -p /var/www/html{{ .Values.configuration.wwwpath }}
154154
until [ -f /etc/rancher/k3s/k3s.yaml ]
155155
do
156156
sleep 1
157157
done
158-
sed -e "s/127\.0\.0\.1/"{{ default .Values.configuration.hostIP .Values.configuration.externalHostIP }}"/" /etc/rancher/k3s/k3s.yaml > /var/www/html/k3s.yaml.{{ .Values.configuration.id }}
159-
ln -s /var/lib/rancher/k3s/server/token /var/www/html/token.{{ .Values.configuration.id }}
160-
ln -s /etc/nginx/conf.d/k3s-start.sh /var/www/html/k3s-start.sh.{{ .Values.configuration.id }}
158+
sed -e "s/127\.0\.0\.1/"{{ default .Values.configuration.hostIP .Values.configuration.externalHostIP }}"/" /etc/rancher/k3s/k3s.yaml > /var/www/html{{ .Values.configuration.wwwpath }}k3s.yaml.{{ .Values.configuration.id }}
159+
ln -s /var/lib/rancher/k3s/server/token /var/www/html{{ .Values.configuration.wwwpath }}token.{{ .Values.configuration.id }}
160+
ln -s /etc/nginx/conf.d/k3s-start.sh /var/www/html{{ .Values.configuration.wwwpath }}k3s-start.sh.{{ .Values.configuration.id }}
161161
chmod -R ago+rw /var/www/html
162162
nginx -c /etc/nginx/conf.d/default.conf -g 'daemon off;'
163163
---

charts/smarter-k3s-edge/templates/k3s-edge-ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ spec:
1111
- host: {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
1212
http:
1313
paths:
14-
- path: /
14+
- path: {{ .Values.configuration.wwwpath }}
1515
pathType: Prefix
1616
backend:
1717
service:
1818
name: {{ .Values.application.appName }}-http
1919
port:
2020
number: {{ .Values.configuration.portHTTP }}
2121
tls:
22-
- secretName: {{ .Values.application.appName }}-tls
22+
- secretName: {{ .Values.configuration.certificateID }}
2323
hosts:
2424
- {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
2525
---

charts/smarter-k3s-edge/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ configuration:
2323
#traefik: True
2424
# Uncomment to enable labeling for smarter-demo
2525
#smarter_demo_labels: true
26+
wwwpath: /
27+
certificateID: "{{ .Values.application.appName }}-tls"

0 commit comments

Comments
 (0)