mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Rename fields on proxyConfig (#15541)
* Change api Fields for expose and paths * Add changelog entry * changelog: add deprecation notes about connect fields * api: minor style tweaks --------- Co-authored-by: Seth Hoenig <shoenig@duck.com>
This commit is contained in:
@@ -1646,11 +1646,18 @@ func apiConnectSidecarServiceProxyToStructs(in *api.ConsulProxy) *structs.Consul
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: to maintain backwards compatibility
|
||||
expose := in.Expose
|
||||
if in.ExposeConfig != nil {
|
||||
expose = in.ExposeConfig
|
||||
}
|
||||
|
||||
return &structs.ConsulProxy{
|
||||
LocalServiceAddress: in.LocalServiceAddress,
|
||||
LocalServicePort: in.LocalServicePort,
|
||||
Upstreams: apiUpstreamsToStructs(in.Upstreams),
|
||||
Expose: apiConsulExposeConfigToStructs(in.ExposeConfig),
|
||||
Expose: apiConsulExposeConfigToStructs(expose),
|
||||
Config: maps.Clone(in.Config),
|
||||
}
|
||||
}
|
||||
@@ -1686,8 +1693,15 @@ func apiConsulExposeConfigToStructs(in *api.ConsulExposeConfig) *structs.ConsulE
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: to maintain backwards compatibility
|
||||
paths := in.Paths
|
||||
if in.Path != nil {
|
||||
paths = in.Path
|
||||
}
|
||||
|
||||
return &structs.ConsulExposeConfig{
|
||||
Paths: apiConsulExposePathsToStructs(in.Path),
|
||||
Paths: apiConsulExposePathsToStructs(paths),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3694,7 +3694,7 @@ func TestConversion_apiConsulExposeConfigToStructs(t *testing.T) {
|
||||
require.Equal(t, &structs.ConsulExposeConfig{
|
||||
Paths: []structs.ConsulExposePath{{Path: "/health"}},
|
||||
}, apiConsulExposeConfigToStructs(&api.ConsulExposeConfig{
|
||||
Path: []*api.ConsulExposePath{{Path: "/health"}},
|
||||
Paths: []*api.ConsulExposePath{{Path: "/health"}},
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -3747,8 +3747,8 @@ func TestConversion_apiConnectSidecarServiceProxyToStructs(t *testing.T) {
|
||||
Upstreams: []*api.ConsulUpstream{{
|
||||
DestinationName: "upstream",
|
||||
}},
|
||||
ExposeConfig: &api.ConsulExposeConfig{
|
||||
Path: []*api.ConsulExposePath{{
|
||||
Expose: &api.ConsulExposeConfig{
|
||||
Paths: []*api.ConsulExposePath{{
|
||||
Path: "/health",
|
||||
}},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user