11package vsphere
22
33import (
4+ "fmt"
5+
46 configv1 "github.com/openshift/api/config/v1"
57 "github.com/openshift/installer/pkg/asset/installconfig"
68)
79
810// GetInfraPlatformSpec constructs VSpherePlatformSpec for the infrastructure spec
9- func GetInfraPlatformSpec (ic * installconfig.InstallConfig ) * configv1.VSpherePlatformSpec {
11+ func GetInfraPlatformSpec (ic * installconfig.InstallConfig , clusterID string ) * configv1.VSpherePlatformSpec {
1012 var platformSpec configv1.VSpherePlatformSpec
1113 icPlatformSpec := ic .Config .VSphere
1214
@@ -21,6 +23,11 @@ func GetInfraPlatformSpec(ic *installconfig.InstallConfig) *configv1.VSpherePlat
2123 for _ , failureDomain := range icPlatformSpec .FailureDomains {
2224 topology := failureDomain .Topology
2325 if topology .ComputeCluster != "" && topology .Networks [0 ] != "" {
26+ template := topology .Template
27+ if len (template ) == 0 {
28+ template = fmt .Sprintf ("/%s/vm/%s-rhcos-%s-%s" , topology .Datacenter , clusterID , failureDomain .Region , failureDomain .Zone )
29+ }
30+
2431 platformSpec .FailureDomains = append (platformSpec .FailureDomains , configv1.VSpherePlatformFailureDomainSpec {
2532 Name : failureDomain .Name ,
2633 Region : failureDomain .Region ,
@@ -33,6 +40,7 @@ func GetInfraPlatformSpec(ic *installconfig.InstallConfig) *configv1.VSpherePlat
3340 Datastore : topology .Datastore ,
3441 ResourcePool : topology .ResourcePool ,
3542 Folder : topology .Folder ,
43+ Template : template ,
3644 },
3745 })
3846 }
0 commit comments