ensure consul config write has snake case conversions for MeshGateway (#6062)

This commit is contained in:
R.B. Boyer 2019-07-02 17:15:30 -05:00 committed by GitHub
parent 3eb3ee5a15
commit 065550e1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -138,7 +138,13 @@ func newDecodeConfigEntry(raw map[string]interface{}) (api.ConfigEntry, error) {
switch entry.GetKind() {
case api.ProxyDefaults:
translateKeysDict = map[string]string{
"mesh_gateway": "meshgateway",
}
case api.ServiceDefaults:
translateKeysDict = map[string]string{
"mesh_gateway": "meshgateway",
}
case api.ServiceRouter:
skipWhenPatching = []string{
"routes",

View File

@ -145,6 +145,9 @@ func TestParseConfigEntry(t *testing.T) {
"moar" = "config"
}
}
mesh_gateway {
mode = "remote"
}
`,
camel: `
Kind = "proxy-defaults"
@ -156,6 +159,9 @@ func TestParseConfigEntry(t *testing.T) {
"moar" = "config"
}
}
MeshGateway {
Mode = "remote"
}
`,
expect: &api.ProxyConfigEntry{
Kind: "proxy-defaults",
@ -167,6 +173,9 @@ func TestParseConfigEntry(t *testing.T) {
"moar": "config",
},
},
MeshGateway: api.MeshGatewayConfig{
Mode: api.MeshGatewayModeRemote,
},
},
},
{
@ -175,16 +184,25 @@ func TestParseConfigEntry(t *testing.T) {
kind = "service-defaults"
name = "main"
protocol = "http"
mesh_gateway {
mode = "remote"
}
`,
camel: `
Kind = "service-defaults"
Name = "main"
Protocol = "http"
MeshGateway {
Mode = "remote"
}
`,
expect: &api.ServiceConfigEntry{
Kind: "service-defaults",
Name: "main",
Protocol: "http",
MeshGateway: api.MeshGatewayConfig{
Mode: api.MeshGatewayModeRemote,
},
},
},
{