From 650dcdbf43d42d5b9e6ee155cf8b0a00dc104f7f Mon Sep 17 00:00:00 2001 From: Alexandre Peixoto Ferreira Date: Thu, 16 Feb 2023 16:28:14 -0600 Subject: [PATCH 1/4] Change k3s.yaml from 127.0.0.1 to correct IP Signed-off-by: Alexandre Peixoto Ferreira --- charts/smarter-k3s-edge/templates/common.yaml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/charts/smarter-k3s-edge/templates/common.yaml b/charts/smarter-k3s-edge/templates/common.yaml index c748663..4d5980a 100644 --- a/charts/smarter-k3s-edge/templates/common.yaml +++ b/charts/smarter-k3s-edge/templates/common.yaml @@ -127,6 +127,23 @@ data: --node-label smarter.type=edge \\ --node-taint smarter.type=edge:NoSchedule \\ --node-label smarter-build=user-installed + nginx-start.sh: | + #!/bin/bash + # + apk update + apk add openssl + 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 + mkdir -p /var/www/html + 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 }} + chmod -R ago+rw /var/www/html + nginx -c /etc/nginx/conf.d/default.conf -g 'daemon off;' --- {{- end }} apiVersion: apps/v1 @@ -173,8 +190,7 @@ spec: - name: {{ .Values.application.appName }}-nginx image: nginx:1.23.2-alpine command: [ "/bin/sh", - "-c", - "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;'" ] + "/etc/nginx/conf.d/nginx-start.sh"] volumeMounts: - name: k3s-data mountPath: /var/lib/rancher/k3s From a62665f54537dcdc34b9764cdff4b25cc7a3969c Mon Sep 17 00:00:00 2001 From: Alexandre Peixoto Ferreira Date: Thu, 16 Feb 2023 16:59:06 -0600 Subject: [PATCH 2/4] Fix chart version so artifacts are created Signed-off-by: Alexandre Peixoto Ferreira --- charts/smarter-k3s-edge/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/smarter-k3s-edge/Chart.yaml b/charts/smarter-k3s-edge/Chart.yaml index 4909df6..9413763 100644 --- a/charts/smarter-k3s-edge/Chart.yaml +++ b/charts/smarter-k3s-edge/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: smarter-k3s-edge -version: 0.0.3 +version: 0.0.4 type: application appVersion: v1.25.3-k3s1 description: K3s server on kubernetes From e91a93a538a299a5610aa0d3c4b711a14e5b4f51 Mon Sep 17 00:00:00 2001 From: Alexandre Peixoto Ferreira Date: Thu, 23 Feb 2023 17:04:55 -0600 Subject: [PATCH 3/4] Fix k3s-start.sh script Signed-off-by: Alexandre Peixoto Ferreira --- charts/smarter-k3s-edge/Chart.yaml | 2 +- charts/smarter-k3s-edge/templates/common.yaml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/charts/smarter-k3s-edge/Chart.yaml b/charts/smarter-k3s-edge/Chart.yaml index 9413763..12d629a 100644 --- a/charts/smarter-k3s-edge/Chart.yaml +++ b/charts/smarter-k3s-edge/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: smarter-k3s-edge -version: 0.0.4 +version: 0.0.5 type: application appVersion: v1.25.3-k3s1 description: K3s server on kubernetes diff --git a/charts/smarter-k3s-edge/templates/common.yaml b/charts/smarter-k3s-edge/templates/common.yaml index 4d5980a..6bc0ee1 100644 --- a/charts/smarter-k3s-edge/templates/common.yaml +++ b/charts/smarter-k3s-edge/templates/common.yaml @@ -118,14 +118,14 @@ data: export K3S_TOKEN=$(cat token.{{ .Values.configuration.id }}) export K3S_URL=$(grep server: k3s.yaml.{{ .Values.configuration.id }} | sed -e "s/^ *.server: *//") - curl -sfL https://get.k3s.io | \\ - sh -s - \\ - --kubelet-arg cluster-dns=169.254.0.2 \\ - --log /var/log/k3s.log \\ - --node-label smarter.nodetype=unknown \\ - --node-label smarter.nodemodel=unknown \\ - --node-label smarter.type=edge \\ - --node-taint smarter.type=edge:NoSchedule \\ + curl -sfL https://get.k3s.io | \ + sh -s - \ + --kubelet-arg cluster-dns=169.254.0.2 \ + --log /var/log/k3s.log \ + --node-label smarter.nodetype=unknown \ + --node-label smarter.nodemodel=unknown \ + --node-label smarter.type=edge \ + --node-taint smarter.type=edge:NoSchedule \ --node-label smarter-build=user-installed nginx-start.sh: | #!/bin/bash From 9261c86dde660bb7e83992b4c5fd5da3a2204017 Mon Sep 17 00:00:00 2001 From: Alexandre Peixoto Ferreira Date: Fri, 24 Feb 2023 13:59:39 -0600 Subject: [PATCH 4/4] Allow grafana host to be renamed Signed-off-by: Alexandre Peixoto Ferreira --- charts/smarter-cloud/Chart.yaml | 2 +- charts/smarter-cloud/templates/NOTES.txt | 2 +- charts/smarter-cloud/templates/grafana-ingress.yaml | 4 ++-- charts/smarter-cloud/values.yaml | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/charts/smarter-cloud/Chart.yaml b/charts/smarter-cloud/Chart.yaml index dcad7a1..7426b35 100644 --- a/charts/smarter-cloud/Chart.yaml +++ b/charts/smarter-cloud/Chart.yaml @@ -17,7 +17,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.3 +version: 0.1.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/smarter-cloud/templates/NOTES.txt b/charts/smarter-cloud/templates/NOTES.txt index 5eb9e49..b9ed3db 100644 --- a/charts/smarter-cloud/templates/NOTES.txt +++ b/charts/smarter-cloud/templates/NOTES.txt @@ -2,5 +2,5 @@ Your SMARTER cloud instance has been deployed. Next deploy an edge server and e For more details and instructions go to https://getsmarter.io If you deployed your instance correctly, you should be able to log into grafana at -https://grafana.{{ .Values.domain }} with the username admin and the password {{ .Values.prometheus.grafana.adminPassword }} +https://{{ .Values.host }}.{{ .Values.domain }} with the username admin and the password {{ .Values.prometheus.grafana.adminPassword }} diff --git a/charts/smarter-cloud/templates/grafana-ingress.yaml b/charts/smarter-cloud/templates/grafana-ingress.yaml index 775bb9f..c92a412 100644 --- a/charts/smarter-cloud/templates/grafana-ingress.yaml +++ b/charts/smarter-cloud/templates/grafana-ingress.yaml @@ -7,7 +7,7 @@ metadata: cert-manager.io/cluster-issuer: cert-manager-acme-issuer spec: rules: - - host: grafana.{{ .Values.domain }} + - host: {{ .Values.host }}.{{ .Values.domain }} http: paths: - path: / @@ -20,4 +20,4 @@ spec: tls: - secretName: {{ .Release.Name }}-grafana-tls hosts: - - grafana.{{ .Values.domain }} \ No newline at end of file + - {{ .Values.host }}.{{ .Values.domain }} diff --git a/charts/smarter-cloud/values.yaml b/charts/smarter-cloud/values.yaml index ef4a01d..a4eb93f 100644 --- a/charts/smarter-cloud/values.yaml +++ b/charts/smarter-cloud/values.yaml @@ -2,6 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +host: grafana domain: example.com cert-manager: