kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.29k stars 1.05k forks source link

TriggerAuthentication : AWS Secret Manager should allow to pass "Secret key" as one of the parameter under secrets #5940

Open Tejasvihuded opened 2 months ago

Tejasvihuded commented 2 months ago

Report

There is no way I can pass "Secret key" under "awsSecretManager.secrets" section. When we actually create secret in AWS secret Manager it will have "Secret name" under which we will have "Key/Value" pairs. For Example:

"Secret name" can be "keda-int" under which we will have "Key/Value" pairs ,something like.

Secret key | Secret value

userName | dummyuser password | dummypass

For for above if I want to create "TriggerAuthentication",I want new parameter to pass {aws-secret-key},else there is no way we can say which Secret Key to use for each parameter

apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: sample
spec:
    podIdentity:             
      provider: aws               
    region: us-east-2                                                 
    secrets:                                                              
    - parameter: userName
      name: keda-int
      *key: {aws-secret-key}*
    - parameter: password
      name: keda-int   
      *key: {aws-secret-key}*

Expected Behavior

Need new "key" parameter under secrets section

Actual Behavior

There is no way we can pass "Secret Key" today under "Secret Name"

Steps to Reproduce the Problem

NA

Logs from KEDA operator

NA

KEDA Version

2.13.0

Kubernetes Version

1.28

Platform

Amazon Web Services

Scaler Details

postgresql

Anything else?

No response

nrichardson-akasa commented 1 month ago

This would be very helpful for me as well. We store username, password, and host in the AWS secret. Being able to pull all of them from one secret as opposed to having to create multiple secrets for each parameter would be great!

JorTurFer commented 1 month ago

Is it possible to have multiple secrets within the same AWS secret? It's an interesting feature tbh, are you willing to contribute with it?

nrichardson-akasa commented 1 month ago

@JorTurFer I've opened a preliminary PR with the changes I think are needed. I am not a Go developer, so I may be missing something. Also, I have not added any tests as the existing test did not seem to attempt to pull a secret. Open to comments/concerns! https://github.com/kedacore/keda/pull/6031

JorTurFer commented 1 month ago

The PR is quite good. You can't test that part with unit tests as it depends on the AWS package but you can include an e2e test for it. You could extend the current e2e tests to cover this new feature. There are currently 2 e2e tests covering this service:

They do exactly the same, one using credentials and the other one using podIdentity. I think that just extending one of them could be enough (but if you are willing, updating both will keep them aligned xD)

nrichardson-akasa commented 1 month ago

Sounds good! I'll update my PR on Monday to include some tests then.

nrichardson-akasa commented 1 month ago

@JorTurFer I've went ahead and added 2 E2E tests (one for each file). Can you kick off the E2E tests? Once confirmed working, I will make a separate PR for the documentation changes