Skip to content

Commit

Permalink
kubeadm: install helm via Ignition
Browse files Browse the repository at this point in the history
this can be used to ease the testing of complexe kubernetes deployment

Signed-off-by: Mathieu Tortuyaux <[email protected]>
  • Loading branch information
tormath1 committed Nov 9, 2023
1 parent 4440170 commit 6d15b29
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kola/tests/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var (
// and the nested params are used to render script templates
testConfig = map[string]map[string]interface{}{
"v1.28.1": map[string]interface{}{
"HelmVersion": "v3.13.2",
"MinMajorVersion": 3374,
// from https://github.com/flannel-io/flannel/releases
"FlannelVersion": "v0.22.0",
Expand Down Expand Up @@ -108,6 +109,7 @@ var (
"cgroupv1": false,
},
"v1.27.2": map[string]interface{}{
"HelmVersion": "v3.13.2",
"MinMajorVersion": 3374,
// from https://github.com/flannel-io/flannel/releases
"FlannelVersion": "v0.22.0",
Expand Down Expand Up @@ -140,6 +142,7 @@ var (
"cgroupv1": false,
},
"v1.26.5": map[string]interface{}{
"HelmVersion": "v3.13.2",
"MinMajorVersion": 3374,
// from https://github.com/flannel-io/flannel/releases
"FlannelVersion": "v0.20.2",
Expand Down
2 changes: 2 additions & 0 deletions kola/tests/kubeadm/kubeadm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestRenderTemplate(t *testing.T) {
res, err := render(
masterScript,
map[string]interface{}{
"HelmVersion": "1.2.3",
"CiliumVersion": "v0.11.1",
"FlannelVersion": "v0.14.0",
"CNI": CNI,
Expand Down Expand Up @@ -84,6 +85,7 @@ func TestRenderTemplate(t *testing.T) {
res, err := render(
masterConfig,
map[string]interface{}{
"HelmVersion": "1.2.3",
"CiliumVersion": "v0.11.1",
"CNI": "cilium",
"CiliumCLIVersion": "v0.9.0",
Expand Down
21 changes: 21 additions & 0 deletions kola/tests/kubeadm/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ storage:
ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-{{ .Arch }}.tar.gz"
[Install]
WantedBy=multi-user.target
- name: prepare-helm.service
enabled: true
contents: |
[Unit]
Description=Unpack helm to /opt/bin
ConditionPathExists=!/opt/bin/helm
[Service]
Type=oneshot
RemainAfterExit=true
Restart=on-failure
ExecStartPre=/usr/bin/mkdir --parents "{{ .DownloadDir }}"
ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz" --directory "{{ .DownloadDir }}" --strip-components=1 --no-same-owner
ExecStart=/usr/bin/rm "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz"
[Install]
WantedBy=multi-user.target
storage:
files:{{ if .cgroupv1 }}
- path: /etc/flatcar-cgroupv1
Expand Down Expand Up @@ -216,6 +231,12 @@ storage:
hash:
function: sha512
sum: {{ index (index . .Arch) "KubectlSum" }}
- path: /opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz
filesystem: root
mode: 0755
contents:
remote:
url: https://get.helm.sh/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz
- path: /etc/docker/daemon.json
filesystem: root
mode: 0644
Expand Down
21 changes: 21 additions & 0 deletions kola/tests/kubeadm/testdata/master-cilium-amd64-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ systemd:
ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz"
[Install]
WantedBy=multi-user.target
- name: prepare-helm.service
enabled: true
contents: |
[Unit]
Description=Unpack helm to /opt/bin
ConditionPathExists=!/opt/bin/helm
[Service]
Type=oneshot
RemainAfterExit=true
Restart=on-failure
ExecStartPre=/usr/bin/mkdir --parents "/opt/bin"
ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-amd64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner
ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-amd64.tar.gz"
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /opt/cni-plugins-linux-amd64-v0.8.7.tgz
Expand Down Expand Up @@ -86,6 +101,12 @@ storage:
hash:
function: sha512
sum: a93b2ca067629cb1fe9cbf1af1a195c12126488ed321e3652200d4dbfee9a577865647b7ef6bb673e1bdf08f03108b5dcb4b05812a649a0de5c7c9efc1407810
- path: /opt/helm-1.2.3-linux-amd64.tar.gz
filesystem: root
mode: 0755
contents:
remote:
url: https://get.helm.sh/helm-1.2.3-linux-amd64.tar.gz
- path: /etc/docker/daemon.json
filesystem: root
mode: 0644
Expand Down
21 changes: 21 additions & 0 deletions kola/tests/kubeadm/testdata/master-cilium-arm64-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ systemd:
ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-arm64.tar.gz"
[Install]
WantedBy=multi-user.target
- name: prepare-helm.service
enabled: true
contents: |
[Unit]
Description=Unpack helm to /opt/bin
ConditionPathExists=!/opt/bin/helm
[Service]
Type=oneshot
RemainAfterExit=true
Restart=on-failure
ExecStartPre=/usr/bin/mkdir --parents "/opt/bin"
ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-arm64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner
ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-arm64.tar.gz"
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /opt/cni-plugins-linux-arm64-v0.8.7.tgz
Expand Down Expand Up @@ -86,6 +101,12 @@ storage:
hash:
function: sha512
sum: b990b81d5a885a9d131aabcc3a5ca9c37dfaff701470f2beb896682a8643c7e0c833e479a26f21129b598ac981732bf52eecdbe73896fe0ff2d9c1ffd082d1fd
- path: /opt/helm-1.2.3-linux-arm64.tar.gz
filesystem: root
mode: 0755
contents:
remote:
url: https://get.helm.sh/helm-1.2.3-linux-arm64.tar.gz
- path: /etc/docker/daemon.json
filesystem: root
mode: 0644
Expand Down

0 comments on commit 6d15b29

Please sign in to comment.