Created
February 25, 2024 13:46
-
-
Save hamzy/1a0917f47e11b3fac3baba34c1175fe9 to your computer and use it in GitHub Desktop.
./pkg/infrastructure/platform/platform_altinfra.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//go:build altinfra | |
// +build altinfra | |
package platform | |
import ( | |
"fmt" | |
configv1 "github.com/openshift/api/config/v1" | |
"github.com/openshift/installer/pkg/infrastructure" | |
"github.com/openshift/installer/pkg/infrastructure/aws" | |
awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi" | |
"github.com/openshift/installer/pkg/infrastructure/clusterapi" | |
gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi" | |
vspherecapi "github.com/openshift/installer/pkg/infrastructure/vsphere/clusterapi" | |
powervscapi "github.com/openshift/installer/pkg/infrastructure/powervs/clusterapi" | |
awstypes "github.com/openshift/installer/pkg/types/aws" | |
azuretypes "github.com/openshift/installer/pkg/types/azure" | |
"github.com/openshift/installer/pkg/types/featuregates" | |
gcptypes "github.com/openshift/installer/pkg/types/gcp" | |
vspheretypes "github.com/openshift/installer/pkg/types/vsphere" | |
powervstypes "github.com/openshift/installer/pkg/types/powervs" | |
) | |
// ProviderForPlatform returns the stages to run to provision the infrastructure for the specified platform. | |
func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) { | |
switch platform { | |
case awstypes.Name: | |
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) { | |
return clusterapi.InitializeProvider(&awscapi.Provider{}), nil | |
} | |
return aws.InitializeProvider(), nil | |
case azuretypes.Name: | |
panic("not implemented") | |
return nil, nil | |
case gcptypes.Name: | |
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) { | |
return clusterapi.InitializeProvider(gcpcapi.Provider{}), nil | |
} | |
return nil, nil | |
case vspheretypes.Name: | |
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) { | |
return clusterapi.InitializeProvider(vspherecapi.Provider{}), nil | |
} | |
case powervstypes.Name: | |
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) { | |
return clusterapi.InitializeProvider(powervscapi.Provider{}), nil | |
} | |
} | |
return nil, fmt.Errorf("platform %q is not supported in the altinfra Installer build", platform) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment