Add `Meta` to `ServiceConfigResponse`

This commit is contained in:
Eric 2022-03-04 16:41:23 -05:00
parent 19fe3e14d1
commit 3d46f9ef7c
4 changed files with 9 additions and 0 deletions

3
.changelog/12529.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:feature
server: Ensure that service-defaults `Meta` to is included in `ServiceConfigResponse`.
```

View File

@ -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.

View File

@ -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,
}

View File

@ -985,6 +985,7 @@ type ServiceConfigResponse struct {
Expose ExposeConfig `json:",omitempty"`
TransparentProxy TransparentProxyConfig `json:",omitempty"`
Mode ProxyMode `json:",omitempty"`
Meta map[string]string
QueryMeta
}