Set --max-obj-name-len 256 when execing Envoy (#6202)

* Pass -max-obj-name-len 256 to envoy

* Update test expectations.

* Add a note about requireing the max-obj-name-len option to be set
This commit is contained in:
Matt Keeler 2019-07-26 15:43:15 -04:00 committed by GitHub
parent 3ca566a152
commit 59454c7edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -29,6 +29,8 @@ func TestExecEnvoy(t *testing.T) {
"--config-path", "--config-path",
"{{ got.ConfigPath }}", "{{ got.ConfigPath }}",
"--disable-hot-restart", "--disable-hot-restart",
"--max-obj-name-len",
"256",
"--fake-envoy-arg", "--fake-envoy-arg",
}, },
}, },
@ -42,6 +44,8 @@ func TestExecEnvoy(t *testing.T) {
// that value further below. // that value further below.
"{{ got.ConfigPath }}", "{{ got.ConfigPath }}",
// No --disable-hot-restart // No --disable-hot-restart
"--max-obj-name-len",
"256",
"--fake-envoy-arg", "--fake-envoy-arg",
"--restart-epoch", "--restart-epoch",
"1", "1",
@ -57,6 +61,8 @@ func TestExecEnvoy(t *testing.T) {
// that value further below. // that value further below.
"{{ got.ConfigPath }}", "{{ got.ConfigPath }}",
// No --disable-hot-restart // No --disable-hot-restart
"--max-obj-name-len",
"256",
"--fake-envoy-arg", "--fake-envoy-arg",
// Restart epoch defaults to 0 if not given and not disabled. // Restart epoch defaults to 0 if not given and not disabled.
"--drain-time-s", "--drain-time-s",
@ -73,6 +79,8 @@ func TestExecEnvoy(t *testing.T) {
// that value further below. // that value further below.
"{{ got.ConfigPath }}", "{{ got.ConfigPath }}",
// No --disable-hot-restart // No --disable-hot-restart
"--max-obj-name-len",
"256",
"--fake-envoy-arg", "--fake-envoy-arg",
// Restart epoch defaults to 0 if not given and not disabled. // Restart epoch defaults to 0 if not given and not disabled.
"--parent-shutdown-time-s", "--parent-shutdown-time-s",
@ -89,6 +97,8 @@ func TestExecEnvoy(t *testing.T) {
// that value further below. // that value further below.
"{{ got.ConfigPath }}", "{{ got.ConfigPath }}",
// No --disable-hot-restart // No --disable-hot-restart
"--max-obj-name-len",
"256",
"--fake-envoy-arg", "--fake-envoy-arg",
// Restart epoch defaults to 0 if not given and not disabled. // Restart epoch defaults to 0 if not given and not disabled.
"--hot-restart-version", "--hot-restart-version",

View File

@ -49,6 +49,17 @@ func hasHotRestartOption(argSets ...[]string) bool {
return false return false
} }
func hasMaxObjNameLenOption(argSets ...[]string) bool {
for _, args := range argSets {
for _, opt := range args {
if opt == "--max-obj-name-len" {
return true
}
}
}
return false
}
func makeBootstrapPipe(bootstrapJSON []byte) (string, error) { func makeBootstrapPipe(bootstrapJSON []byte) (string, error) {
pipeFile := filepath.Join(os.TempDir(), pipeFile := filepath.Join(os.TempDir(),
fmt.Sprintf("envoy-%x-bootstrap.json", time.Now().UnixNano()+int64(os.Getpid()))) fmt.Sprintf("envoy-%x-bootstrap.json", time.Now().UnixNano()+int64(os.Getpid())))
@ -130,6 +141,9 @@ func execEnvoy(binary string, prefixArgs, suffixArgs []string, bootstrapJSON []b
if disableHotRestart { if disableHotRestart {
envoyArgs = append(envoyArgs, "--disable-hot-restart") envoyArgs = append(envoyArgs, "--disable-hot-restart")
} }
if !hasMaxObjNameLenOption(prefixArgs, suffixArgs) {
envoyArgs = append(envoyArgs, "--max-obj-name-len", "256")
}
envoyArgs = append(envoyArgs, suffixArgs...) envoyArgs = append(envoyArgs, suffixArgs...)
// Exec // Exec

View File

@ -26,6 +26,9 @@ As an interim solution, you can add [custom Envoy configuration](#custom-configu
in the [proxy service definition](/docs/connect/registration/service-registration.html) allowing in the [proxy service definition](/docs/connect/registration/service-registration.html) allowing
you to use the more powerful features of Envoy. you to use the more powerful features of Envoy.
~> **Note:** When using Envoy with Consul and not using the [`consul connect envoy` command](/docs/commands/connect/envoy.html)
Envoy must be run with the `--max-obj-name-len` option set to `256` or greater.
## Supported Versions ## Supported Versions
Consul's Envoy support was added in version 1.3.0. The following table shows Consul's Envoy support was added in version 1.3.0. The following table shows