Skip to content

Commit cb22310

Browse files
committed
PowerVC: Do not use Security Groups
PowerVC does not support OpenStack security groups. Instead, they rely on an external solution.
1 parent 0324f33 commit cb22310

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

pkg/asset/machines/openstack/machines.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func Machines(ctx context.Context, clusterID string, config *types.InstallConfig
6363
providerSpec, err := generateProviderSpec(
6464
ctx,
6565
clusterID,
66-
config.Platform.OpenStack,
66+
config,
6767
mpool,
6868
osImage,
6969
role,
@@ -102,7 +102,7 @@ func Machines(ctx context.Context, clusterID string, config *types.InstallConfig
102102
machineSetProviderSpec, err := generateProviderSpec(
103103
ctx,
104104
clusterID,
105-
config.Platform.OpenStack,
105+
config,
106106
mpool,
107107
osImage,
108108
role,
@@ -167,11 +167,13 @@ func Machines(ctx context.Context, clusterID string, config *types.InstallConfig
167167
return machines, controlPlaneMachineSet, nil
168168
}
169169

170-
func generateProviderSpec(ctx context.Context, clusterID string, platform *openstack.Platform, mpool *openstack.MachinePool, osImage string, role, userDataSecret string, failureDomain machinev1.OpenStackFailureDomain, configDrive *bool) (*machinev1alpha1.OpenstackProviderSpec, error) {
170+
func generateProviderSpec(ctx context.Context, clusterID string, config *types.InstallConfig, mpool *openstack.MachinePool, osImage string, role, userDataSecret string, failureDomain machinev1.OpenStackFailureDomain, configDrive *bool) (*machinev1alpha1.OpenstackProviderSpec, error) {
171171
var controlPlaneNetwork machinev1alpha1.NetworkParam
172172
additionalNetworks := make([]machinev1alpha1.NetworkParam, 0, len(mpool.AdditionalNetworkIDs))
173173
primarySubnet := ""
174174

175+
platform := config.Platform.OpenStack
176+
175177
if platform.ControlPlanePort != nil {
176178
var subnets []machinev1alpha1.SubnetParam
177179
controlPlanePort := platform.ControlPlanePort
@@ -230,6 +232,9 @@ func generateProviderSpec(ctx context.Context, clusterID string, platform *opens
230232
UUID: sg,
231233
})
232234
}
235+
if config.Platform.Name() == powervc.Name {
236+
securityGroups = nil
237+
}
233238

234239
serverGroupName := clusterID + "-" + role
235240
// We initially used the AZ name as part of the server group name for the masters

pkg/asset/machines/openstack/machinesets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func MachineSets(ctx context.Context, clusterID string, config *types.InstallCon
6666
providerSpec, err := generateProviderSpec(
6767
ctx,
6868
clusterID,
69-
config.Platform.OpenStack,
69+
config,
7070
mpool,
7171
osImage,
7272
role,

pkg/asset/machines/openstack/openstackmachines.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func GenerateMachines(clusterID string, config *types.InstallConfig, pool *types
4444
failureDomain := failureDomains[uint(idx)%uint(len(failureDomains))]
4545
machineSpec, err := generateMachineSpec(
4646
clusterID,
47-
config.Platform.OpenStack,
47+
config,
4848
mpool,
4949
osImage,
5050
role,
@@ -114,7 +114,9 @@ func GenerateMachines(clusterID string, config *types.InstallConfig, pool *types
114114
return result, nil
115115
}
116116

117-
func generateMachineSpec(clusterID string, platform *openstack.Platform, mpool *openstack.MachinePool, osImage string, role string, failureDomain machinev1.OpenStackFailureDomain, configDrive *bool) (*capo.OpenStackMachineSpec, error) {
117+
func generateMachineSpec(clusterID string, config *types.InstallConfig, mpool *openstack.MachinePool, osImage string, role string, failureDomain machinev1.OpenStackFailureDomain, configDrive *bool) (*capo.OpenStackMachineSpec, error) {
118+
platform := config.Platform.OpenStack
119+
118120
port := capo.PortOpts{}
119121

120122
addressPairs := populateAllowedAddressPairs(platform)
@@ -177,6 +179,10 @@ func generateMachineSpec(clusterID string, platform *openstack.Platform, mpool *
177179
securityGroups = append(securityGroups, capo.SecurityGroupParam{ID: &mpool.AdditionalSecurityGroupIDs[i]})
178180
}
179181

182+
if config.Platform.Name() == powervc.Name {
183+
securityGroups = nil
184+
}
185+
180186
spec := capo.OpenStackMachineSpec{
181187
Flavor: ptr.To(mpool.FlavorName),
182188
IdentityRef: &capo.OpenStackIdentityReference{

pkg/infrastructure/openstack/clusterapi/clusterapi.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/openshift/installer/pkg/infrastructure/openstack/preprovision"
2121
"github.com/openshift/installer/pkg/rhcos"
2222
"github.com/openshift/installer/pkg/types/openstack"
23+
"github.com/openshift/installer/pkg/types/powervc"
2324
)
2425

2526
// Provider defines the InfraProvider.
@@ -75,8 +76,10 @@ func (p Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionIn
7576
break
7677
}
7778
}
78-
if err := preprovision.SecurityGroups(ctx, installConfig, infraID, mastersSchedulable); err != nil {
79-
return fmt.Errorf("failed to create security groups: %w", err)
79+
if installConfig.Config.Platform.Name() != powervc.Name {
80+
if err := preprovision.SecurityGroups(ctx, installConfig, infraID, mastersSchedulable); err != nil {
81+
return fmt.Errorf("failed to create security groups: %w", err)
82+
}
8083
}
8184
}
8285

0 commit comments

Comments
 (0)