Skip to content

Commit

Permalink
not assign floating ip when there are multiple controller nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jichenjc committed Jun 24, 2022
1 parent 361fab8 commit 16e7586
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/book/src/clusteropenstack/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ openstack floating ip create <public network>

Note: Only user with admin role can create a floating IP with specific IP.

Note: When associate floating ip to a cluster with more than 1 controller nodes, the floating ip will be
associated to the first controller node and the other controller nodes doesn't have floating ip. When
the controller node has the floating ip is down CAPO will NOT auto assign the floating ip address
to any other controller node. So we recommend to only set one controller node when floating ip is needed,
or please consider using loadbalancer instead, see [issue 1265](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/issues/1265) for further information.

### Disabling the API server floating IP

It is possible to provision a cluster without a floating IP for the API server by setting
Expand Down
7 changes: 6 additions & 1 deletion pkg/cloud/services/networking/floatingip.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ var backoff = wait.Backoff{
func (s *Service) AssociateFloatingIP(eventObject runtime.Object, fp *floatingips.FloatingIP, portID string) error {
s.scope.Logger.Info("Associating floating IP", "id", fp.ID, "ip", fp.FloatingIP)

if len(fp.PortID) != 0{
s.scope.Logger.Info("Floating IP already associated to other port:", "id", fp.ID, "fixed ip", fp.FixedIP)
return nil
}

if fp.PortID == portID {
s.scope.Logger.Info("Floating IP already associated:", "id", fp.ID, "ip", fp.FloatingIP)
s.scope.Logger.Info("Floating IP already associated to same port:", "id", fp.ID, "ip", fp.FloatingIP)
return nil
}

Expand Down

0 comments on commit 16e7586

Please sign in to comment.