Skip to content

Commit

Permalink
Merge pull request #1002 from MaysaMacedo/fix-ports-names
Browse files Browse the repository at this point in the history
Bug 1935473: Include LB members for Machines created on day-2 operation
  • Loading branch information
openshift-merge-robot committed Mar 12, 2021
2 parents 2cf9881 + fbecaeb commit baced66
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/platform/openstack/kuryr_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,12 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient client.Client) (*bootst
// the API. With healthchecks enabled for the pool we'll get masters added automatically
// when they're up and ready.
log.Print("Creating OpenShift API loadbalancer pool members")
r, _ := regexp.Compile(fmt.Sprintf("^%s-(master-port-[0-9]+|bootstrap-port)$", clusterID))
r, _ := regexp.Compile(fmt.Sprintf("^%s-(master-port-[0-9]+|bootstrap-port|master-[0-9]+)$", clusterID))
portList, err := listOpenStackPortsMatchingPattern(client, tag, r)
if err != nil {
return nil, errors.Wrap(err, "failed to list openstack master ports")
}

addresses := make([]string, 0)
for _, port := range portList {
if len(port.FixedIPs) > 0 {
Expand All @@ -603,6 +607,10 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient client.Client) (*bootst
}
}

if len(portList) == 0 {
return nil, errors.New("No master ports found. Load Balancer members not ensured.")
}

err = purgeOpenStackLbPoolMember(lbClient, poolId, addresses)
if err != nil {
return nil, errors.Wrap(err, "Failed on purging invalid LB members from LB pool")
Expand Down

0 comments on commit baced66

Please sign in to comment.