-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support JWT authentication for Metrics API scaler #1081
Comments
Hello, I'd like to work on this ticket |
@aman-bansal is this ticker still open? Don't we support JWT in #1137? |
No, #1137 supports basic, apikKey and tls. This hasn't been implemented yet. |
Thanks, I'll work on it! |
Which is the state of this? |
@JorTurFer that's great! I think that you can work on that, thanks :) |
I'm taking a look to this and I have some doubts :/ - type: metrics-api
metadata:
targetValue: "7"
url: "http://api:3232/components/stats"
valueLocation: 'components.worker.tasks'
authMode: "apiKey"
method: "header"
keyParamName: "Authorization"
-------
apiKey: "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJuYW1lIjoiVGVzdCIsInN1cm5hbWUiOiJVc2VyIiwibmJmIjoxNjI4NjI5OTM3LCJleHAiOjE2MjkyMzQ3MzcsImlhdCI6MTYyODYyOTkzN30.mDLtQdEhK6Zj1kStKSQ_6BoI2cvtnTUBQ44P6Ic4dBY" I have to try it tomorrow (today I have created the server authorized with jwt to test it) but I think that it will work without any change. Maybe it's more a solution that we can document than a problem which requires changes WDYT? Maybe am I missing anything? |
I have just tried and it works fine apiVersion: apps/v1
kind: Deployment
metadata:
name: sut-deployment
labels:
deploy: workload-sut
spec:
replicas: 0
selector:
matchLabels:
pod: workload-sut
template:
metadata:
labels:
pod: workload-sut
spec:
containers:
- name: nginx
image: 'nginx'
---
apiVersion: v1
kind: Secret
metadata:
name: keda-metric-api-secret
stringData:
apiKey: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyJ9.eyJhdWQiOiJmZTgzMTFkNS0xMTcwLTQwNDEtOWRlNy0wZjU0MzYwYWVhZTUiLCJpc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uGipUYVAwjeYWdFerx71oGWp4o8hWdaYK1cFmVxW-jEd1XN1gieizWCVvQd26zQy7cqr30KFWayMgqNV7rNxOXg7NECE92YzP2Q"
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-metric-api-creds
spec:
secretTargetRef:
- parameter: apiKey
name: keda-metric-api-secret
key: apiKey
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: sut-scaledobject
spec:
scaleTargetRef:
name: sut-deployment
minReplicaCount: 0
maxReplicaCount: 10
triggers:
- type: metrics-api
metadata:
targetValue: "7"
url: "https://jwt.fixedbuffer.com/WeatherForecast"
valueLocation: 'temperatureC'
authMode: "apiKey"
method: "header"
keyParamName: "Authorization"
authenticationRef:
name: keda-metric-api-creds I think that update the documentation to explain it explicitly could be enough Note: The Bearer was generated using a dummy user that I have created in my AAD for this test, so don't worry, I know that it's public but it hasn't got permissions for anything. Feel free to use the token if you want to try or get your own token using a Microsoft account in SwaggerUI |
Hmm, sorry for confusion. @aman-bansal could you please confirm? |
np :) |
This is more of a user-friendly thingy imo - JWT will always use I think a dedicated |
so it's a more cosmetic change that a real feature gap, right? |
Maybe can this ticket be closed? :P |
Use-Case
Support JWT authentication for Metrics API scaler.
Reference
#929
The text was updated successfully, but these errors were encountered: