Skip to content
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

k8s,daemon: Implement service topology aware hints #17929

Merged
merged 8 commits into from Nov 25, 2021
Merged

Conversation

brb
Copy link
Member

@brb brb commented Nov 18, 2021

Fix #9708.

Add K8s Service Topology Aware Hints

@brb brb added area/daemon Impacts operation of the Cilium daemon. release-note/major This PR introduces major new functionality to Cilium. sig/loadbalancing labels Nov 18, 2021
@brb brb force-pushed the pr/brb/svc-topology branch 5 times, most recently from 8fd9adb to 84d34b3 Compare November 19, 2021 07:28
@brb
Copy link
Member Author

brb commented Nov 19, 2021

/test

@brb
Copy link
Member Author

brb commented Nov 19, 2021

/test

@borkmann
Copy link
Member

(4.19 hitting known flake #17881)

@brb
Copy link
Member Author

brb commented Nov 19, 2021

The 4.19 CI hit #17881.

@brb brb marked this pull request as ready for review November 19, 2021 10:46
@brb brb requested a review from a team November 19, 2021 10:46
@brb brb requested review from a team as code owners November 19, 2021 10:46
@brb brb requested review from a team, joamaki and michi-covalent November 19, 2021 10:46
@brb brb requested a review from gandro November 19, 2021 10:46
@pchaigno
Copy link
Member

Job 'Cilium-PR-Runtime-net-next' hit: #17897 (93.84% similarity)

MLH is incorrect here. Please triage the test failure again :-)

(We should avoid relying on MLH for flakes in RuntimePrivilegedUnitTest as it's identifying all failures in that test as the same flake.)

@brb
Copy link
Member Author

brb commented Nov 24, 2021

test-1.16-netnext

@brb
Copy link
Member Author

brb commented Nov 25, 2021

net-next started to flake with egress gw suite. Restarting to see how often it flakes. Meanwhile, doing the investigation.

This is going to be used by the upcoming (service) topology aware hints
feature.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
It's going to be used by the k8s service topology aware hints feature to
be implemented in the next commit.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
The swg (stoppable wait group) is used by the service_cache.go when
syncing k8s caches upon the agent startup. Until now, service_cache was
consuming only Service and Endpoint* objects. However, for the upcoming
service topology aware hints feature we need to add (self) Node object
as well to the list. This is because the feature needs to get the
"topology.kubernetes.io/zone" of the self Node.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
This commit implements the topology aware hints for k8s services
described in [1].

The idea of the feature is to provision service endpoints only if their
zone hints matches the self node's "topology.kubernetes.io/zone" label
value.

The main benefit is that it allows service traffic to prefer zone-local
endpoints which could be used e.g., to avoid costs associated with
crossing cloud network zones. Also, it might yield better performance
for service traffic, as the nearer endpoints are preferred.

The hints for endpoints is set by kube-controller-manager. The
heuristics are described in [1]. The hints are set in the
EndpointsliceV1 object (this is the reason why we don't implement the
hints parsing for other endpoint object types).

I considered implementing the feature in "pkg/service" instead of
"pkg/k8s". The main reasons for choosing the latter is (1) that this
feature is k8s specific and (2) that in the near future we probably
will merge "pkg/service" with "pkg/maps/lbmap", as both deal with the
low-level datapath specific details.

[1]: https://kubernetes.io/docs/concepts/services-networking/topology-aware-hints/

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Previously, the function returned all passed endpoints instead the ones
which were filtered and correlated by correlateEndpoints().

The change is no-op, as nobody was consuming the return value of
UpdateEndpoint*().

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
This enables k8s service topology aware hints.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
@brb
Copy link
Member Author

brb commented Nov 25, 2021

/test

@brb
Copy link
Member Author

brb commented Nov 25, 2021

The CI flakes listed above unrelated to my PR. Marking as ready to merge.

@brb brb added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. needs-backport/1.11 labels Nov 25, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.11.0 Nov 25, 2021
@brb brb removed the dont-merge/wait-until-release Freeze window for current release is blocking non-bugfix PRs label Nov 25, 2021
@qmonnet qmonnet merged commit 0b27f80 into master Nov 25, 2021
@qmonnet qmonnet deleted the pr/brb/svc-topology branch November 25, 2021 17:34
@qmonnet qmonnet mentioned this pull request Nov 26, 2021
12 tasks
@joestringer joestringer added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. and removed backport-pending/1.11 labels Dec 3, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport done to v1.11 in 1.11.0 Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/major This PR introduces major new functionality to Cilium.
Projects
No open projects
1.11.0
Backport done to v1.11
Development

Successfully merging this pull request may close these issues.

Support for Service Topology Aware Hints