Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/openshift-install/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func runGatherBootstrapCmd(directory string) (string, error) {
return "", errors.Wrapf(err, "failed to fetch %s", config.Name())
}

provider, err := infra.ProviderForPlatform(config.Config.Platform.Name())
provider, err := infra.ProviderForPlatform(config.Config.Platform.Name(), config.Config.EnabledFeatureGates())
if err != nil {
return "", fmt.Errorf("error getting infrastructure provider: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *Cluster) Generate(parents asset.Parents) (err error) {
tfvarsFiles = append(tfvarsFiles, file)
}

provider, err := infra.ProviderForPlatform(platform)
provider, err := infra.ProviderForPlatform(platform, installConfig.Config.EnabledFeatureGates())
if err != nil {
return fmt.Errorf("error getting infrastructure provider: %w", err)
}
Expand Down
16 changes: 13 additions & 3 deletions pkg/asset/cluster/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/pkg/errors"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/cluster/alibabacloud"
"github.com/openshift/installer/pkg/asset/cluster/aws"
Expand All @@ -28,6 +29,7 @@ import (
azuretypes "github.com/openshift/installer/pkg/types/azure"
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
externaltypes "github.com/openshift/installer/pkg/types/external"
"github.com/openshift/installer/pkg/types/featuregates"
gcptypes "github.com/openshift/installer/pkg/types/gcp"
ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
libvirttypes "github.com/openshift/installer/pkg/types/libvirt"
Expand Down Expand Up @@ -71,10 +73,18 @@ func (m *Metadata) Generate(parents asset.Parents) (err error) {
installConfig := &installconfig.InstallConfig{}
parents.Get(clusterID, installConfig)

featureSet := installConfig.Config.FeatureSet
var customFS *configv1.CustomFeatureGates
if featureSet == configv1.CustomNoUpgrade {
customFS = featuregates.GenerateCustomFeatures(installConfig.Config.FeatureGates)
}

metadata := &types.ClusterMetadata{
ClusterName: installConfig.Config.ObjectMeta.Name,
ClusterID: clusterID.UUID,
InfraID: clusterID.InfraID,
ClusterName: installConfig.Config.ObjectMeta.Name,
ClusterID: clusterID.UUID,
InfraID: clusterID.InfraID,
FeatureSet: featureSet,
CustomFeatureSet: customFS,
}

switch installConfig.Config.Platform.Name() {
Expand Down
6 changes: 5 additions & 1 deletion pkg/destroy/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/asset/cluster"
openstackasset "github.com/openshift/installer/pkg/asset/cluster/openstack"
osp "github.com/openshift/installer/pkg/destroy/openstack"
infra "github.com/openshift/installer/pkg/infrastructure/platform"
ibmcloudtfvars "github.com/openshift/installer/pkg/tfvars/ibmcloud"
typesazure "github.com/openshift/installer/pkg/types/azure"
"github.com/openshift/installer/pkg/types/featuregates"
ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
"github.com/openshift/installer/pkg/types/openstack"
)
Expand Down Expand Up @@ -68,7 +70,9 @@ func Destroy(dir string) (err error) {
logrus.Debugf("generated ibm endpoint overrides file: %s", endpointsFilePath)
}

provider, err := infra.ProviderForPlatform(platform)
fg := featuregates.FeatureGateFromFeatureSets(configv1.FeatureSets, metadata.FeatureSet, metadata.CustomFeatureSet)

provider, err := infra.ProviderForPlatform(platform, fg)
if err != nil {
return fmt.Errorf("error getting infrastructure provider: %w", err)
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/infrastructure/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ package platform
import (
"fmt"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/infrastructure"
awsinfra "github.com/openshift/installer/pkg/infrastructure/aws"
"github.com/openshift/installer/pkg/terraform"
"github.com/openshift/installer/pkg/terraform/stages/alibabacloud"
"github.com/openshift/installer/pkg/terraform/stages/aws"
Expand All @@ -25,6 +27,7 @@ import (
azuretypes "github.com/openshift/installer/pkg/types/azure"
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
externaltypes "github.com/openshift/installer/pkg/types/external"
"github.com/openshift/installer/pkg/types/featuregates"
gcptypes "github.com/openshift/installer/pkg/types/gcp"
ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
libvirttypes "github.com/openshift/installer/pkg/types/libvirt"
Expand All @@ -37,11 +40,14 @@ import (
)

// ProviderForPlatform returns the stages to run to provision the infrastructure for the specified platform.
func ProviderForPlatform(platform string) (infrastructure.Provider, error) {
func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) {
switch platform {
case alibabacloudtypes.Name:
return terraform.InitializeProvider(alibabacloud.PlatformStages), nil
case awstypes.Name:
if fg.Enabled(configv1.FeatureGateInstallAlternateInfrastructureAWS) {
return awsinfra.InitializeProvider(), nil
}
return terraform.InitializeProvider(aws.PlatformStages), nil
case azuretypes.Name:
return terraform.InitializeProvider(azure.PlatformStages), nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/infrastructure/platform/platform_altinfra.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/openshift/installer/pkg/infrastructure/aws"
awstypes "github.com/openshift/installer/pkg/types/aws"
azuretypes "github.com/openshift/installer/pkg/types/azure"
"github.com/openshift/installer/pkg/types/featuregates"
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) {
func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) {
switch platform {
case awstypes.Name:
return aws.InitializeProvider(), nil
Expand Down
3 changes: 3 additions & 0 deletions pkg/types/clustermetadata.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/types/alibabacloud"
"github.com/openshift/installer/pkg/types/aws"
"github.com/openshift/installer/pkg/types/azure"
Expand All @@ -25,6 +26,8 @@ type ClusterMetadata struct {
// InfraID is an ID that is used to identify cloud resources created by the installer.
InfraID string `json:"infraID"`
ClusterPlatformMetadata `json:",inline"`
FeatureSet configv1.FeatureSet `json:"featureSet"`
CustomFeatureSet *configv1.CustomFeatureGates `json:"customFeatureSet"`
}

// ClusterPlatformMetadata contains metadata for platfrom.
Expand Down