From 1ca38b034f454ecc31f152ef65ca0fc15e6a61b3 Mon Sep 17 00:00:00 2001 From: Karthik K N <karthikkn1997@gmail.com> Date: Tue, 16 Apr 2024 13:24:52 +0530 Subject: [PATCH] User user provided vpc subnetid --- cloud/scope/powervs_cluster.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cloud/scope/powervs_cluster.go b/cloud/scope/powervs_cluster.go index a05af53fe..aea86c5ac 100644 --- a/cloud/scope/powervs_cluster.go +++ b/cloud/scope/powervs_cluster.go @@ -439,10 +439,19 @@ func (s *PowerVSClusterScope) GetVPCSubnetID(subnetName string) *string { // GetVPCSubnetIDs returns all the VPC subnet ids. func (s *PowerVSClusterScope) GetVPCSubnetIDs() []*string { + subnets := []*string{} + // use the vpc subnet id set by user. + for _, subnet := range s.IBMPowerVSCluster.Spec.VPCSubnets { + if subnet.ID != nil { + subnets = append(subnets, subnet.ID) + } + } + if len(subnets) != 0 { + return subnets + } if s.IBMPowerVSCluster.Status.VPCSubnet == nil { return nil } - subnets := []*string{} for _, subnet := range s.IBMPowerVSCluster.Status.VPCSubnet { subnets = append(subnets, subnet.ID) }