From 493d9df6579161aa13745cc49ea31e740f6a23e7 Mon Sep 17 00:00:00 2001 From: Kevin Jing Qiu Date: Wed, 11 Dec 2019 22:47:28 -0500 Subject: [PATCH] Change `ExtraEnvoyArgs` to `ExtraEnvoyOpts` --- connect-inject/container_sidecar.go | 4 ++-- connect-inject/container_sidecar_test.go | 16 ++++++++-------- connect-inject/handler.go | 4 ++-- subcommand/inject-connect/command.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/connect-inject/container_sidecar.go b/connect-inject/container_sidecar.go index 5e60811ec0..72b718990d 100644 --- a/connect-inject/container_sidecar.go +++ b/connect-inject/container_sidecar.go @@ -17,8 +17,8 @@ func (h *Handler) getContainerSidecarCommand() ([]string, error) { "--config-path", "/consul/connect-inject/envoy-bootstrap.yaml", } - if h.ExtraEnvoyArgs != "" { - tokens, err := shlex.Split(h.ExtraEnvoyArgs) + if h.ExtraEnvoyOpts != "" { + tokens, err := shlex.Split(h.ExtraEnvoyOpts) if err != nil { return []string{}, err } diff --git a/connect-inject/container_sidecar_test.go b/connect-inject/container_sidecar_test.go index 69b1c10674..ecfafef53c 100644 --- a/connect-inject/container_sidecar_test.go +++ b/connect-inject/container_sidecar_test.go @@ -8,20 +8,20 @@ import ( func TestContainerSidecarCommand(t *testing.T) { cases := []struct { name string - extraEnvoyArgs string + extraEnvoyOpts string expectedContainerCommand []string }{ { - name: "no extra args provided", - extraEnvoyArgs: "", + name: "no extra options provided", + extraEnvoyOpts: "", expectedContainerCommand: []string{ "envoy", "--max-obj-name-len", "256", "--config-path", "/consul/connect-inject/envoy-bootstrap.yaml", }, }, { - name: "extra loglevel args", - extraEnvoyArgs: "--log-level debug", + name: "extra log-level option", + extraEnvoyOpts: "--log-level debug", expectedContainerCommand: []string{ "envoy", "--max-obj-name-len", "256", "--config-path", "/consul/connect-inject/envoy-bootstrap.yaml", @@ -29,8 +29,8 @@ func TestContainerSidecarCommand(t *testing.T) { }, }, { - name: "extraEnvoyArgs with quotes inside", - extraEnvoyArgs: "--log-level debug --admin-address-path \"/tmp/consul/foo bar\"", + name: "extraEnvoyOpts with quotes inside", + extraEnvoyOpts: "--log-level debug --admin-address-path \"/tmp/consul/foo bar\"", expectedContainerCommand: []string{ "envoy", "--max-obj-name-len", "256", "--config-path", "/consul/connect-inject/envoy-bootstrap.yaml", @@ -45,7 +45,7 @@ func TestContainerSidecarCommand(t *testing.T) { h := Handler{ ImageConsul: "hashicorp/consul:latest", ImageEnvoy: "hashicorp/consul-k8s:latest", - ExtraEnvoyArgs: tc.extraEnvoyArgs, + ExtraEnvoyOpts: tc.extraEnvoyOpts, } c, err := h.containerSidecar(nil) diff --git a/connect-inject/handler.go b/connect-inject/handler.go index 69cf8081b8..1bee694793 100644 --- a/connect-inject/handler.go +++ b/connect-inject/handler.go @@ -93,9 +93,9 @@ type Handler struct { ImageConsul string ImageEnvoy string - // Optional: set when you need extra args to be set when running envoy + // Optional: set when you need extra options to be set when running envoy // See a list of args here: https://www.envoyproxy.io/docs/envoy/latest/operations/cli - ExtraEnvoyArgs string + ExtraEnvoyOpts string // RequireAnnotation means that the annotation must be given to inject. // If this is false, injection is default. diff --git a/subcommand/inject-connect/command.go b/subcommand/inject-connect/command.go index efb7ac37d4..07c9c61d4a 100644 --- a/subcommand/inject-connect/command.go +++ b/subcommand/inject-connect/command.go @@ -114,7 +114,7 @@ func (c *Command) Run(args []string) int { injector := connectinject.Handler{ ImageConsul: c.flagConsulImage, ImageEnvoy: c.flagEnvoyImage, - ExtraEnvoyArgs: c.flagEnvoyExtraArgs, + ExtraEnvoyOpts: c.flagEnvoyExtraArgs, RequireAnnotation: !c.flagDefaultInject, AuthMethod: c.flagACLAuthMethod, WriteServiceDefaults: c.flagCentralConfig,