Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[octavia-ingress-controller] Ingress: Fix listener timeout updates #2518

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions pkg/ingress/controller/openstack/octavia.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,19 +365,28 @@ func (os *OpenStack) EnsureListener(name string, lbID string, secretRefs []strin

log.WithFields(log.Fields{"lbID": lbID, "listenerName": name}).Info("listener created")
} else {
updateOpts := listeners.UpdateOpts{}
if len(listenerAllowedCIDRs) > 0 && !reflect.DeepEqual(listener.AllowedCIDRs, listenerAllowedCIDRs) {
_, err := listeners.Update(os.Octavia, listener.ID, listeners.UpdateOpts{
AllowedCIDRs: &listenerAllowedCIDRs,
TimeoutClientData: timeoutClientData,
TimeoutMemberData: timeoutMemberData,
TimeoutMemberConnect: timeoutMemberConnect,
TimeoutTCPInspect: timeoutTCPInspect,
}).Extract()
updateOpts.AllowedCIDRs = &listenerAllowedCIDRs
}

if timeoutClientData == nil && listener.TimeoutClientData != 0 || timeoutClientData != nil && *timeoutClientData != listener.TimeoutClientData ||
timeoutMemberData == nil && listener.TimeoutMemberData != 0 || timeoutMemberData != nil && *timeoutMemberData != listener.TimeoutMemberData ||
timeoutMemberConnect == nil && listener.TimeoutMemberConnect != 0 || timeoutMemberData != nil && *timeoutMemberConnect != listener.TimeoutMemberConnect ||
timeoutTCPInspect == nil && listener.TimeoutTCPInspect != 0 || timeoutTCPInspect != nil && *timeoutTCPInspect != listener.TimeoutTCPInspect {
Comment on lines +373 to +376
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone knows how to do this in a cleaner way, I'm happy to hear ideas. I spent quite some time on this and I still don't like it.

updateOpts.TimeoutClientData = timeoutClientData
updateOpts.TimeoutMemberData = timeoutMemberData
updateOpts.TimeoutMemberConnect = timeoutMemberConnect
updateOpts.TimeoutTCPInspect = timeoutTCPInspect
}

if updateOpts != (listeners.UpdateOpts{}) {
_, err := listeners.Update(os.Octavia, listener.ID, updateOpts).Extract()
if err != nil {
return nil, fmt.Errorf("failed to update listener allowed CIDRs: %v", err)
return nil, fmt.Errorf("failed to update listener options: %v", err)
}

log.WithFields(log.Fields{"listenerID": listener.ID}).Debug("listener allowed CIDRs updated")
log.WithFields(log.Fields{"listenerID": listener.ID}).Debug("listener options updated")
}
}

Expand Down