Skip to content

Commit be6f5ad

Browse files
committed
MULTIARCH-4158: pkg/infrastructure/powervs: add initial CAPI provider
Adds the initial, empty provider for the PowerVS CAPI install process. This should allow basic running of the CAPI provider and a foundation for building the rest of the supporting infrastructure provisioning.
1 parent d8a8d2b commit be6f5ad

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

pkg/infrastructure/platform/platform.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi"
1313
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
1414
gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi"
15+
powervscapi "github.com/openshift/installer/pkg/infrastructure/powervs/clusterapi"
1516
vspherecapi "github.com/openshift/installer/pkg/infrastructure/vsphere/clusterapi"
1617
"github.com/openshift/installer/pkg/terraform"
1718
"github.com/openshift/installer/pkg/terraform/stages/aws"
@@ -70,6 +71,9 @@ func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastr
7071
case nutanixtypes.Name:
7172
return terraform.InitializeProvider(nutanix.PlatformStages), nil
7273
case powervstypes.Name:
74+
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) {
75+
return clusterapi.InitializeProvider(&powervscapi.Provider{}), nil
76+
}
7377
return terraform.InitializeProvider(powervs.PlatformStages), nil
7478
case openstacktypes.Name:
7579
return terraform.InitializeProvider(openstack.PlatformStages), nil

pkg/infrastructure/platform/platform_altinfra.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import (
1212
awscapi "github.com/openshift/installer/pkg/infrastructure/aws/clusterapi"
1313
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
1414
gcpcapi "github.com/openshift/installer/pkg/infrastructure/gcp/clusterapi"
15+
powervscapi "github.com/openshift/installer/pkg/infrastructure/powervs/clusterapi"
1516
vspherecapi "github.com/openshift/installer/pkg/infrastructure/vsphere/clusterapi"
1617
awstypes "github.com/openshift/installer/pkg/types/aws"
1718
azuretypes "github.com/openshift/installer/pkg/types/azure"
1819
"github.com/openshift/installer/pkg/types/featuregates"
1920
gcptypes "github.com/openshift/installer/pkg/types/gcp"
21+
powervstypes "github.com/openshift/installer/pkg/types/powervs"
2022
vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
2123
)
2224

@@ -40,6 +42,11 @@ func ProviderForPlatform(platform string, fg featuregates.FeatureGate) (infrastr
4042
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) {
4143
return clusterapi.InitializeProvider(vspherecapi.Provider{}), nil
4244
}
45+
case powervstypes.Name:
46+
if fg.Enabled(configv1.FeatureGateClusterAPIInstall) {
47+
return clusterapi.InitializeProvider(powervscapi.Provider{}), nil
48+
}
49+
return nil, nil
4350
}
4451
return nil, fmt.Errorf("platform %q is not supported in the altinfra Installer build", platform)
4552
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package clusterapi
2+
3+
import (
4+
"context"
5+
6+
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
7+
powervstypes "github.com/openshift/installer/pkg/types/powervs"
8+
)
9+
10+
// Provider is the vSphere implementation of the clusterapi InfraProvider.
11+
type Provider struct {
12+
clusterapi.InfraProvider
13+
}
14+
15+
var _ clusterapi.PreProvider = Provider{}
16+
17+
// Name returns the PowerVS provider name.
18+
func (p Provider) Name() string {
19+
return powervstypes.Name
20+
}
21+
22+
// PreProvision creates the PowerVS objects required prior to running capv.
23+
func (p Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionInput) error {
24+
return nil
25+
}

0 commit comments

Comments
 (0)