diff --git a/.changelog/12529.txt b/.changelog/12529.txt new file mode 100644 index 0000000000..c4ebe87e52 --- /dev/null +++ b/.changelog/12529.txt @@ -0,0 +1,3 @@ +```release-note:feature +server: Ensure that service-defaults `Meta` is returned with the response to the `ConfigEntry.ResolveServiceConfig` RPC. +``` diff --git a/agent/consul/config_endpoint.go b/agent/consul/config_endpoint.go index 3cb93c4d25..063d4412b4 100644 --- a/agent/consul/config_endpoint.go +++ b/agent/consul/config_endpoint.go @@ -591,6 +591,8 @@ func (c *ConfigEntry) computeResolvedServiceConfig( if serviceConf.Mode != structs.ProxyModeDefault { thisReply.Mode = serviceConf.Mode } + + thisReply.Meta = serviceConf.Meta } // First collect all upstreams into a set of seen upstreams. diff --git a/agent/consul/config_endpoint_test.go b/agent/consul/config_endpoint_test.go index b5778b8234..e5c0b7f6df 100644 --- a/agent/consul/config_endpoint_test.go +++ b/agent/consul/config_endpoint_test.go @@ -1033,6 +1033,7 @@ func TestConfigEntry_ResolveServiceConfig(t *testing.T) { Kind: structs.ServiceDefaults, Name: "foo", Protocol: "http", + Meta: map[string]string{"foo": "bar"}, })) require.NoError(t, state.EnsureConfigEntry(2, &structs.ServiceConfigEntry{ Kind: structs.ServiceDefaults, @@ -1058,6 +1059,7 @@ func TestConfigEntry_ResolveServiceConfig(t *testing.T) { "protocol": "grpc", }, }, + Meta: map[string]string{"foo": "bar"}, // Don't know what this is deterministically QueryMeta: out.QueryMeta, } diff --git a/agent/structs/config_entry.go b/agent/structs/config_entry.go index 4f7ec4cd77..4ca0ee6317 100644 --- a/agent/structs/config_entry.go +++ b/agent/structs/config_entry.go @@ -985,6 +985,7 @@ type ServiceConfigResponse struct { Expose ExposeConfig `json:",omitempty"` TransparentProxy TransparentProxyConfig `json:",omitempty"` Mode ProxyMode `json:",omitempty"` + Meta map[string]string `json:",omitempty"` QueryMeta }