Skip to content

Commit ad89f29

Browse files
Merge pull request openshift#8012 from patrickdillon/capi-aws-provider-interface
CORS-2890: pkg/infrastructure/aws: add initial CAPI provider
2 parents 798238f + 22d4be5 commit ad89f29

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package clusterapi
2+
3+
import (
4+
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
5+
awstypes "github.com/openshift/installer/pkg/types/aws"
6+
)
7+
8+
var _ clusterapi.Provider = (*Provider)(nil)
9+
10+
// Provider implements AWS CAPI installation.
11+
type Provider struct{}
12+
13+
// Name gives the name of the provider, AWS.
14+
func (*Provider) Name() string { return awstypes.Name }

pkg/infrastructure/platform/platform.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
configv1 "github.com/openshift/api/config/v1"
1010
"github.com/openshift/installer/pkg/infrastructure"
1111
awsinfra "github.com/openshift/installer/pkg/infrastructure/aws"
12+
awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi"
1213
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
1314
gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi"
1415
"github.com/openshift/installer/pkg/terraform"
@@ -43,6 +44,9 @@ import (
4344
func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) {
4445
switch platform {
4546
case awstypes.Name:
47+
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) {
48+
return clusterapi.InitializeProvider(&awscapi.Provider{}), nil
49+
}
4650
if fg.Enabled(configv1.FeatureGateInstallAlternateInfrastructureAWS) {
4751
return awsinfra.InitializeProvider(), nil
4852
}

pkg/infrastructure/platform/platform_altinfra.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
configv1 "github.com/openshift/api/config/v1"
1010
"github.com/openshift/installer/pkg/infrastructure"
1111
"github.com/openshift/installer/pkg/infrastructure/aws"
12+
awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi"
1213
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
1314
gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi"
1415
awstypes "github.com/openshift/installer/pkg/types/aws"
@@ -22,6 +23,9 @@ import (
2223
func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastructure.Provider, error) {
2324
switch platform {
2425
case awstypes.Name:
26+
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) {
27+
return clusterapi.InitializeProvider(&awscapi.Provider{}), nil
28+
}
2529
return aws.InitializeProvider(), nil
2630
case azuretypes.Name:
2731
panic("not implemented")

0 commit comments

Comments
 (0)