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

Omit empty Template in configuration #167

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

lawliet89
Copy link
Contributor

@lawliet89 lawliet89 commented Aug 12, 2020

When using agent cache only without any secrets defined via template annotations, the configuration generated has null for the template key, leading to Vault agent crashing.

For example:

{
  "auto_auth": {
    "method": {
      "type": "kubernetes",
      "mount_path": "auth/kubernetes",
      "config": {
        "role": "app"
      }
    },
    "sink": [
      {
        "type": "file",
        "config": {
          "path": "/home/vault/.vault-token"
        }
      }
    ]
  },
  "exit_after_auth": false,
  "pid_file": "/home/vault/.pid",
  "vault": {
    "address": "https://vault.default.svc:8200",
    "ca_cert": "/vault/tls/ca.crt",
    "tls_server_name": "vault.default.svc.cluster.local"
  },
  "template": null,
  "listener": [
    {
      "type": "tcp",
      "address": "127.0.0.1:8200",
      "tls_disable": true
    }
  ],
  "cache": {
    "use_auto_auth_token": "true"
  }
}

This PR simply omits the template key if it's empty.

Copy link
Contributor

@jasonodonnell jasonodonnell left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jasonodonnell jasonodonnell merged commit 00432f7 into hashicorp:master Aug 12, 2020
RemcoBuddelmeijer pushed a commit to RemcoBuddelmeijer/vault-k8s that referenced this pull request Feb 22, 2022
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.

2 participants