Implement ip pool selector logic for service#1693
Conversation
e25b8ec to
3413c0f
Compare
3413c0f to
c9d19db
Compare
controller/main.go
Outdated
| pools map[string]*config.Pool | ||
| ips *allocator.Allocator | ||
| client service | ||
| pools map[string]*config.Pool |
There was a problem hiding this comment.
Can we have a local higher level struct that wraps all the pools (pools itself plus the selectors)? In that way, we can have it expose methods too
There was a problem hiding this comment.
sure, moved this higher level struct into config and consuming it in every places.
controller/service.go
Outdated
| return ips, nil | ||
| } | ||
|
|
||
| pinnedPriorityPools, pinnedNoPriorityPools := c.getPinnedPools(svc) |
There was a problem hiding this comment.
I'd move all this logic to allocator's Allocate()
There was a problem hiding this comment.
yes, this is a cleaner solution. moved the logic into Allocate().
| For(&metallbv1beta1.IPAddressPool{}). | ||
| Watches(&source.Kind{Type: &metallbv1beta1.AddressPool{}}, &handler.EnqueueRequestForObject{}). | ||
| Watches(&source.Kind{Type: &metallbv1beta1.Community{}}, &handler.EnqueueRequestForObject{}). | ||
| Watches(&source.Kind{Type: &corev1.Namespace{}}, &handler.EnqueueRequestForObject{}). |
There was a problem hiding this comment.
We need a predicate that discard events on the namespace that do not involve changing labels.
9d79fbb to
e847f37
Compare
|
hint for static-security-analysis, |
e847f37 to
10497dd
Compare
Can you also make this available from inv command via tasks.py ? |
e1aee19 to
dea0efb
Compare
dea0efb to
4c79d4c
Compare
b67ff14 to
943c04c
Compare
6f51119 to
2f4e14d
Compare
2f4e14d to
35ea87e
Compare
This changes ip allocation logic when ip pools are configured with namespace, service/namespace label selectors so that ip are allocated from desired pools based on its priority before it tries to allocate from other ip pools. Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
35ea87e to
5e3a147
Compare
This adds relevant e2e tests covering functionality of ip pools pinned with specific namespace and/or service labels. Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
5e3a147 to
38ab7e2
Compare
|
LGTM! |
This changes ip allocation logic when ip pools are configured with namespace, service/namespace label selectors so that ip are allocated from desired pools based on its priority before it tries to allocate from other ip pools.
Signed-off-by: Periyasamy Palanisamy pepalani@redhat.com