Merge pull request #12529 from hashicorp/add-meta-to-service-config-response

Add `Meta` to `ServiceConfigResponse`
This commit is contained in:
Eric Haberkorn 2022-03-07 16:35:21 -05:00 committed by GitHub
commit abfcde1bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 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` is returned with the response to the `ConfigEntry.ResolveServiceConfig` RPC.
```

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

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

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 `json:",omitempty"`
QueryMeta
}