Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix k0s installation in airgap env #791

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hack/k0s-ag-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:1.27
ARG K0S_VERSION
ADD default.conf /etc/nginx/conf.d/default.conf
ADD --chown=nginx https://github.com/k0sproject/k0s/releases/download/${K0S_VERSION}/k0s-${K0S_VERSION}-amd64 /var/www/html/k0s
ADD --chown=nginx https://github.com/k0sproject/k0s/releases/download/${K0S_VERSION}/k0s-airgap-bundle-${K0S_VERSION}-amd64 /var/www/html/k0s-airgap-bundle
21 changes: 21 additions & 0 deletions hack/k0s-ag-image/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server {
proxy_max_temp_file_size 0;
listen 80;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_name localhost;

keepalive_timeout 70;

root /var/www/html;
location / {
}

client_max_body_size 512m;

location /heathz {
return 200 'OK';
}

}
2 changes: 1 addition & 1 deletion templates/cluster/vsphere-standalone-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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.0.3
version: 0.0.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
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ spec:
replicas: {{ .Values.controlPlaneNumber }}
version: {{ .Values.k0s.version }}
k0sConfigSpec:
{{- if .Values.airgap }}
downloadURL: {{ .Values.k0s.downloadURL }}
{{- end }}
files:
- path: /home/{{ .Values.controlPlane.ssh.user }}/.ssh/authorized_keys
permissions: "0600"
content: "{{ trim .Values.controlPlane.ssh.publicKey }}"
preStartCommands:
{{- if .Values.airgap }}
- mkdir -p /var/lib/k0s/images
- curl -fsL {{ .Values.k0s.bundleURL }} -o /var/lib/k0s/images/k0s-airgap-bundle
{{- end }}
- chown {{ .Values.controlPlane.ssh.user }} /home/{{ .Values.controlPlane.ssh.user }}/.ssh/authorized_keys
- sed -i 's/"externalAddress":"{{ .Values.controlPlaneEndpointIP }}",//' /etc/k0s.yaml
args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ spec:
template:
spec:
version: {{ .Values.k0s.version }}
{{ if .Values.airgap }}
downloadURL: {{ .Values.k0s.downloadURL }}
{{- end }}
files:
- path: /home/{{ .Values.worker.ssh.user }}/.ssh/authorized_keys
permissions: "0600"
content: "{{ trim .Values.worker.ssh.publicKey }}"
preStartCommands:
{{ if .Values.airgap }}
- mkdir -p /var/lib/k0s/images
- curl -fsL {{ .Values.k0s.bundleURL }} -o /var/lib/k0s/images/k0s-airgap-bundle
{{- end }}
- chown {{ .Values.worker.ssh.user }} /home/{{ .Values.worker.ssh.user }}/.ssh/authorized_keys
12 changes: 12 additions & 0 deletions templates/cluster/vsphere-standalone-cp/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"type": "number",
"minimum": 1
},
"airgap": {
"description": "Cluster created in airgap env",
"type": "boolean"
},
"clusterNetwork": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -198,6 +202,14 @@
"version":{
"description": "K0s version to use",
"type": "string"
},
"downloadURL":{
"description": "K0s download URL",
"type": "string"
},
"bundleURL":{
"description": "K0s airgap bundle URL",
"type": "string"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions templates/cluster/vsphere-standalone-cp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ worker:
# K0s parameters
k0s:
version: v1.31.1+k0s.1
downloadURL: ""
bundleURL: ""

# extensions defines custom Helm and image repositories to use for pulling
# k0s extensions.
extensions:
chartRepository: ""
imageRepository: ""

airgap: false
Loading