Skip to content

Commit 9e121ad

Browse files
Merge pull request openshift#7276 from pawanpinjarkar/decompress-kernel-new
AGENT-627: Decompress kernel on ARM
2 parents 9f9636e + a0376a1 commit 9e121ad

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Verify a default configuration for the SNO topology for ARM architecture
2+
3+
exec openshift-install agent create pxe-files --dir $WORK
4+
5+
stderr 'Created iPXE script agent.aarch64.ipxe'
6+
7+
exists $WORK/pxe/agent.aarch64-initrd.img
8+
exists $WORK/pxe/agent.aarch64-rootfs.img
9+
exists $WORK/pxe/agent.aarch64-vmlinuz
10+
exists $WORK/auth/kubeconfig
11+
exists $WORK/auth/kubeadmin-password
12+
13+
cmp $WORK/pxe/agent.aarch64.ipxe $WORK/expected/agent.aarch64.ipxe
14+
15+
-- install-config.yaml --
16+
apiVersion: v1
17+
baseDomain: test.metalkube.org
18+
controlPlane:
19+
name: master
20+
replicas: 1
21+
architecture: arm64
22+
compute:
23+
- name: worker
24+
replicas: 0
25+
architecture: arm64
26+
metadata:
27+
namespace: cluster0
28+
name: ostest
29+
networking:
30+
clusterNetwork:
31+
- cidr: 10.128.0.0/14
32+
hostPrefix: 23
33+
networkType: OVNKubernetes
34+
machineNetwork:
35+
- cidr: 192.168.111.0/24
36+
serviceNetwork:
37+
- 172.30.0.0/16
38+
platform:
39+
none: {}
40+
sshKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=
41+
pullSecret: '{"auths": {"quay.io": {"auth": "c3VwZXItc2VjcmV0Cg=="}}}'
42+
43+
-- agent-config.yaml --
44+
apiVersion: v1alpha1
45+
metadata:
46+
name: ostest
47+
namespace: cluster0
48+
rendezvousIP: 192.168.111.20
49+
ipxeBaseURL: http://user-specified-pxe-infra.com
50+
51+
-- expected/agent.aarch64.ipxe --
52+
#!ipxe
53+
initrd --name initrd http://user-specified-pxe-infra.com/agent.aarch64-initrd.img
54+
kernel http://user-specified-pxe-infra.com/agent.aarch64-vmlinuz initrd=initrd coreos.live.rootfs_url=http://user-specified-pxe-infra.com/agent.aarch64-rootfs.img ignition.firstboot ignition.platform.id=metal
55+
boot

pkg/asset/agent/image/agentpxefiles.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package image
22

33
import (
4+
"compress/gzip"
45
"encoding/json"
56
"errors"
67
"fmt"
@@ -9,11 +10,13 @@ import (
910
"path/filepath"
1011
"strings"
1112

13+
"github.com/coreos/stream-metadata-go/arch"
1214
"github.com/sirupsen/logrus"
1315

1416
"github.com/openshift/assisted-image-service/pkg/isoeditor"
1517
"github.com/openshift/installer/pkg/asset"
1618
config "github.com/openshift/installer/pkg/asset/agent/agentconfig"
19+
"github.com/openshift/installer/pkg/types"
1720
)
1821

1922
const (
@@ -120,9 +123,22 @@ func (a *AgentPXEFiles) PersistToFile(directory string) error {
120123
return err
121124
}
122125
defer kernelReader.Close()
123-
err = a.copy(agentVmlinuzFile, kernelReader)
124-
if err != nil {
125-
return err
126+
127+
if a.cpuArch == arch.RpmArch(types.ArchitectureARM64) {
128+
gzipReader, err := gzip.NewReader(kernelReader)
129+
if err != nil {
130+
panic(err)
131+
}
132+
defer gzipReader.Close()
133+
err = a.copy(agentVmlinuzFile, gzipReader)
134+
if err != nil {
135+
return err
136+
}
137+
} else {
138+
err = a.copy(agentVmlinuzFile, kernelReader)
139+
if err != nil {
140+
return err
141+
}
126142
}
127143

128144
if a.ipxeBaseURL != "" {

0 commit comments

Comments
 (0)