-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CORS-2835: use build tags to produce installer with alternate infrastructure providers #7656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| //go:build !(altinfra || aro) | ||
| // +build !altinfra,!aro | ||
|
|
||
| package platform | ||
|
|
||
| import ( | ||
|
|
@@ -34,40 +37,40 @@ import ( | |
| ) | ||
|
|
||
| // ProviderForPlatform returns the stages to run to provision the infrastructure for the specified platform. | ||
| func ProviderForPlatform(platform string) infrastructure.Provider { | ||
| func ProviderForPlatform(platform string) (infrastructure.Provider, error) { | ||
| switch platform { | ||
| case alibabacloudtypes.Name: | ||
| return terraform.InitializeProvider(alibabacloud.PlatformStages) | ||
| return terraform.InitializeProvider(alibabacloud.PlatformStages), nil | ||
| case awstypes.Name: | ||
| return terraform.InitializeProvider(aws.PlatformStages) | ||
| return terraform.InitializeProvider(aws.PlatformStages), nil | ||
| case azuretypes.Name: | ||
| return terraform.InitializeProvider(azure.PlatformStages) | ||
| return terraform.InitializeProvider(azure.PlatformStages), nil | ||
| case azuretypes.StackTerraformName: | ||
| return terraform.InitializeProvider(azure.StackPlatformStages) | ||
| return terraform.InitializeProvider(azure.StackPlatformStages), nil | ||
| case baremetaltypes.Name: | ||
| return terraform.InitializeProvider(baremetal.PlatformStages) | ||
| return terraform.InitializeProvider(baremetal.PlatformStages), nil | ||
| case gcptypes.Name: | ||
| return terraform.InitializeProvider(gcp.PlatformStages) | ||
| return terraform.InitializeProvider(gcp.PlatformStages), nil | ||
| case ibmcloudtypes.Name: | ||
| return terraform.InitializeProvider(ibmcloud.PlatformStages) | ||
| return terraform.InitializeProvider(ibmcloud.PlatformStages), nil | ||
| case libvirttypes.Name: | ||
| return terraform.InitializeProvider(libvirt.PlatformStages) | ||
| return terraform.InitializeProvider(libvirt.PlatformStages), nil | ||
| case nutanixtypes.Name: | ||
| return terraform.InitializeProvider(nutanix.PlatformStages) | ||
| return terraform.InitializeProvider(nutanix.PlatformStages), nil | ||
| case powervstypes.Name: | ||
| return terraform.InitializeProvider(powervs.PlatformStages) | ||
| return terraform.InitializeProvider(powervs.PlatformStages), nil | ||
| case openstacktypes.Name: | ||
| return terraform.InitializeProvider(openstack.PlatformStages) | ||
| return terraform.InitializeProvider(openstack.PlatformStages), nil | ||
| case ovirttypes.Name: | ||
| return terraform.InitializeProvider(ovirt.PlatformStages) | ||
| return terraform.InitializeProvider(ovirt.PlatformStages), nil | ||
| case vspheretypes.Name: | ||
| return terraform.InitializeProvider(vsphere.PlatformStages) | ||
| return terraform.InitializeProvider(vsphere.PlatformStages), nil | ||
| case nonetypes.Name: | ||
| // terraform is not used when the platform is "none" | ||
| return terraform.InitializeProvider([]terraform.Stage{}) | ||
| return terraform.InitializeProvider([]terraform.Stage{}), nil | ||
| case externaltypes.Name: | ||
| // terraform is not used when the platform is "external" | ||
| return terraform.InitializeProvider([]terraform.Stage{}) | ||
| return terraform.InitializeProvider([]terraform.Stage{}), nil | ||
| } | ||
| panic(fmt.Sprintf("unsupported platform %q", platform)) | ||
| return nil, fmt.Errorf("unsupported platform %q", platform) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: since essentially the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good suggestion. I would like to keep it this way, because once #7413 merges, we can introduce alternate providers with feature gates in these case statements, so we would have something like: case awstypes.Name:
if fg.Enabled(configv1.FeatureGateInstallAWSSDK) {
return aws.InitializeProvider("")
}
return terraform.InitializeProvider(aws.PlatformStages), nil
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, we could eventually review it in future |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| //go:build altinfra || aro | ||
| // +build altinfra aro | ||
|
|
||
| package platform | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/openshift/installer/pkg/infrastructure" | ||
| awstypes "github.com/openshift/installer/pkg/types/aws" | ||
| azuretypes "github.com/openshift/installer/pkg/types/azure" | ||
| vspheretypes "github.com/openshift/installer/pkg/types/vsphere" | ||
| ) | ||
|
|
||
| // ProviderForPlatform returns the stages to run to provision the infrastructure for the specified platform. | ||
| func ProviderForPlatform(platform string) (infrastructure.Provider, error) { | ||
| switch platform { | ||
| case awstypes.Name: | ||
| panic("not implemented") | ||
| return nil, nil | ||
| case azuretypes.Name: | ||
| panic("not implemented") | ||
| return nil, nil | ||
| case vspheretypes.Name: | ||
| panic("not implemented") | ||
| return nil, nil | ||
| } | ||
| return nil, fmt.Errorf("platform %q is not supported in the altinfra Installer build", platform) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware about the specific build tag
aro, must be skipped as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so I have also added the
arotag here:https://github.com/openshift/installer/pull/7656/files#diff-a4f0f6b61545d617e8db370db204ea8d9fbd62f380527ef49351bf617c781e32R1-R2
ARO has a fork of the installer and does not use Terraform (using ARO-RP instead). I believe they use this ARO build tag when building their fork, so the result should be that the ARO version of the installer is built without Terraform dependencies.