Skip to content

Commit

Permalink
User user provided vpc subnetid (#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-K-N authored Apr 16, 2024
1 parent fbbd4e6 commit f33fc88
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cloud/scope/powervs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit f33fc88

Please sign in to comment.