consul/agent/grpc-external/services/peerstream
Derek Menteer 50ef6a697e
Fix issue with peer stream node cleanup. (#17235)
Fix issue with peer stream node cleanup.

This commit encompasses a few problems that are closely related due to their
proximity in the code.

1. The peerstream utilizes node IDs in several locations to determine which
nodes / services / checks should be cleaned up or created. While VM deployments
with agents will likely always have a node ID, agentless uses synthetic nodes
and does not populate the field. This means that for consul-k8s deployments, all
services were likely bundled together into the same synthetic node in some code
paths (but not all), resulting in strange behavior. The Node.Node field should
be used instead as a unique identifier, as it should always be populated.

2. The peerstream cleanup process for unused nodes uses an incorrect query for
node deregistration. This query is NOT namespace aware and results in the node
(and corresponding services) being deregistered prematurely whenever it has zero
default-namespace services and 1+ non-default-namespace services registered on
it. This issue is tricky to find due to the incorrect logic mentioned in #1,
combined with the fact that the affected services must be co-located on the same
node as the currently deregistering service for this to be encountered.

3. The stream tracker did not understand differences between services in
different namespaces and could therefore report incorrect numbers. It was
updated to utilize the full service name to avoid conflicts and return proper
results.
2023-05-08 13:13:25 -05:00
..
health_snapshot.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
health_snapshot_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
mock_ACLResolver.go xds: don't attempt to load-balance sessions for local proxies (#15789) 2023-01-18 12:33:21 -06:00
replication.go Fix issue with peer stream node cleanup. (#17235) 2023-05-08 13:13:25 -05:00
server.go Fix issue with peer stream node cleanup. (#17235) 2023-05-08 13:13:25 -05:00
server_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
stream_resources.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
stream_test.go Fix issue with peer stream node cleanup. (#17235) 2023-05-08 13:13:25 -05:00
stream_tracker.go Fix issue with peer stream node cleanup. (#17235) 2023-05-08 13:13:25 -05:00
stream_tracker_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_blocking.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_manager.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_manager_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_state.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_state_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
subscription_view.go server: wire up in-process Resource Service (#16978) 2023-04-18 10:03:23 +01:00
subscription_view_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
testing.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00