github.com/openshift/installer@v1.4.17/pkg/infrastructure/platform/platform_altinfra.go (about)

     1  //go:build altinfra
     2  // +build altinfra
     3  
     4  package platform
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"github.com/openshift/installer/pkg/infrastructure"
    10  	awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi"
    11  	azurecapi "github.com/openshift/installer/pkg/infrastructure/azure"
    12  	"github.com/openshift/installer/pkg/infrastructure/clusterapi"
    13  	gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi"
    14  	ibmcloudcapi "github.com/openshift/installer/pkg/infrastructure/ibmcloud/clusterapi"
    15  	nutanixcapi "github.com/openshift/installer/pkg/infrastructure/nutanix/clusterapi"
    16  	openstackcapi "github.com/openshift/installer/pkg/infrastructure/openstack/clusterapi"
    17  	powervscapi "github.com/openshift/installer/pkg/infrastructure/powervs/clusterapi"
    18  	vspherecapi "github.com/openshift/installer/pkg/infrastructure/vsphere/clusterapi"
    19  	"github.com/openshift/installer/pkg/types"
    20  	awstypes "github.com/openshift/installer/pkg/types/aws"
    21  	azuretypes "github.com/openshift/installer/pkg/types/azure"
    22  	"github.com/openshift/installer/pkg/types/featuregates"
    23  	gcptypes "github.com/openshift/installer/pkg/types/gcp"
    24  	ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
    25  	nutanixtypes "github.com/openshift/installer/pkg/types/nutanix"
    26  	openstacktypes "github.com/openshift/installer/pkg/types/openstack"
    27  	powervstypes "github.com/openshift/installer/pkg/types/powervs"
    28  	vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
    29  )
    30  
    31  // ProviderForPlatform returns the stages to run to provision the infrastructure for the specified platform.
    32  func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) {
    33  	switch platform {
    34  	case awstypes.Name:
    35  		return clusterapi.InitializeProvider(&awscapi.Provider{}), nil
    36  	case azuretypes.Name:
    37  		return clusterapi.InitializeProvider(&azurecapi.Provider{}), nil
    38  	case gcptypes.Name:
    39  		return clusterapi.InitializeProvider(gcpcapi.Provider{}), nil
    40  	case ibmcloudtypes.Name:
    41  		if types.ClusterAPIFeatureGateEnabled(platform, fg) {
    42  			return clusterapi.InitializeProvider(ibmcloudcapi.Provider{}), nil
    43  		}
    44  		return nil, nil
    45  	case vspheretypes.Name:
    46  		return clusterapi.InitializeProvider(vspherecapi.Provider{}), nil
    47  	case powervstypes.Name:
    48  		return clusterapi.InitializeProvider(powervscapi.Provider{}), nil
    49  	case openstacktypes.Name:
    50  		return clusterapi.InitializeProvider(openstackcapi.Provider{}), nil
    51  	case nutanixtypes.Name:
    52  		return clusterapi.InitializeProvider(nutanixcapi.Provider{}), nil
    53  	}
    54  	return nil, fmt.Errorf("platform %q is not supported in the altinfra Installer build", platform)
    55  }