Skip to content

Commit af0737d

Browse files
committed
Change smarter-k3s-edge to 0.0.7
Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
1 parent 3bffbe8 commit af0737d

File tree

5 files changed

+62
-14
lines changed

5 files changed

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

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

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.configuration.portHTTPS }}
1+
{{- if or .Values.configuration.portHTTP .Values.configuration.portHTTPS }}
22
apiVersion: v1
33
kind: PersistentVolumeClaim
44
metadata:
@@ -46,14 +46,14 @@ data:
4646
4747
#gzip on;
4848
49-
server {
50-
listen 80 default_server;
51-
listen [::]:80 default_server;
52-
server_name server_domain_or_IP;
53-
return 302 https://$server_name$request_uri;
54-
}
5549
server {
5650
disable_symlinks off;
51+
{{- if .Values.configuration.portHTTP }}
52+
listen {{ .Values.configuration.portHTTP }} default_server;
53+
listen [::]:{{ .Values.configuration.portHTTP }} default_server;
54+
server_name server_domain_or_IP;
55+
{{- end }}
56+
{{- if .Values.configuration.portHTTPS }} i
5757
# SSL configuration
5858
listen {{ .Values.configuration.portHTTPS }} ssl http2 default_server;
5959
listen [::]:{{ .Values.configuration.portHTTPS }} ssl http2 default_server;
@@ -71,13 +71,14 @@ data:
7171
ssl_stapling_verify on;
7272
resolver 8.8.8.8 8.8.4.4 valid=300s;
7373
resolver_timeout 5s;
74+
ssl_dhparam /etc/ssl/certs/dhparam.pem;
75+
{{- end }}
7476
# Disable preloading HSTS for now. You can use the commented out header line that includes
7577
# the "preload" directive if you understand the implications.
7678
#add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
7779
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
7880
add_header X-Frame-Options DENY;
7981
add_header X-Content-Type-Options nosniff;
80-
ssl_dhparam /etc/ssl/certs/dhparam.pem;
8182
root /var/www/html;
8283
server_name _;
8384
location / {
@@ -112,8 +113,13 @@ data:
112113
k3s-start.sh: |
113114
#!/bin/bash
114115
#
116+
{{- if .Values.configuration.traefik }}
117+
curl -sflkO https://{{ .Values.configuration.host }}.{{ .Values.configuration.domain }}/token.{{ .Values.configuration.id }}
118+
curl -sflkO https://{{ .Values.configuration.host }}.{{ .Values.configuration.domain }}/k3s.yaml.{{ .Values.configuration.id }}
119+
{{- else }}
115120
curl -sflkO https://{{ default .Values.configuration.hostIP .Values.configuration.externalHostIP}}:{{ .Values.configuration.portHTTPS }}/token.{{ .Values.configuration.id }}
116121
curl -sflkO https://{{ default .Values.configuration.hostIP .Values.configuration.externalHostIP}}:{{ .Values.configuration.portHTTPS }}/k3s.yaml.{{ .Values.configuration.id }}
122+
{{- end }}
117123
export INSTALL_K3S_VERSION=$(echo "{{ default .Chart.AppVersion .Values.image.tag }}" | sed -e "s/-k3/+k3/")
118124
export K3S_TOKEN=$(cat token.{{ .Values.configuration.id }})
119125
export K3S_URL=$(grep server: k3s.yaml.{{ .Values.configuration.id }} | sed -e "s/^ *.server: *//")
@@ -140,8 +146,10 @@ data:
140146
#
141147
apk update
142148
apk add openssl
149+
{{- if .Values.configuration.portHTTPS }} i
143150
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
144151
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
152+
{{- end }}
145153
mkdir -p /var/www/html
146154
until [ -f /etc/rancher/k3s/k3s.yaml ]
147155
do
@@ -185,7 +193,7 @@ spec:
185193
"--disable","coredns",
186194
"--disable","local-storage",
187195
"--flannel-backend=none" ]
188-
{{- if .Values.configuration.portHTTPS }}
196+
{{- if or .Values.configuration.portHTTP .Values.configuration.portHTTPS }}
189197
volumeMounts:
190198
- name: k3s-data
191199
mountPath: /var/lib/rancher/k3s
@@ -194,7 +202,7 @@ spec:
194202
{{- end }}
195203
ports:
196204
- containerPort: {{ .Values.configuration.port }}
197-
{{- if .Values.configuration.portHTTPS }}
205+
{{- if or .Values.configuration.portHTTP .Values.configuration.portHTTPS }}
198206
- name: {{ .Values.application.appName }}-nginx
199207
image: nginx:1.23.2-alpine
200208
command: [ "/bin/sh",
@@ -207,10 +215,15 @@ spec:
207215
- name: config
208216
mountPath: /etc/nginx/conf.d
209217
ports:
218+
{{- if .Values.configuration.portHTTP }}
219+
- containerPort: {{ .Values.configuration.portHTTP }}
220+
{{- end }}
221+
{{- if .Values.configuration.portHTTPS }}
210222
- containerPort: {{ .Values.configuration.portHTTPS }}
223+
{{- end }}
211224
{{- end }}
212225
volumes:
213-
{{- if .Values.configuration.portHTTPS }}
226+
{{- if or .Values.configuration.portHTTP .Values.configuration.portHTTPS }}
214227
- name: k3s-data
215228
persistentVolumeClaim:
216229
claimName: {{ .Values.application.appName }}-data
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- if .Values.configuration.traefik }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ .Release.Name }}-k3s-edge-ingress
6+
annotations:
7+
kubernetes.io/ingress.class: traefik
8+
cert-manager.io/cluster-issuer: cert-manager-acme-issuer
9+
spec:
10+
rules:
11+
- host: {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
12+
http:
13+
paths:
14+
- path: /
15+
pathType: Prefix
16+
backend:
17+
service:
18+
name: {{ .Values.application.appName }}
19+
port:
20+
number: {{ .Values.configuration.portHTTP }}
21+
tls:
22+
- secretName: {{ .Release.Name }}-k3s-edge-tls
23+
hosts:
24+
- {{ .Values.configuration.host }}.{{ .Values.configuration.domain }}
25+
{{- end }}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ spec:
1111
- protocol: TCP
1212
port: {{ .Values.configuration.port }}
1313
name: {{ .Values.application.appName }}
14+
{{- if .Values.configuration.portHTTP }}
15+
- protocol: TCP
16+
port: {{ .Values.configuration.portHTTP }}
17+
name: {{ .Values.application.appName }}-http
18+
{{- end }}
1419
{{- if .Values.configuration.portHTTPS }}
1520
- protocol: TCP
1621
port: {{ .Values.configuration.portHTTPS }}

charts/smarter-k3s-edge/values.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ image:
1010
pullPolicy: IfNotPresent
1111

1212
configuration:
13+
host: k3s-edge
14+
domain: example.com
1315
hostIP: 192.168.2.222
1416
# Use this in case of NATed AWS
15-
#externalHostIP: 192.168.2.222
17+
externalHostIP: 192.168.2.222
1618
port: 6443
1719
# Comment to remove NGINX
18-
portHTTPS: 6453
20+
portHTTP: 80
21+
#portHTTPS: 6453
22+
# Uncomment to enable traefik ingress
23+
#traefik: True
1924
# Uncomment to enable labeling for smarter-demo
2025
#smarter_demo_labels: true

0 commit comments

Comments
 (0)