-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
allow ELB Healthcheck configuration via Service annotations #56024
allow ELB Healthcheck configuration via Service annotations #56024
Conversation
Hi!
This is my first PR, let me know if I could be reusing some functionality or if my style is inconsistent. Thanks! :) |
091d8a4
to
9237af6
Compare
} | ||
return &i64, nil | ||
} | ||
if i, err := getOrDefault(ServiceAnnotationLoadBalancerHCHealthyThreshold, defaultHCHealthyThreshold); err != 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.
This might be easier as:
var err error
healthcheck.HealthyThreshold, err = getOrDefault(ServiceAnnotationLoadBalancerHCHealthyThreshold, defaultHCHealthyThreshold)
if err != nil {
return nil, err
}
...
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.
Oh, of course! It looks much nicer now, thanks!
if err != nil { | ||
return fmt.Errorf("cannot update health check for load balancer %q: %q", name, err) | ||
} | ||
if reflect.DeepEqual(expected, actual) { |
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.
This is dangerous, because it breaks if another field is added to the struct in future. Safer to use the explicit field-by-field comparison.
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.
Good catch! I've fixed it, please take another look. I've opted for using aws.Int64Value
instead of the less verbose orZero
because it's docs say it is deprecated.
/ok-to-test This is really great, thank you @dimpavloff . I agree with just allowing the 4 "timing" values to be set - at least initially. I had a suggestion on a simpler way (maybe) to write the get-or-default calls, but that was only an idea. But that's only a suggestion, your way works great. If you can fix the use of reflect.DeepEqual though I think this looks good. If you can do it today we can get it into 1.9 I think. |
1bbfae0
to
b1526be
Compare
The constants which have been used so far have been set as default in case the annotations have not been set.
b1526be
to
8cf7c5e
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.
Thanks for reviewing, @justinsb :) I've updated the PR and fixed the bazel test dependency, please take another look.
If you can do it today we can get it into 1.9 I think.
Amazing!
} | ||
return &i64, nil | ||
} | ||
if i, err := getOrDefault(ServiceAnnotationLoadBalancerHCHealthyThreshold, defaultHCHealthyThreshold); err != 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.
Oh, of course! It looks much nicer now, thanks!
if err != nil { | ||
return fmt.Errorf("cannot update health check for load balancer %q: %q", name, err) | ||
} | ||
if reflect.DeepEqual(expected, actual) { |
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.
Good catch! I've fixed it, please take another look. I've opted for using aws.Int64Value
instead of the less verbose orZero
because it's docs say it is deprecated.
/lgtm /approve |
/kind kind/feature |
/approve no-issue |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dimpavloff, justinsb Associated issue requirement bypassed by: justinsb The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
[MILESTONENOTIFIER] Milestone Pull Request Needs Attention @dimpavloff @jsafrane @justinsb @zmerlynn @kubernetes/sig-aws-misc Action required: During code slush, pull requests in the milestone should be in progress. Note: This pull request is marked as Example update:
Pull Request Labels
|
Automatic merge from submit-queue (batch tested with PRs 56211, 56024). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
The default settings which are set on the ELB HC work well but there are cases when it would be better to tweak its parameters -- for example, faster detection of unhealthy backends. This PR makes it possible to override any of the healthcheck's parameters via annotations on the Service, with the exception of the Target setting which continues to be inferred from the Service's spec.
Release note: