Skip to content

Commit 4d79c26

Browse files
Merge pull request openshift#7696 from mjturek/remove-ccon
MULTIARCH-3789: Power VS: Remove cloud connection support
2 parents 7661345 + 1d58dc9 commit 4d79c26

File tree

6 files changed

+19
-273
lines changed

6 files changed

+19
-273
lines changed

data/data/powervs/cluster/power_network/pi_network.tf

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,15 @@ data "ibm_pi_dhcps" "dhcp_services" {
88
}
99

1010
resource "ibm_pi_dhcp" "new_dhcp_service" {
11-
count = 1
12-
pi_cloud_instance_id = var.cloud_instance_id
13-
pi_cloud_connection_id = var.transit_gateway_enabled ? "" : data.ibm_pi_cloud_connection.cloud_connection[count.index].id
14-
pi_cidr = var.machine_cidr
15-
pi_dns_server = var.dns_server
16-
pi_dhcp_snat_enabled = var.enable_snat
11+
count = 1
12+
pi_cloud_instance_id = var.cloud_instance_id
13+
pi_cidr = var.machine_cidr
14+
pi_dns_server = var.dns_server
15+
pi_dhcp_snat_enabled = var.enable_snat
1716
# the pi_dhcp_name param will be prefixed by the DHCP ID when created, so keep it short here:
1817
pi_dhcp_name = var.cluster_id
1918
}
2019

21-
resource "ibm_pi_cloud_connection" "new_cloud_connection" {
22-
count = var.transit_gateway_enabled ? 0 : 1
23-
pi_cloud_instance_id = var.cloud_instance_id
24-
pi_cloud_connection_name = "cloud-con-${var.cluster_id}"
25-
pi_cloud_connection_speed = 50
26-
pi_cloud_connection_global_routing = true
27-
pi_cloud_connection_vpc_enabled = true
28-
pi_cloud_connection_vpc_crns = [var.vpc_crn]
29-
}
30-
31-
data "ibm_pi_cloud_connection" "cloud_connection" {
32-
count = var.transit_gateway_enabled ? 0 : 1
33-
pi_cloud_connection_name = ibm_pi_cloud_connection.new_cloud_connection[0].pi_cloud_connection_name
34-
pi_cloud_instance_id = var.cloud_instance_id
35-
}
36-
3720
data "ibm_pi_dhcp" "dhcp_service" {
3821
pi_cloud_instance_id = var.cloud_instance_id
3922
pi_dhcp_id = ibm_pi_dhcp.new_dhcp_service[0].dhcp_id

data/data/powervs/cluster/power_network/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ variable "vpc_crn" {
1818
description = "The CRN of the IBM Cloud VPC."
1919
}
2020

21-
variable "cloud_conn_name" {
22-
type = string
23-
description = "The name of a pre-created Power VS Cloud connection."
24-
default = ""
25-
}
26-
2721
variable "machine_cidr" {
2822
type = string
2923
description = "The machine network (IPv4 only)"

pkg/asset/installconfig/powervs/session.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/IBM-Cloud/bluemix-go/http"
1919
"github.com/IBM-Cloud/bluemix-go/rest"
2020
bxsession "github.com/IBM-Cloud/bluemix-go/session"
21-
"github.com/IBM-Cloud/power-go-client/clients/instance"
2221
"github.com/IBM-Cloud/power-go-client/ibmpisession"
2322
"github.com/IBM/go-sdk-core/v5/core"
2423
"github.com/form3tech-oss/jwt-go"
@@ -250,46 +249,6 @@ func (c *BxClient) ValidateAccountPermissions() error {
250249
return nil
251250
}
252251

253-
// ValidateCloudConnectionInPowerVSRegion counts cloud connection in PowerVS Region
254-
func (c *BxClient) ValidateCloudConnectionInPowerVSRegion(ctx context.Context, svcInsID string) error {
255-
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
256-
defer cancel()
257-
258-
var cloudConnectionsIDs []string
259-
260-
cloudConnectionClient := instance.NewIBMPICloudConnectionClient(ctx, c.PISession, svcInsID)
261-
262-
//check number of cloudconnections
263-
getAllResp, err := cloudConnectionClient.GetAll()
264-
if err != nil {
265-
return fmt.Errorf("failed to get existing Cloud connection details: %w", err)
266-
}
267-
268-
if len(getAllResp.CloudConnections) >= 2 {
269-
return fmt.Errorf("cannot create new Cloud connection in Power VS. Only two Cloud connections are allowed per zone")
270-
}
271-
272-
for _, cc := range getAllResp.CloudConnections {
273-
cloudConnectionsIDs = append(cloudConnectionsIDs, *cc.CloudConnectionID)
274-
}
275-
276-
//check for Cloud connection attached to DHCP Service
277-
for _, cc := range cloudConnectionsIDs {
278-
cloudConn, err := cloudConnectionClient.Get(cc)
279-
if err != nil {
280-
return fmt.Errorf("failed to get Cloud connection details: %w", err)
281-
}
282-
if cloudConn != nil {
283-
for _, nw := range cloudConn.Networks {
284-
if nw.DhcpManaged {
285-
return fmt.Errorf("only one Cloud connection can be attached to any DHCP network per account per zone")
286-
}
287-
}
288-
}
289-
}
290-
return nil
291-
}
292-
293252
// NewPISession updates pisession details, return error on fail.
294253
func (c *BxClient) NewPISession() error {
295254
var authenticator core.Authenticator = &core.IamAuthenticator{

pkg/destroy/powervs/cloudconnection.go

Lines changed: 0 additions & 171 deletions
This file was deleted.

pkg/destroy/powervs/powervs.go

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,20 @@ type ClusterUninstaller struct {
156156
VPCRegion string
157157
Zone string
158158

159-
managementSvc *resourcemanagerv2.ResourceManagerV2
160-
controllerSvc *resourcecontrollerv2.ResourceControllerV2
161-
vpcSvc *vpcv1.VpcV1
162-
zonesSvc *zonesv1.ZonesV1
163-
dnsRecordsSvc *dnsrecordsv1.DnsRecordsV1
164-
dnsZonesSvc *dnszonesv1.DnsZonesV1
165-
resourceRecordsSvc *resourcerecordsv1.ResourceRecordsV1
166-
piSession *ibmpisession.IBMPISession
167-
instanceClient *instance.IBMPIInstanceClient
168-
imageClient *instance.IBMPIImageClient
169-
jobClient *instance.IBMPIJobClient
170-
keyClient *instance.IBMPIKeyClient
171-
cloudConnectionClient *instance.IBMPICloudConnectionClient
172-
dhcpClient *instance.IBMPIDhcpClient
173-
tgClient *transitgatewayapisv1.TransitGatewayApisV1
159+
managementSvc *resourcemanagerv2.ResourceManagerV2
160+
controllerSvc *resourcecontrollerv2.ResourceControllerV2
161+
vpcSvc *vpcv1.VpcV1
162+
zonesSvc *zonesv1.ZonesV1
163+
dnsRecordsSvc *dnsrecordsv1.DnsRecordsV1
164+
dnsZonesSvc *dnszonesv1.DnsZonesV1
165+
resourceRecordsSvc *resourcerecordsv1.ResourceRecordsV1
166+
piSession *ibmpisession.IBMPISession
167+
instanceClient *instance.IBMPIInstanceClient
168+
imageClient *instance.IBMPIImageClient
169+
jobClient *instance.IBMPIJobClient
170+
keyClient *instance.IBMPIKeyClient
171+
dhcpClient *instance.IBMPIDhcpClient
172+
tgClient *transitgatewayapisv1.TransitGatewayApisV1
174173

175174
resourceGroupID string
176175
cosInstanceID string
@@ -312,8 +311,6 @@ func (o *ClusterUninstaller) destroyCluster() error {
312311
{name: "Public Gateways", execute: o.destroyPublicGateways},
313312
}, {
314313
{name: "DHCPs", execute: o.destroyDHCPNetworks},
315-
}, {
316-
{name: "Cloud Connections", execute: o.destroyCloudConnections},
317314
}, {
318315
{name: "Images", execute: o.destroyImages},
319316
{name: "VPCs", execute: o.destroyVPCs},
@@ -468,7 +465,6 @@ func (o *ClusterUninstaller) loadSDKServices() error {
468465
o.Logger.Debugf("loadSDKServices: o.imageClient = %v", o.imageClient)
469466
o.Logger.Debugf("loadSDKServices: o.jobClient = %v", o.jobClient)
470467
o.Logger.Debugf("loadSDKServices: o.keyClient = %v", o.keyClient)
471-
o.Logger.Debugf("loadSDKServices: o.cloudConnectionClient = %v", o.cloudConnectionClient)
472468
o.Logger.Debugf("loadSDKServices: o.vpcSvc = %v", o.vpcSvc)
473469
o.Logger.Debugf("loadSDKServices: o.managementSvc = %v", o.managementSvc)
474470
o.Logger.Debugf("loadSDKServices: o.controllerSvc = %v", o.controllerSvc)
@@ -719,11 +715,6 @@ func (o *ClusterUninstaller) loadSDKServices() error {
719715
return fmt.Errorf("loadSDKServices: o.keyClient is nil")
720716
}
721717

722-
o.cloudConnectionClient = instance.NewIBMPICloudConnectionClient(context.Background(), o.piSession, o.ServiceGUID)
723-
if o.cloudConnectionClient == nil {
724-
return fmt.Errorf("loadSDKServices: o.cloudConnectionClient is nil")
725-
}
726-
727718
o.dhcpClient = instance.NewIBMPIDhcpClient(context.Background(), o.piSession, o.ServiceGUID)
728719
if o.dhcpClient == nil {
729720
return fmt.Errorf("loadSDKServices: o.dhcpClient is nil")

pkg/types/powervs/powervs_regions.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ var Regions = map[string]Region{
2222
VPCRegion: "us-south",
2323
Zones: []string{"dal10"},
2424
},
25-
"mon": {
26-
Description: "Montreal, Canada",
27-
VPCRegion: "ca-tor",
28-
Zones: []string{"mon01"},
29-
},
30-
"osa": {
31-
Description: "Osaka, Japan",
32-
VPCRegion: "jp-osa",
33-
Zones: []string{"osa21"},
34-
},
3525
}
3626

3727
// VPCRegionForPowerVSRegion returns the VPC region for the specified PowerVS region.

0 commit comments

Comments
 (0)