Skip to content

Conversation

mmcgarr
Copy link

@mmcgarr mmcgarr commented Jul 15, 2025

The AGENT_INJECT_TEMPLATE_LEASE_RENEWAL_THRESHOLD environment variable on agent-injector pods is not being properly applied to the generated Vault agent configuration on mutated pods.

Expected Behavior: When AGENT_INJECT_TEMPLATE_LEASE_RENEWAL_THRESHOLD is set, the lease_renewal_threshold field should be included in the template_config section of the injected Vault agent configuration.

Current Behavior: The environment variable is ignored, and lease_renewal_threshold is missing from the generated configuration.

{
  "auto_auth": {
    "method": {
      "type": "kubernetes",
      "mount_path": "auth/kubernetes/cluster-01",
      "config": {
        "role": "test_vault-test_vault",
        "token_path": "/var/run/secrets/kubernetes.io/serviceaccount/token"
      }
    },
    "sink": [
      {
        "type": "file",
        "config": {
          "path": "/home/vault/.vault-token"
        }
      }
    ]
  },
  "exit_after_auth": false,
  "pid_file": "/home/vault/.pid",
  "vault": {
    "address": "<redacted>"
  },
  "template": [
    {
      "destination": "/config/mycreds",
      "contents": "{{ with secret \"db/test/creds/readonly\" }}{{ range $k, $v := .Data }}{{ $k }}: {{ $v }}\n{{ end }}{{ end }}",
      "left_delimiter": "{{",
      "right_delimiter": "}}"
    }
  ],
  "template_config": {
    "exit_on_retry_failure": true
  }
}

Expected config:

{
  "auto_auth": {
    "method": {
      "type": "kubernetes",
      "mount_path": "auth/kubernetes/cluster-01",
      "config": {
        "role": "test_vault-test_vault",
        "token_path": "/var/run/secrets/kubernetes.io/serviceaccount/token"
      }
    },
    "sink": [
      {
        "type": "file",
        "config": {
          "path": "/home/vault/.vault-token"
        }
      }
    ]
  },
  "exit_after_auth": false,
  "pid_file": "/home/vault/.pid",
  "vault": {
    "address": "<redacted>"
  },
  "template": [
    {
      "destination": "/config/mycreds",
      "contents": "{{ with secret \"db/test/creds/readonly\" }}{{ range $k, $v := .Data }}{{ $k }}: {{ $v }}\n{{ end }}{{ end }}",
      "left_delimiter": "{{",
      "right_delimiter": "}}"
    }
  ],
  "template_config": {
    "exit_on_retry_failure": true,
    "lease_renewal_threshold": 0.08
  }
}

@mmcgarr mmcgarr requested a review from a team as a code owner July 15, 2025 16:55
Copy link

hashicorp-cla-app bot commented Jul 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@mmcgarr
Copy link
Author

mmcgarr commented Aug 8, 2025

Any chance of a review on this? We'd love to get this in if we can 🙏

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.

1 participant