Repository navigation
destination: return identity for a terminating pod when it is the only pod on its IP - #15770
aniketatgithub wants to merge 1 commit into
Conversation
…y pod on its IP Problem When a pod is terminating but still running, new meshed clients that connect to its IP get no identity from the destination controller. They connect in plaintext, and a port that only allows MeshTLSAuthentication denies them. `getIndexedPods` drops every pod with a `deletionTimestamp`, so a lookup that starts after the delete finds nothing, even though the pod is still serving traffic until its preStop hook finishes. Solution `getIndexedPods` now keeps a still-Running terminating pod as a fallback and returns it when it is the only pod on the IP. When a live pod shares the IP, the live pod wins, so the linkerd#5940 guard against two pods on one IP (AWS VPC CNI reusing a terminating pod's IP) is unchanged. Succeeded/Failed pods are never returned. Validation New `TestIpWatcherGetTerminatingPod` in `controller/api/destination/watcher/workload_watcher_test.go`: - a single terminating Running pod is returned by `getPodByPodIP` (fails before the fix, passes after) - a live pod wins when it shares the IP with a terminating pod - two terminating pods on one IP return no pod - a Succeeded pod with a deletion timestamp returns no pod `go test ./controller/api/destination/watcher/ -run TestIpWatcherGetTerminatingPod` passes; `gofmt` and `go vet` are clean on the changed package. Fixes linkerd#15765 Signed-off-by: Aniket <aniketkomailkro@gmail.com>
|
Friendly ping — this has been open a week with no review yet, and the workflows are still waiting for approval to run. Could someone approve the runs and take a look when they get a chance? |
|
@aniketatgithub hey thanks for reporting the issue.
Can you help me understand your use case here:
This make me pause since the logic is more complicated and correctness now relies on some subtle logic. This is why I would like to understand your usecase and see if there are other options. |
|
The reported use case is Pekko cluster remoting during rolling restarts, where new members join by connecting to existing members by IP while they leave, and the terminating pod still accepts connections until its preStop hook finishes. The alternative would be for joining members to wait out the grace period, which stalls cluster formation on every restart. The fix only makes new lookups match what lookups started before the delete already return, and the #5940 guard is unchanged when a live pod shares the IP. |
|
Thanks for picking this up @aniketatgithub, and thanks @toidiu for looking. Adding some context on the use case that lead to me reporting #15765: Why connect to a terminating pod?
What breaks?
Alternatives we tried or rejected:
On your subtle logic concern:
|
destination: return identity for a terminating pod when it is the only pod on its IP
Problem
When a pod is terminating but still running, new meshed clients that connect
to its IP get no identity from the destination controller. They connect in
plaintext, and a port that only allows MeshTLSAuthentication denies them.
getIndexedPodsdrops every pod with adeletionTimestamp, so a lookupthat starts after the delete finds nothing, even though the pod is still
serving traffic until its preStop hook finishes.
Solution
getIndexedPodsnow keeps a still-Running terminating pod as a fallback andreturns it when it is the only pod on the IP. When a live pod shares the IP,
the live pod wins, so the #5940 guard against two pods on one IP (AWS VPC
CNI reusing a terminating pod's IP) is unchanged. Succeeded/Failed pods are
never returned.
Validation
New
TestIpWatcherGetTerminatingPodincontroller/api/destination/watcher/workload_watcher_test.go:getPodByPodIP(fails before the fix, passes after)
go test ./controller/api/destination/watcher/ -run TestIpWatcherGetTerminatingPodpasses;
gofmtandgo vetare clean on the changed package.Fixes #15765
Signed-off-by: Aniket aniketkomailkro@gmail.com