-
Notifications
You must be signed in to change notification settings - Fork 1.5k
filter redundant health check SG rules #2006
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2006 +/- ##
==========================================
+ Coverage 49.05% 49.15% +0.10%
==========================================
Files 130 130
Lines 7008 7022 +14
==========================================
+ Hits 3438 3452 +14
Misses 3292 3292
Partials 278 278
Continue to review full report at Codecov.
|
func (t *defaultModelBuildTask) buildHealthCheckNetworkingIngressRules(trafficSource, hcSource []elbv2model.NetworkingPeer, tgPort, hcPort intstr.IntOrString, | ||
tgProtocol corev1.Protocol, preserveClientIP, customSoureRanges bool) []elbv2model.NetworkingIngressRule { | ||
if tgProtocol != corev1.ProtocolUDP && | ||
(hcPort.String() == healthCheckPortTrafficPort || hcPort.IntValue() == tgPort.IntValue()) { |
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.
Nit:
hcPort.IntValue() == tgPort.IntValue
this check is hacky.
If somehow in the future, both hcPort and tgPort is a string but not equal, this will evaluate to true.
ideally we should check hcPort's type.
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.
currently health check port is limited to int values. Will revisit this logic when we support named ports as well.
if !preserveClientIP { | ||
return []elbv2model.NetworkingIngressRule{} | ||
} | ||
if !customSoureRanges { |
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.
LGTM for this version.
however, this becomes really complicated. we should refactor this logic here by some thing like compare CIDRs in the future.
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.
once we have SG support for NLB, this wouldn't be a matter of concern.
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.
lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kishorj, M00nF1sh 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 |
/lgtm |
Filter out redundant health check security group rules when the following conditions are met
In case of preserve client IP disabled, separate set of health check rules do not get added if traffic and health check ports are the same.