Skip to content

Commit 885ac37

Browse files
committed
changes for s390x
1 parent 898c5e4 commit 885ac37

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

pkg/asset/agent/image/agentpxefiles.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ func (a *AgentPXEFiles) PersistToFile(directory string) error {
9292
if err != nil {
9393
return err
9494
}
95-
96-
agentVmlinuzFile := filepath.Join(bootArtifactsFullPath, fmt.Sprintf("agent.%s-vmlinuz", a.cpuArch))
97-
kernelReader, err := os.Open(filepath.Join(a.tmpPath, "images", "pxeboot", "vmlinuz"))
95+
kernelFileType := "vmlinuz"
96+
if a.cpuArch == arch.RpmArch(types.ArchitectureS390X) {
97+
kernelFileType = "kernel.img"
98+
}
99+
agentVmlinuzFile := filepath.Join(bootArtifactsFullPath, fmt.Sprintf("agent.%s-%s", a.cpuArch, kernelFileType))
100+
kernelReader, err := os.Open(filepath.Join(a.tmpPath, "images", "pxeboot", kernelFileType))
98101
if err != nil {
99102
return err
100103
}

pkg/asset/agent/installconfig.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ func (a *OptionalInstallConfig) validateSupportedArchs(installConfig *types.Inst
130130
case types.ArchitectureAMD64:
131131
case types.ArchitectureARM64:
132132
case types.ArchitecturePPC64LE:
133+
case types.ArchitectureS390X:
133134
default:
134-
allErrs = append(allErrs, field.NotSupported(fieldPath, installConfig.ControlPlane.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE}))
135+
allErrs = append(allErrs, field.NotSupported(fieldPath, installConfig.ControlPlane.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE, types.ArchitectureS390X}))
135136
}
136137

137138
for i, compute := range installConfig.Compute {
@@ -141,8 +142,9 @@ func (a *OptionalInstallConfig) validateSupportedArchs(installConfig *types.Inst
141142
case types.ArchitectureAMD64:
142143
case types.ArchitectureARM64:
143144
case types.ArchitecturePPC64LE:
145+
case types.ArchitectureS390X:
144146
default:
145-
allErrs = append(allErrs, field.NotSupported(fieldPath, compute.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE}))
147+
allErrs = append(allErrs, field.NotSupported(fieldPath, compute.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE, types.ArchitectureS390X}))
146148
}
147149
}
148150

pkg/asset/agent/installconfig_test.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ platform:
351351
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
352352
`,
353353
expectedFound: false,
354-
expectedError: "invalid install-config configuration: [ControlPlane.Architecture: Unsupported value: \"s390x\": supported values: \"amd64\", \"arm64\", \"ppc64le\", Compute[0].Architecture: Unsupported value: \"s390x\": supported values: \"amd64\", \"arm64\", \"ppc64le\"]",
354+
expectedError: "invalid install-config configuration: [ControlPlane.Architecture: supported values: \"amd64\", \"arm64\", \"ppc64le\", \"s390x\", Compute[0].Architecture: Unsupported value: \"s390x\": supported values: \"amd64\", \"arm64\", \"ppc64le\"]",
355355
},
356356
{
357357
name: "invalid platform.baremetal for architecture ppc64le",
@@ -392,6 +392,45 @@ pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
392392
expectedFound: false,
393393
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"ppc64le\" only supports platform \"none\".",
394394
},
395+
{
396+
name: "invalid platform.baremetal for architecture s390x",
397+
data: `
398+
apiVersion: v1
399+
metadata:
400+
name: test-cluster
401+
baseDomain: test-domain
402+
networking:
403+
networkType: OVNKubernetes
404+
machineNetwork:
405+
- cidr: 192.168.122.0/23
406+
compute:
407+
- architecture: s390x
408+
hyperthreading: Enabled
409+
name: worker
410+
platform: {}
411+
replicas: 0
412+
controlPlane:
413+
architecture: s390x
414+
hyperthreading: Enabled
415+
name: master
416+
platform: {}
417+
replicas: 3
418+
platform:
419+
baremetal:
420+
apiVIP: 192.168.122.10
421+
ingressVIP: 192.168.122.11
422+
hosts:
423+
- name: host1
424+
bootMACAddress: 52:54:01:aa:aa:a1
425+
- name: host2
426+
bootMACAddress: 52:54:01:bb:bb:b1
427+
- name: host3
428+
bootMACAddress: 52:54:01:cc:cc:c1
429+
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
430+
`,
431+
expectedFound: false,
432+
expectedError: "invalid install-config configuration: Platform: CPU architecture \"s390x\" only supports platform \"baremetal\".",
433+
},
395434
{
396435
name: "unsupported platformName for external platform",
397436
data: `

pkg/asset/agent/manifests/infraenv.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ func (i *InfraEnv) finish() error {
145145
return errors.New("missing configuration or manifest file")
146146
}
147147

148-
// Throw an error if CpuArchitecture isn't x86_64, aarch64, ppc64le, or ""
148+
// Throw an error if CpuArchitecture isn't x86_64, aarch64, ppc64le, s390x, or ""
149149
switch i.Config.Spec.CpuArchitecture {
150-
case arch.RpmArch(types.ArchitectureAMD64), arch.RpmArch(types.ArchitectureARM64), arch.RpmArch(types.ArchitecturePPC64LE), "":
150+
case arch.RpmArch(types.ArchitectureAMD64), arch.RpmArch(types.ArchitectureARM64), arch.RpmArch(types.ArchitecturePPC64LE), arch.RpmArch(types.ArchitectureS390X), "":
151151
default:
152152
return errors.Errorf("Config.Spec.CpuArchitecture %s is not supported ", i.Config.Spec.CpuArchitecture)
153153
}

0 commit comments

Comments
 (0)