Skip to content

Commit 12b1bc0

Browse files
authored
Test k3s edge (#27)
* Change k3s.yaml from 127.0.0.1 to correct IP Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> * Fix chart version so artifacts are created Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> --------- Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
1 parent 82e4e63 commit 12b1bc0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
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.3
3+
version: 0.0.4
44
type: application
55
appVersion: v1.25.3-k3s1
66
description: K3s server on kubernetes

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ data:
127127
--node-label smarter.type=edge \\
128128
--node-taint smarter.type=edge:NoSchedule \\
129129
--node-label smarter-build=user-installed
130+
nginx-start.sh: |
131+
#!/bin/bash
132+
#
133+
apk update
134+
apk add openssl
135+
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
136+
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
137+
mkdir -p /var/www/html
138+
until [ -f /etc/rancher/k3s/k3s.yaml ]
139+
do
140+
sleep 1
141+
done
142+
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 }}
143+
ln -s /var/lib/rancher/k3s/server/token /var/www/html/token.{{ .Values.configuration.id }}
144+
ln -s /etc/nginx/conf.d/k3s-start.sh /var/www/html/k3s-start.sh.{{ .Values.configuration.id }}
145+
chmod -R ago+rw /var/www/html
146+
nginx -c /etc/nginx/conf.d/default.conf -g 'daemon off;'
130147
---
131148
{{- end }}
132149
apiVersion: apps/v1
@@ -173,8 +190,7 @@ spec:
173190
- name: {{ .Values.application.appName }}-nginx
174191
image: nginx:1.23.2-alpine
175192
command: [ "/bin/sh",
176-
"-c",
177-
"apk update;apk add openssl;echo -e '\n\n\n\n\n\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;mkdir -p /var/www/html;ln -s /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 }};chmod -R ago+rw /var/www/html;nginx -c /etc/nginx/conf.d/default.conf -g 'daemon off;'" ]
193+
"/etc/nginx/conf.d/nginx-start.sh"]
178194
volumeMounts:
179195
- name: k3s-data
180196
mountPath: /var/lib/rancher/k3s

0 commit comments

Comments
 (0)