-
Notifications
You must be signed in to change notification settings - Fork 27
✨ Allow address exclusion #182
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 address exclusion #182
Conversation
Welcome @Noroth! |
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.
One minor thing, looks good apart from that. Tests are failing and the linter is unhappy, could you take a look?
internal/webhooks/inclusterippool.go
Outdated
from := ipSet.Ranges()[0].From() | ||
hasIPv4Addr = hasIPv4Addr || from.Is4() | ||
hasIPv6Addr = hasIPv6Addr || from.Is6() | ||
} | ||
|
||
if hasIPv4Addr && hasIPv6Addr { | ||
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "excludedAddresses"), newPool.PoolSpec().ExcludedAddresses, "provided addresses are of mixed IP families")) |
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.
We need to make sure that the family of excludedAddresses
matches the family of addresses
, and not that the family is the same for all. This approach should work, but it would be good to be a bit more explicit about 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.
No problem, will add an additional check.
I initially thought that it wouldn't really matter as we are creating a set of IPs from the provided addresses and then just removing whatever is being found in the excluded addresses. Therefore if you attempt to remove ipv6 addresses from ipv4 addresses and vice versa, nothing will happen.
Seems like a test timed out. I tried to reproduce it locally but tests are never failing for me |
/test all |
@Noroth: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/cc @schrej I'm ready, could you please take another 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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Noroth, schrej 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 |
And thank you, by the way! 🎉 |
No problem, happy to contribute. Was always looking for a task that I could work on in the k8s environment 😁 |
What this PR does / why we need it:
Currently, the only way to exclude certain IP addresses is to specify multiple ranges inside the
addresses
field in theInClusterIPPoolSpec
.To enhance this, a new optional field will be added, where another list of IP addresses can be provided. These will be excluded during the allocation of new IP addresses.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #180