Skip to content

Commit 5d21725

Browse files
Merge pull request openshift#7712 from Neeraj8418/master
MULTIARCH-2678: Patch for Agent Based Installer to support s390x as supported architecture.
2 parents 2913b2c + 3c8e9ef commit 5d21725

File tree

4 files changed

+36
-17
lines changed

4 files changed

+36
-17
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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func (a *OptionalInstallConfig) validateSupportedPlatforms(installConfig *types.
102102
if installConfig.Platform.Name() != none.Name && installConfig.ControlPlane.Architecture == types.ArchitecturePPC64LE {
103103
allErrs = append(allErrs, field.Invalid(fieldPath, installConfig.Platform.Name(), fmt.Sprintf("CPU architecture \"%s\" only supports platform \"%s\".", types.ArchitecturePPC64LE, none.Name)))
104104
}
105+
if installConfig.Platform.Name() != none.Name && installConfig.ControlPlane.Architecture == types.ArchitectureS390X {
106+
allErrs = append(allErrs, field.Invalid(fieldPath, installConfig.Platform.Name(), fmt.Sprintf("CPU architecture \"%s\" only supports platform \"%s\".", types.ArchitectureS390X, none.Name)))
107+
}
105108
if installConfig.Platform.Name() == external.Name {
106109
if installConfig.Platform.External.PlatformName != string(models.PlatformTypeOci) {
107110
fieldPath = field.NewPath("Platform", "External", "PlatformName")
@@ -130,8 +133,9 @@ func (a *OptionalInstallConfig) validateSupportedArchs(installConfig *types.Inst
130133
case types.ArchitectureAMD64:
131134
case types.ArchitectureARM64:
132135
case types.ArchitecturePPC64LE:
136+
case types.ArchitectureS390X:
133137
default:
134-
allErrs = append(allErrs, field.NotSupported(fieldPath, installConfig.ControlPlane.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE}))
138+
allErrs = append(allErrs, field.NotSupported(fieldPath, installConfig.ControlPlane.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE, types.ArchitectureS390X}))
135139
}
136140

137141
for i, compute := range installConfig.Compute {
@@ -141,8 +145,9 @@ func (a *OptionalInstallConfig) validateSupportedArchs(installConfig *types.Inst
141145
case types.ArchitectureAMD64:
142146
case types.ArchitectureARM64:
143147
case types.ArchitecturePPC64LE:
148+
case types.ArchitectureS390X:
144149
default:
145-
allErrs = append(allErrs, field.NotSupported(fieldPath, compute.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE}))
150+
allErrs = append(allErrs, field.NotSupported(fieldPath, compute.Architecture, []string{types.ArchitectureAMD64, types.ArchitectureARM64, types.ArchitecturePPC64LE, types.ArchitectureS390X}))
146151
}
147152
}
148153

pkg/asset/agent/installconfig_test.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,35 +326,46 @@ pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
326326
expectedError: "invalid install-config configuration: [Platform: Unsupported value: \"aws\": supported values: \"baremetal\", \"vsphere\", \"none\", \"external\", Platform: Invalid value: \"aws\": Only platform none and external supports 1 ControlPlane and 0 Compute nodes]",
327327
},
328328
{
329-
name: "invalid architecture for SNO cluster",
329+
name: "invalid platform.baremetal for architecture ppc64le",
330330
data: `
331331
apiVersion: v1
332332
metadata:
333333
name: test-cluster
334334
baseDomain: test-domain
335335
networking:
336336
networkType: OVNKubernetes
337+
machineNetwork:
338+
- cidr: 192.168.122.0/23
337339
compute:
338-
- architecture: s390x
340+
- architecture: ppc64le
339341
hyperthreading: Enabled
340342
name: worker
341343
platform: {}
342344
replicas: 0
343345
controlPlane:
344-
architecture: s390x
346+
architecture: ppc64le
345347
hyperthreading: Enabled
346348
name: master
347349
platform: {}
348-
replicas: 1
350+
replicas: 3
349351
platform:
350-
none : {}
352+
baremetal:
353+
apiVIP: 192.168.122.10
354+
ingressVIP: 192.168.122.11
355+
hosts:
356+
- name: host1
357+
bootMACAddress: 52:54:01:aa:aa:a1
358+
- name: host2
359+
bootMACAddress: 52:54:01:bb:bb:b1
360+
- name: host3
361+
bootMACAddress: 52:54:01:cc:cc:c1
351362
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
352363
`,
353364
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\"]",
365+
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"ppc64le\" only supports platform \"none\".",
355366
},
356367
{
357-
name: "invalid platform.baremetal for architecture ppc64le",
368+
name: "invalid platform.baremetal for architecture s390x",
358369
data: `
359370
apiVersion: v1
360371
metadata:
@@ -365,13 +376,13 @@ networking:
365376
machineNetwork:
366377
- cidr: 192.168.122.0/23
367378
compute:
368-
- architecture: ppc64le
379+
- architecture: s390x
369380
hyperthreading: Enabled
370381
name: worker
371382
platform: {}
372383
replicas: 0
373384
controlPlane:
374-
architecture: ppc64le
385+
architecture: s390x
375386
hyperthreading: Enabled
376387
name: master
377388
platform: {}
@@ -390,7 +401,7 @@ platform:
390401
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
391402
`,
392403
expectedFound: false,
393-
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"ppc64le\" only supports platform \"none\".",
404+
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"s390x\" only supports platform \"none\".",
394405
},
395406
{
396407
name: "unsupported platformName for external platform",

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)