Skip to content

improve: hashicorp token management#6996

Closed
raviand wants to merge 15 commits intokedacore:mainfrom
raviand:issue/6026
Closed

improve: hashicorp token management#6996
raviand wants to merge 15 commits intokedacore:mainfrom
raviand:issue/6026

Conversation

@raviand
Copy link
Copy Markdown

@raviand raviand commented Aug 20, 2025

feat(hashicorp-vault): Support token from a secret

What's Changed
Added a new field, tokenSecretRef, to the HashiCorp Vault credentials configuration.

This new field allows users to specify a Kubernetes secret containing the Vault token.

The existing token string field will be used as a fallback if tokenSecretRef is not provided.

Why This Is Important
Previously, the HashiCorp Vault token had to be provided directly as a string in the KEDA configuration. This is not a recommended security practice for production environments, as it can expose sensitive information.

This change introduces a more secure way to manage the token by leveraging Kubernetes secrets. This aligns with best practices for handling credentials within a Kubernetes cluster.

How to Use It
Users can now configure their trigger with either the existing token field or the new tokenSecret field. For example:

apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: {trigger-authentication-mame}
  namespace: default
spec:
  hashiCorpVault:
    address: {hashicorp-vault-address}
    authentication: token
    credential:
      tokenSecretRef: 
        name: {secret-name}
        key: {secret-key}
        parameter: "key"
    secrets:
      - key: "ca_chain"
        parameter: "ca"
        path: {hashicorp-vault-secret-path}
        type: pki
        pki_data:
          common_name: {hashicorp-vault-secret-pkidata-commonName}

In the example above, secret-name and secret-key point to the secret containing the token.

Checklist

Issue 6026: Hashicorp vault auth allow tokens directly set in TriggerAuthentication

Fixes #

Helm chart PR change: kedacore/charts#774
Relates to #

@github-actions
Copy link
Copy Markdown

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@semgrep-app
Copy link
Copy Markdown

semgrep-app Bot commented Aug 20, 2025

Semgrep found 8 context-todo findings:

Consider to use well-defined context

Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Copy link
Copy Markdown
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

nice fix! Could we cover the new token source in the e2e test?

Comment thread CHANGELOG.md Outdated
Comment thread apis/keda/v1alpha1/triggerauthentication_types.go Outdated
Signed-off-by: Ramiro Videla <raviand86@gmail.com>
@keda-automation keda-automation requested review from a team August 21, 2025 22:33
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
@raviand
Copy link
Copy Markdown
Author

raviand commented Aug 22, 2025

nice fix! Could we cover the new token source in the e2e test?

Im trying to add the e2e test case, but maybe I'm pointing to the wrong direction. I'm having this error after creating a test case where I thought was the right place
pipeline failed
This is the change made

if Im not in the right place, pls gide me a bit here,

@raviand
Copy link
Copy Markdown
Author

raviand commented Aug 22, 2025

/run-e2e

@SpiritZhou
Copy link
Copy Markdown
Contributor

SpiritZhou commented Aug 22, 2025

/run-e2e hashicorp_vault
Update: You can check the progress here

Comment thread tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
@keda-automation keda-automation requested a review from a team August 22, 2025 16:39
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
Signed-off-by: Ramiro Andres Videla <raviand86@gmail.com>
@raviand
Copy link
Copy Markdown
Author

raviand commented Aug 22, 2025

/run-e2e hashicorp_vault

@JorTurFer
Copy link
Copy Markdown
Member

JorTurFer commented Aug 22, 2025

/run-e2e hashicorp_vault
Update: You can check the progress here

@JorTurFer
Copy link
Copy Markdown
Member

/run-e2e hashicorp_vault

Only KEDA colleagues can trigger e2e tests :P

@zroubalik
Copy link
Copy Markdown
Member

zroubalik commented Aug 26, 2025

/run-e2e hashicorp_vault
Update: You can check the progress here

Copy link
Copy Markdown
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

There's a conflict and also the e2e test fails

@rickbrouwer rickbrouwer added the merge-conflict This PR has a merge conflict label Oct 29, 2025
@stale
Copy link
Copy Markdown

stale Bot commented Dec 28, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale All issues that are marked as stale due to inactivity label Dec 28, 2025
@stale
Copy link
Copy Markdown

stale Bot commented Jan 5, 2026

This issue has been automatically closed due to inactivity.

@stale stale Bot closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict This PR has a merge conflict stale All issues that are marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants