Skip to content

Commit

Permalink
Change ExtraEnvoyArgs to ExtraEnvoyOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjqiu committed Dec 12, 2019
1 parent 5ed8aef commit 493d9df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions connect-inject/container_sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
16 changes: 8 additions & 8 deletions connect-inject/container_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ 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",
"--log-level", "debug",
},
},
{
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",
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions connect-inject/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion subcommand/inject-connect/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 493d9df

Please sign in to comment.