-
Notifications
You must be signed in to change notification settings - Fork 621
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]feat: add configurable listener timeout via ingress annotation #2435
[octavia-ingress-controller]feat: add configurable listener timeout via ingress annotation #2435
Conversation
Hi @sakshi-1505. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@pierreprinetti @dulek @jichenjc Request you to please review the above PR & let me know if I thought in the right redirection or not. I would say it was pretty much fun to navigate through the code of complete open stack & then finding all the different binary it produces and then investigating the octavia-controller's code. |
/ok-to-test |
pkg/ingress/controller/controller.go
Outdated
timeoutClientData := getIntFromIngressAnnotation(ing, IngressAnnotationTimeoutClientData, 50000) | ||
timeoutMemberConnect := getIntFromIngressAnnotation(ing, IngressAnnotationTimeoutMemberConnect, 5000) | ||
timeoutMemberData := getIntFromIngressAnnotation(ing, IngressAnnotationTimeoutMemberData, 50000) | ||
timeoutTCPInspect := getIntFromIngressAnnotation(ing, IngressAnnotationTimeoutTCPInspect, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that one requirement for this change should be: if the new annotations are not set in config, the Ingress behaves exactly as it was before this patch.
I am worried that setting an explicit default timeout changes the default behaviour. If no annotation is set, TimeoutXxx
fields in listeners.CreateOpts
should be left nil as they were previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable, thanks @pierreprinetti I have made the requested changes
d41e20a
to
3c1ca51
Compare
3c1ca51
to
7105c66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried that in case the annotation input is malformed, it's very hard to diagnose an anomalous behaviour.
I think there is at least one case we should take into consideration: the case where the annotation is not properly formatted as an int (for example: a rogue character, maybe a space, slipped in). strconv.Atoi
would fail parsing and the Ingress would be created with the default Octavia setting, without any notice to the user.
At a minimum, I think that we should log if the parsing of an annotation failed, with a log line that states exactly which annotation failed parsing.
What do you think?
pkg/ingress/controller/controller.go
Outdated
@@ -1017,6 +1034,19 @@ func getStringFromIngressAnnotation(ingress *nwv1.Ingress, annotationKey string, | |||
return defaultValue | |||
} | |||
|
|||
// maybeGetIntFromIngressAnnotation searches a given Ingress for a specific annotationKey and either returns the | |||
// annotation's value or a specified defaultSetting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the docstring: it still refers to a default setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if annotationValue, ok := ingress.Annotations[annotationKey]; ok { | ||
returnValue, err := strconv.Atoi(annotationValue) | ||
if err != nil { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add logging here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WRT the logging level: I'd keep it consistent with this:
klog.V(4).Infof("Found a Service Annotation: %v = %v", annotationKey, returnValue) |
Note that this getBool function also has a logging issue, and I think @FavourEva is on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not using the getBool function, but yeah I got the context what you are referring to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pkg/ingress/controller/controller.go
Outdated
// IngressAnnotationTimeoutMemberConnet is the timeout for memer connect in ms | ||
IngressAnnotationTimeoutMemberConnect = "octavia.ingress.kubernetes.io/timeout-member-connect" | ||
|
||
// IngressAnnotationTimeoutMemberConnet is the timeout for memer connect in ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for completeness you could mention what's the default value (I suppose it's an Octavia setting?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in my previous implementation, I already had assigned default values to each of this parameter. I read the defaultValues from here in the octavia documentations
--timeout-client-data <timeout>
Frontend client inactivity timeout in milliseconds. Default: 50000.
--timeout-member-connect <timeout>
Backend member connection timeout in milliseconds. Default: 5000.
--timeout-member-data <timeout>
Backend member inactivity timeout in milliseconds. Default: 50000.
--timeout-tcp-inspect <timeout>
Time, in milliseconds, to wait for additional TCP packets for content inspection. Default: 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I just document default values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd point to he Octavia config argument, so that the user knows where to look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an octavia config argument but it's available for LB, when the controller starts to create listener it doesn't pass this value post so that LoadBalancer default values can get applied, so basically we are passing this in CreateOpts to let override the defaults available in LB. I will still add the docs of the CLI configs https://docs.openstack.org/octavia/latest/configuration/configref.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
8a7870e
to
1372b72
Compare
@pierreprinetti please re-review |
} | ||
return &returnValue | ||
} | ||
klog.V(4).Infof("Could not find a Service Annotation; falling back to default setting for annotation %v", annotationKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@pierreprinetti Please review again |
1b2c36a
to
20ef5e8
Compare
Signed-off-by: sakshi-1505 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Please run go fmt ./...
before we ping a maintainer again for review
20ef5e8
to
6a25117
Compare
Done, it was just a matter of few seconds before I squashed it 🙈 |
please do check again @pierreprinetti |
/lgtm |
/approve thanks for the update~ |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jichenjc The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
TimeoutClientData: timeoutClientData, | ||
TimeoutMemberData: timeoutMemberData, | ||
TimeoutMemberConnect: timeoutMemberConnect, | ||
TimeoutTCPInspect: timeoutTCPInspect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sakshi-1505: This is missing the update case, these properties can be updated, just like the AllowedCIDRs
option is in lines 368-371. Can you update that too?
…rnetes#2435) Signed-off-by: sakshi-1505 <[email protected]>
…rnetes#2435) Signed-off-by: sakshi-1505 <[email protected]>
What this PR does / why we need it:
This PR basically adds the ability to configure timeout via ingress annotations in ingress-controller.
Which issue this PR fixes(if applicable):
fixes #2243
Special notes for reviewers:
Release note: