Skip to content

Commit

Permalink
Change smarter-k3s-edge to be able to be embedded in another website
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
  • Loading branch information
alexandref75 committed Apr 4, 2023
1 parent f7c09be commit f489806
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/smarter-k3s-edge/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: smarter-k3s-edge
version: 0.0.9
version: 0.0.10
type: application
appVersion: v1.25.3-k3s1
description: K3s server on kubernetes
Expand Down
10 changes: 5 additions & 5 deletions charts/smarter-k3s-edge/templates/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ data:
add_header X-Content-Type-Options nosniff;
root /var/www/html;
server_name _;
location / {
location {{ .Values.configuration.wwwpath }} {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
Expand Down Expand Up @@ -150,14 +150,14 @@ data:
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
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
{{- end }}
mkdir -p /var/www/html
mkdir -p /var/www/html{{ .Values.configuration.wwwpath }}
until [ -f /etc/rancher/k3s/k3s.yaml ]
do
sleep 1
done
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 }}
ln -s /var/lib/rancher/k3s/server/token /var/www/html/token.{{ .Values.configuration.id }}
ln -s /etc/nginx/conf.d/k3s-start.sh /var/www/html/k3s-start.sh.{{ .Values.configuration.id }}
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 }}
ln -s /var/lib/rancher/k3s/server/token /var/www/html{{ .Values.configuration.wwwpath }}token.{{ .Values.configuration.id }}
ln -s /etc/nginx/conf.d/k3s-start.sh /var/www/html{{ .Values.configuration.wwwpath }}k3s-start.sh.{{ .Values.configuration.id }}
chmod -R ago+rw /var/www/html
nginx -c /etc/nginx/conf.d/default.conf -g 'daemon off;'
---
Expand Down
4 changes: 2 additions & 2 deletions charts/smarter-k3s-edge/templates/k3s-edge-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ spec:
- host: {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
http:
paths:
- path: /
- path: {{ .Values.configuration.wwwpath }}
pathType: Prefix
backend:
service:
name: {{ .Values.application.appName }}-http
port:
number: {{ .Values.configuration.portHTTP }}
tls:
- secretName: {{ .Values.application.appName }}-tls
- secretName: {{ .Values.configuration.certificateID }}
hosts:
- {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
---
Expand Down
2 changes: 2 additions & 0 deletions charts/smarter-k3s-edge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ configuration:
#traefik: True
# Uncomment to enable labeling for smarter-demo
#smarter_demo_labels: true
wwwpath: /
certificateID: "{{ .Values.application.appName }}-tls"

0 comments on commit f489806

Please sign in to comment.