-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Report
It seems whenever using a secretRef with Prometheus CustomAuth auth type, a new line is either added or not removed from the actual values.
Expected Behavior
Using the below manifests, Keda should be able to retrieve metrics from Prometheus:
apiVersion: v1
items:
- apiVersion: keda.sh/v1alpha1
kind: ClusterTriggerAuthentication
metadata:
finalizers:
- finalizer.keda.sh
name: keda-prom-creds
spec:
secretTargetRef:
- key: PRIVATE_KEY
name: secret-keys
parameter: customAuthValue
- key: authToken
name: secret-keys
parameter: customAuthHeader
kind: List
where value is:
authToken: dG9rZW4K (== "token")
Actual Behavior
Keda operator fails with error: net/http: invalid header field name \"token\\n\"
2023-09-07T06:33:13Z ERROR scale_handler error getting metric for scaler {"scaledObject.Namespace": "hpa-tenant", "scaledObject.Name": "prometheus-so-test-metric", "scaler": "prometheusScaler", "error": "Get \"https://prom-server.com/api/v1/query?query=sum%28rate%28container_cpu_usage_seconds_total%7Bnamespace%3D~%22.%2Ahpa-tenant.%2A%22%2Ccontainer%3D%22dal%22%7D%5B5m%5D%29+%2F+%28kube_pod_container_resource_limits%7Bnamespace%3D~%22.%2Ahpa-tenant.%2A%22%2Ccontainer%3D%22dal%22%2Cresource%3D%22cpu%22%7D%29%29+by+%28container%2C+namespace%29+%2A+100&time=2023-09-07T06:33:13Z\": net/http: invalid header field name \"token\\n\""}
Steps to Reproduce the Problem
- Create a secret (in this example was created with ExternalSecrets)
- Reference the secret in TriggerAuthentication
Logs from KEDA operator
2023-09-07T06:33:13Z ERROR scale_handler error getting metric for scaler {"scaledObject.Namespace": "hpa-tenant", "scaledObject.Name": "prometheus-so-test-metric", "scaler": "prometheusScaler", "error": "Get \"https://prom-server.com/api/v1/query?query=sum%28rate%28container_cpu_usage_seconds_total%7Bnamespace%3D~%22.%2Ahpa-tenant.%2A%22%2Ccontainer%3D%22dal%22%7D%5B5m%5D%29+%2F+%28kube_pod_container_resource_limits%7Bnamespace%3D~%22.%2Ahpa-tenant.%2A%22%2Ccontainer%3D%22dal%22%2Cresource%3D%22cpu%22%7D%29%29+by+%28container%2C+namespace%29+%2A+100&time=2023-09-07T06:33:13Z\": net/http: invalid header field name \"token\\n\""}
KEDA Version
2.11.1
Kubernetes Version
1.27
Platform
Amazon Web Services
Scaler Details
Prometheus
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Ready To Ship