66 "fmt"
77 "math/rand"
88 "os"
9- "path"
109 "strconv"
1110 "strings"
1211 "time"
@@ -16,8 +15,6 @@ import (
1615 coreosarch "github.com/coreos/stream-metadata-go/arch"
1716 "github.com/pkg/errors"
1817 "github.com/sirupsen/logrus"
19- "github.com/vmware/govmomi/object"
20- "github.com/vmware/govmomi/vim25/mo"
2118 "sigs.k8s.io/yaml"
2219
2320 configv1 "github.com/openshift/api/config/v1"
@@ -38,7 +35,6 @@ import (
3835 ibmcloudconfig "github.com/openshift/installer/pkg/asset/installconfig/ibmcloud"
3936 ovirtconfig "github.com/openshift/installer/pkg/asset/installconfig/ovirt"
4037 powervsconfig "github.com/openshift/installer/pkg/asset/installconfig/powervs"
41- vsphereconfig "github.com/openshift/installer/pkg/asset/installconfig/vsphere"
4238 "github.com/openshift/installer/pkg/asset/machines"
4339 "github.com/openshift/installer/pkg/asset/manifests"
4440 "github.com/openshift/installer/pkg/asset/openshiftinstall"
@@ -55,7 +51,6 @@ import (
5551 openstacktfvars "github.com/openshift/installer/pkg/tfvars/openstack"
5652 ovirttfvars "github.com/openshift/installer/pkg/tfvars/ovirt"
5753 powervstfvars "github.com/openshift/installer/pkg/tfvars/powervs"
58- vspheretfvars "github.com/openshift/installer/pkg/tfvars/vsphere"
5954 "github.com/openshift/installer/pkg/types"
6055 "github.com/openshift/installer/pkg/types/aws"
6156 "github.com/openshift/installer/pkg/types/azure"
@@ -1045,102 +1040,9 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
10451040 })
10461041
10471042 case vsphere .Name :
1048- networkFailureDomainMap := make (map [string ]string )
1049- ctx , cancel := context .WithTimeout (context .TODO (), 60 * time .Second )
1050- defer cancel ()
1051-
1052- vim25Client , _ , cleanup , err := vsphereconfig .CreateVSphereClients (context .TODO (),
1053- installConfig .Config .VSphere .VCenters [0 ].Server ,
1054- installConfig .Config .VSphere .VCenters [0 ].Username ,
1055- installConfig .Config .VSphere .VCenters [0 ].Password )
1056- if err != nil {
1057- return errors .Wrapf (err , "unable to connect to vCenter %s. Ensure provided information is correct and client certs have been added to system trust" , installConfig .Config .VSphere .VCenters [0 ].Server )
1058- }
1059- defer cleanup ()
1060-
1061- finder := vsphereconfig .NewFinder (vim25Client )
1062-
1063- controlPlanes , err := mastersAsset .Machines ()
1064- if err != nil {
1065- return err
1066- }
1067- ipAddresses , err := mastersAsset .IPAddresses ()
1068- if err != nil {
1069- return err
1070- }
1071- controlPlaneConfigs := make ([]* machinev1beta1.VSphereMachineProviderSpec , len (controlPlanes ))
1072- for i , c := range controlPlanes {
1073- var clusterMo mo.ClusterComputeResource
1074- controlPlaneConfigs [i ] = c .Spec .ProviderSpec .Value .Object .(* machinev1beta1.VSphereMachineProviderSpec ) //nolint:errcheck // legacy, pre-linter
1075-
1076- rpObj , err := finder .ResourcePool (ctx , controlPlaneConfigs [i ].Workspace .ResourcePool )
1077- if err != nil {
1078- return err
1079- }
1080-
1081- clusterRef , err := rpObj .Owner (ctx )
1082- if err != nil {
1083- return err
1084- }
1085-
1086- // When using finder.ObjectReference the InventoryPath is defined
1087- // NewClusterComputeResource I don't believe assigns that value.
1088- clusterObjRef , err := finder .ObjectReference (ctx , clusterRef .Reference ())
1089- if err != nil {
1090- return err
1091- }
1092-
1093- clusterObj , ok := clusterObjRef .(* object.ClusterComputeResource )
1094- if ! ok {
1095- return errors .New ("unable to convert cluster object reference to object cluster compute resource" )
1096- }
1097- err = clusterObj .Properties (ctx , clusterRef .Reference (), []string {"name" , "summary" }, & clusterMo )
1098- if err != nil {
1099- return err
1100- }
1101-
1102- networkPath := path .Join (clusterObj .InventoryPath , controlPlaneConfigs [i ].Network .Devices [0 ].NetworkName )
1103- netObj , err := finder .Network (ctx , networkPath )
1104- if err != nil {
1105- return err
1106- }
1107-
1108- controlPlaneConfigs [i ].Network .Devices [0 ].NetworkName = netObj .Reference ().Value
1109- }
1110-
1111- for _ , fd := range installConfig .Config .VSphere .FailureDomains {
1112- // Must use the Managed Object ID for a port group (e.g. dvportgroup-5258)
1113- // instead of the name since port group names aren't always unique in vSphere.
1114- // https://bugzilla.redhat.com/show_bug.cgi?id=1918005
1115-
1116- networkPath := path .Join (fd .Topology .ComputeCluster , fd .Topology .Networks [0 ])
1117- netObj , err := finder .Network (ctx , networkPath )
1118- if err != nil {
1119- return errors .Wrap (err , "failed to get vSphere network ID" )
1120- }
1121-
1122- networkFailureDomainMap [fd .Name ] = netObj .Reference ().Value
1123- }
1124-
1125- data , err = vspheretfvars .TFVars (
1126- vspheretfvars.TFVarsSources {
1127- ControlPlaneConfigs : controlPlaneConfigs ,
1128- ImageURL : string (* rhcosImage ),
1129- DiskType : installConfig .Config .Platform .VSphere .DiskType ,
1130- NetworksInFailureDomain : networkFailureDomainMap ,
1131- InfraID : clusterID .InfraID ,
1132- InstallConfig : installConfig ,
1133- ControlPlaneMachines : controlPlanes ,
1134- IPAddresses : ipAddresses ,
1135- },
1136- )
1137- if err != nil {
1138- return errors .Wrapf (err , "failed to get %s Terraform variables" , platform )
1139- }
1140- t .FileList = append (t .FileList , & asset.File {
1141- Filename : TfPlatformVarsFileName ,
1142- Data : data ,
1143- })
1043+ t .FileList = make ([]* asset.File , 0 )
1044+ logrus .Warn ("installing on vSphere via terraform is no longer supported" )
1045+ return nil
11441046 case nutanix .Name :
11451047 controlPlanes , err := mastersAsset .Machines ()
11461048 if err != nil {
0 commit comments