Skip to content

Commit

Permalink
Merge bfc501a into backport/zalimeni/net-5217-derive-proxy-locality-f…
Browse files Browse the repository at this point in the history
…rom-parent-service/suitably-charmed-goat
  • Loading branch information
hc-github-team-consul-core committed Aug 10, 2023
2 parents 1c17f15 + bfc501a commit 777e731
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
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

0 comments on commit 777e731

Please sign in to comment.