Skip to content

Commit

Permalink
Support passing extra arguments to injected envoy binary (hashicorp#675)
Browse files Browse the repository at this point in the history
When a user sets connectInject.envoyExtraArgs value, they can send
arguments to the injected envoy sidecar binary. For example, in a
development environment, we could consider enabling debug logs in all
sidecars.

Usage:
```
connectInject:
  enabled: true
  envoyExtraArgs: "--log-level debug --disable-hot-restart"
```
  • Loading branch information
ndhanushkodi authored Nov 9, 2020
1 parent 5f9f7c6 commit 88e5b73
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## Unreleased

IMPROVEMENTS:
* Connect: support passing extra arguments to the injected envoy sidecar. [[GH-675](https://github.com/hashicorp/consul-helm/pull/675)]

To pass extra arguments to envoy, set `connectInject.envoyExtraArgs` in your
Helm configuration:

```yaml
connectInject:
enabled: true
envoyExtraArgs: "--log-level debug --disable-hot-restart"
```
## 0.25.0 (Oct 12, 2020)
FEATURES:
Expand Down
3 changes: 3 additions & 0 deletions templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ spec:
-enable-health-checks-controller=true \
-health-checks-reconcile-period={{ .Values.connectInject.healthChecks.reconcilePeriod }} \
{{- end }}
{{- if .Values.connectInject.envoyExtraArgs }}
-envoy-extra-args="{{ .Values.connectInject.envoyExtraArgs }}" \
{{- end }}
{{- if .Values.connectInject.overrideAuthMethodName }}
-acl-auth-method="{{ .Values.connectInject.overrideAuthMethodName }}" \
{{- else if .Values.global.acls.manageSystemACLs }}
Expand Down
25 changes: 25 additions & 0 deletions test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,31 @@ load _helpers
}


#--------------------------------------------------------------------
# extra envoy args

@test "connectInject/Deployment: extra envoy args can be set via connectInject" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
--set 'connectInject.envoyExtraArgs=--foo bar --boo baz' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command | any(contains("-envoy-extra-args=\"--foo bar --boo baz\""))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "connectInject/Deployment: extra envoy args are not set by default" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command | any(contains("-envoy-extra-args"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
}


#--------------------------------------------------------------------
# cert secrets

Expand Down
5 changes: 5 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,11 @@ connectInject:
# at startup is completed.
reconcilePeriod: "1m"

# envoyExtraArgs is used to pass arguments to the injected envoy sidecar.
# Valid arguments to pass to envoy can be found here: https://www.envoyproxy.io/docs/envoy/latest/operations/cli
# e.g "--log-level debug --disable-hot-restart"
envoyExtraArgs: null

# Optional priorityClassName.
priorityClassName: ""

Expand Down

0 comments on commit 88e5b73

Please sign in to comment.