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

Backport of [NET-5217] Apply K8s node locality to services and sidecars into release/1.2.x #2752

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2748.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
control-plane: Set locality on sidecar proxies in addition to services when registering with connect-inject.
```
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ func (r *Controller) createServiceRegistrations(pod corev1.Pod, serviceEndpoints
Namespace: consulNS,
Proxy: proxyConfig,
Tags: tags,
// Sidecar locality (not proxied service locality) is used for locality-aware routing.
Locality: locality,
}

// A user can enable/disable tproxy for an entire namespace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,10 @@ func TestReconcileCreateEndpoint(t *testing.T) {
"envoy_telemetry_collector_bind_socket_dir": "/consul/connect-inject",
},
},
ServiceLocality: &api.Locality{
Region: "us-west-1",
Zone: "us-west-1a",
},
ServiceMeta: map[string]string{
"name": "abc",
"version": "2",
Expand Down Expand Up @@ -2209,6 +2213,7 @@ func TestReconcileCreateEndpoint(t *testing.T) {
require.Equal(t, tt.expectedProxySvcInstances[i].ServicePort, instance.ServicePort)
require.Equal(t, tt.expectedProxySvcInstances[i].ServiceMeta, instance.ServiceMeta)
require.Equal(t, tt.expectedProxySvcInstances[i].ServiceTags, instance.ServiceTags)
require.Equal(t, tt.expectedProxySvcInstances[i].ServiceLocality, instance.ServiceLocality)
if tt.nodeMeta != nil {
require.Equal(t, tt.expectedProxySvcInstances[i].NodeMeta, instance.NodeMeta)
}
Expand Down