Skip to content

Conversation

raviand
Copy link

@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 #

Copy link

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.

Copy link

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 <[email protected]>
Copy link
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?

@keda-automation keda-automation requested review from a team August 21, 2025 22:33
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
@raviand
Copy link
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
Author

raviand commented Aug 22, 2025

/run-e2e

@SpiritZhou
Copy link
Contributor

SpiritZhou commented Aug 22, 2025

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

Signed-off-by: Ramiro Andres Videla <[email protected]>
@keda-automation keda-automation requested a review from a team August 22, 2025 16:39
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
Signed-off-by: Ramiro Andres Videla <[email protected]>
@raviand
Copy link
Author

raviand commented Aug 22, 2025

/run-e2e hashicorp_vault

@JorTurFer
Copy link
Member

JorTurFer commented Aug 22, 2025

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

@JorTurFer
Copy link
Member

/run-e2e hashicorp_vault

Only KEDA colleagues can trigger e2e tests :P

@zroubalik
Copy link
Member

zroubalik commented Aug 26, 2025

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

Copy link
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

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.

4 participants