Skip to content

Commit 5b72618

Browse files
AGENT-729: Support generic platform name for external platform
Signed-off-by: Pawan Pinjarkar <[email protected]>
1 parent 528887f commit 5b72618

File tree

4 files changed

+68
-55
lines changed

4 files changed

+68
-55
lines changed

cmd/openshift-install/testdata/agent/image/configurations/external_compact.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Verify a default configuration for the compact topology on external
1+
# Verify a default configuration for the compact topology on external, non oci platform name
22

33
exec openshift-install agent create image --dir $WORK
44

@@ -32,8 +32,7 @@ networking:
3232
- 172.30.0.0/16
3333
platform:
3434
external:
35-
platformName: oci
36-
cloudControllerManager: External
35+
platformName: some-cloud-provider
3736
sshKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=
3837
pullSecret: '{"auths": {"quay.io": {"auth": "c3VwZXItc2VjcmV0Cg=="}}}'
3938

@@ -47,15 +46,15 @@ rendezvousIP: 192.168.111.20
4746
-- expected/agent-cluster-install.yaml --
4847
metadata:
4948
annotations:
50-
agent-install.openshift.io/install-config-overrides: '{"platform":{"external":{"platformName":"oci","cloudControllerManager":"External"}}}'
49+
agent-install.openshift.io/install-config-overrides: '{"platform":{"external":{"platformName":"some-cloud-provider"}}}'
5150
creationTimestamp: null
5251
name: ostest
5352
namespace: cluster0
5453
spec:
5554
clusterDeploymentRef:
5655
name: ostest
5756
external:
58-
platformName: oci
57+
platformName: some-cloud-provider
5958
imageSetRef:
6059
name: openshift-was not built correctly
6160
networking:

cmd/openshift-install/testdata/agent/image/validations/external_invalid_platform_name.txt

Lines changed: 0 additions & 41 deletions
This file was deleted.

pkg/asset/agent/installconfig.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ func (a *OptionalInstallConfig) validateSupportedPlatforms(installConfig *types.
106106
allErrs = append(allErrs, field.Invalid(fieldPath, installConfig.Platform.Name(), fmt.Sprintf("CPU architecture \"%s\" only supports platform \"%s\".", types.ArchitectureS390X, none.Name)))
107107
}
108108
if installConfig.Platform.Name() == external.Name {
109-
if installConfig.Platform.External.PlatformName != string(models.PlatformTypeOci) {
110-
fieldPath = field.NewPath("Platform", "External", "PlatformName")
111-
allErrs = append(allErrs, field.NotSupported(fieldPath, installConfig.Platform.External.PlatformName, []string{string(models.PlatformTypeOci)}))
112-
}
113109
if installConfig.Platform.External.PlatformName == string(models.PlatformTypeOci) &&
114110
installConfig.Platform.External.CloudControllerManager != external.CloudControllerManagerTypeExternal {
115111
fieldPath = field.NewPath("Platform", "External", "CloudControllerManager")

pkg/asset/agent/installconfig_test.go

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/openshift/installer/pkg/ipnet"
1515
"github.com/openshift/installer/pkg/types"
1616
"github.com/openshift/installer/pkg/types/baremetal"
17+
"github.com/openshift/installer/pkg/types/external"
1718
"github.com/openshift/installer/pkg/types/none"
1819
"github.com/openshift/installer/pkg/types/vsphere"
1920
)
@@ -404,19 +405,77 @@ pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
404405
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"s390x\" only supports platform \"none\".",
405406
},
406407
{
407-
name: "unsupported platformName for external platform",
408+
name: "generic platformName for external platform",
408409
data: `
409410
apiVersion: v1
410411
metadata:
411-
name: test-cluster
412+
name: test-cluster
412413
baseDomain: test-domain
414+
networking:
415+
networkType: OVNKubernetes
416+
compute:
417+
- architecture: amd64
418+
hyperthreading: Enabled
419+
name: worker
420+
platform: {}
421+
replicas: 0
422+
controlPlane:
423+
architecture: amd64
424+
hyperthreading: Enabled
425+
name: master
426+
platform: {}
427+
replicas: 1
413428
platform:
414429
external:
415-
platformName: some-cloud-provider
430+
platformName: some-cloud-provider
416431
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
417432
`,
418-
expectedFound: false,
419-
expectedError: `invalid install-config configuration: Platform.External.PlatformName: Unsupported value: "some-cloud-provider": supported values: "oci"`,
433+
expectedFound: true,
434+
expectedConfig: &types.InstallConfig{
435+
TypeMeta: metav1.TypeMeta{
436+
APIVersion: types.InstallConfigVersion,
437+
},
438+
ObjectMeta: metav1.ObjectMeta{
439+
Name: "test-cluster",
440+
},
441+
AdditionalTrustBundlePolicy: types.PolicyProxyOnly,
442+
BaseDomain: "test-domain",
443+
Networking: &types.Networking{
444+
MachineNetwork: []types.MachineNetworkEntry{
445+
{CIDR: *ipnet.MustParseCIDR("10.0.0.0/16")},
446+
},
447+
NetworkType: "OVNKubernetes",
448+
ServiceNetwork: []ipnet.IPNet{*ipnet.MustParseCIDR("172.30.0.0/16")},
449+
ClusterNetwork: []types.ClusterNetworkEntry{
450+
{
451+
CIDR: *ipnet.MustParseCIDR("10.128.0.0/14"),
452+
HostPrefix: 23,
453+
},
454+
},
455+
},
456+
ControlPlane: &types.MachinePool{
457+
Name: "master",
458+
Replicas: pointer.Int64(1),
459+
Hyperthreading: types.HyperthreadingEnabled,
460+
Architecture: types.ArchitectureAMD64,
461+
},
462+
Compute: []types.MachinePool{
463+
{
464+
Name: "worker",
465+
Replicas: pointer.Int64(0),
466+
Hyperthreading: types.HyperthreadingEnabled,
467+
Architecture: types.ArchitectureAMD64,
468+
},
469+
},
470+
Platform: types.Platform{
471+
External: &external.Platform{
472+
PlatformName: "some-cloud-provider",
473+
CloudControllerManager: "",
474+
},
475+
},
476+
PullSecret: `{"auths":{"example.com":{"auth":"authorization value"}}}`,
477+
Publish: types.ExternalPublishingStrategy,
478+
},
420479
},
421480
{
422481
name: "unsupported CloudControllerManager for external platform",

0 commit comments

Comments
 (0)