Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent: add disable_keep_alives configurable #16479

Merged
merged 3 commits into from Jul 28, 2022
Merged

agent: add disable_keep_alives configurable #16479

merged 3 commits into from Jul 28, 2022

Conversation

jasonodonnell
Copy link
Contributor

@jasonodonnell jasonodonnell commented Jul 27, 2022

Follow up for #15986.

This PR adds a new configurable, disable_keep_alives, which takes a string list to disable keep alives for various features in Vault Agent (auto-auth, caching and templating).

A small example can be found here:

 "auto_auth" = {
  "method" = {
    "config" = {
      "role" = "app"
    }
    "type" = "kubernetes"
  }

  "sink" = {
    "config" = {
      "path" = "/home/vault/.token"
    }
    "type" = "file"
  }
}

"disable_idle_connections" = ["auto-auth", "caching", "templating"]
"disable_keep_alives" = ["auto-auth", "caching", "templating"]
"exit_after_auth" = false
"pid_file" = "/home/vault/.pid"

"template" = {
  "contents" = "{{ with secret \"secret/hashiconf\" }}{{ .Data | toJSONPretty }}{{ end }}"
  "destination" = "/vault/secrets/kv-secret"
  "error_on_missing_key" = true
}

"vault" = {
  "address" = "https://vault.vault.svc.cluster.local:8200"
}

api/client.go Outdated
Comment on lines 771 to 772
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be an RLock

@@ -507,10 +511,14 @@ func (c *AgentCommand) Run(args []string) int {
return 1
}

if config.DisableIdleConnsAutoAuth {
if config.DisableIdleConnsCaching {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change for proxyClient, but not for the other clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was actually a bug I found, this should have been checking cache/proxy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@swenson swenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; would be good to change that lock to an RLock though

Copy link
Member

@calvn calvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good aside from the locking comment that I left!

@swenson swenson merged commit 4bcc7e1 into main Jul 28, 2022
@swenson swenson deleted the disable-keep-alives branch July 28, 2022 19:59
swenson added a commit to hashicorp/vault-k8s that referenced this pull request Jul 28, 2022
Follow up for hashicorp/vault#16479, which
added support for `disable_keep_alives`

This is used very similarly to `disable_idle_connections`, which was
added in #366

This adds the `disable_keep_alives` setting into the injected agent's
config, which can be specified per pod:

```yaml
metadata:
  annotations:
    vault.hashicorp.com/agent-disable-keep-alives: "auto-auth,caching,templating"
```

globally in the injector through the helm command when deploying:

```sh
helm install vault hashicorp/vault \
  --set injector.extraEnvironmentVars.AGENT_INJECT_DISABLE_KEEP_ALIVES="auto-auth\,caching\,templating"
```

or through the helm `values.yaml` file:

```yaml
injector:
  extraEnvironmentVars:
    AGENT_INJECT_DISABLE_KEEP_ALIVES: "auto-auth,caching,templating"
```

This was copied almost verbatim from #366, so thanks @tvoran :)

Co-authored-by: Theron Voran <theron@hashicorp.com>
swenson added a commit to hashicorp/vault-k8s that referenced this pull request Jul 28, 2022
Support disable_keep_alives

Follow up for hashicorp/vault#16479, which
added support for `disable_keep_alives`

This is used very similarly to `disable_idle_connections`, which was
added in #366

This adds the `disable_keep_alives` setting into the injected agent's
config, which can be specified per pod:

```yaml
metadata:
  annotations:
    vault.hashicorp.com/agent-disable-keep-alives: "auto-auth,caching,templating"
```

globally in the injector through the helm command when deploying:

```sh
helm install vault hashicorp/vault \
  --set injector.extraEnvironmentVars.AGENT_INJECT_DISABLE_KEEP_ALIVES="auto-auth\,caching\,templating"
```

or through the helm `values.yaml` file:

```yaml
injector:
  extraEnvironmentVars:
    AGENT_INJECT_DISABLE_KEEP_ALIVES: "auto-auth,caching,templating"
```

This was copied almost verbatim from #366, so thanks @tvoran :)

Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants