diff --git a/.changelog/12529.txt b/.changelog/12529.txt new file mode 100644 index 000000000..15368df15 --- /dev/null +++ b/.changelog/12529.txt @@ -0,0 +1,3 @@ +```release-note:feature +server: Ensure that service-defaults `Meta` to is included in `ServiceConfigResponse`. +``` diff --git a/agent/consul/config_endpoint.go b/agent/consul/config_endpoint.go index 3cb93c4d2..063d4412b 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 b5778b823..f9e1e310d 100644 --- a/agent/consul/config_endpoint_test.go +++ b/agent/consul/config_endpoint_test.go @@ -1029,10 +1029,12 @@ func TestConfigEntry_ResolveServiceConfig(t *testing.T) { "foo": 1, }, })) + meta := map[string]string{"foo": "bar"} require.NoError(t, state.EnsureConfigEntry(2, &structs.ServiceConfigEntry{ Kind: structs.ServiceDefaults, Name: "foo", Protocol: "http", + Meta: meta, })) require.NoError(t, state.EnsureConfigEntry(2, &structs.ServiceConfigEntry{ Kind: structs.ServiceDefaults, @@ -1058,6 +1060,7 @@ func TestConfigEntry_ResolveServiceConfig(t *testing.T) { "protocol": "grpc", }, }, + Meta: meta, // 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 4f7ec4cd7..f7b82d80f 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 QueryMeta }