Skip to content

fix: temporal scaler was not setting up tls for apikey auth#6781

Merged
wozniakjan merged 3 commits intokedacore:mainfrom
joaopaulosr95:fix/temporal-scaler-tls
May 16, 2025
Merged

fix: temporal scaler was not setting up tls for apikey auth#6781
wozniakjan merged 3 commits intokedacore:mainfrom
joaopaulosr95:fix/temporal-scaler-tls

Conversation

@joaopaulosr95
Copy link
Contributor

@joaopaulosr95 joaopaulosr95 commented May 15, 2025

After seeing connection reset by peer errors in my Temporal KEDA scaler, I started digging and found out about #6724, which was released earlier today. I deployed the new v2.17.1 Helm chart to my K8S cluster and still kept seeing the same errors, then decided to dig into the scaler code to see what I could find.

@rickbrouwer and I connected to explore options, and we realized that the TLS settings from #6707 were being overwritten, thus causing the error previously mentioned. This change fixed the main issue for good by rearranging the *tls.config variable, and it is already validated against a production K8S cluster.

Checklist

Fixes #

Relates to #

@joaopaulosr95 joaopaulosr95 requested a review from a team as a code owner May 15, 2025 18:40
@joaopaulosr95 joaopaulosr95 force-pushed the fix/temporal-scaler-tls branch from d7c626b to 32f7687 Compare May 15, 2025 18:45
Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
@joaopaulosr95 joaopaulosr95 force-pushed the fix/temporal-scaler-tls branch from 32f7687 to 9890a6d Compare May 15, 2025 18:52
@joaopaulosr95
Copy link
Contributor Author

cc @wozniakjan if we can get it into #6724 it would be great.

@JorTurFer
Copy link
Member

JorTurFer commented May 15, 2025

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

@JorTurFer JorTurFer enabled auto-merge (squash) May 15, 2025 20:05
@joaopaulosr95 joaopaulosr95 mentioned this pull request May 15, 2025
18 tasks
@wozniakjan
Copy link
Member

cc @wozniakjan if we can get it into #6724 it would be great.

unfortunately 2.17.1 is now already released, we will see if there is enough to release 2.17.2 or if this will have to wait for 2.18.0

@wozniakjan wozniakjan requested a review from Copilot May 16, 2025 08:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures TLS is correctly configured for API Key authentication in the Temporal scaler by deferring and centralizing the client’s ConnectionOptions assignment after both API Key and certificate branches.

  • Introduce tlsConfig variable and set default TLS for API Key auth
  • Override tlsConfig when user-provided cert/key are present
  • Move options.ConnectionOptions assignment to the end to prevent overwriting TLS settings
  • Update CHANGELOG with a note on the secondary fix

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/scalers/temporal.go Refactored TLS setup logic to preserve TLS config across branches and centralized ConnectionOptions assignment
CHANGELOG.md Added entry for the secondary Temporal Scaler fix
Comments suppressed due to low confidence (1)

pkg/scalers/temporal.go:216

  • [nitpick] The interceptor function signature is split across lines and repeats parameter types on separate lines. Consider merging req and reply parameters and formatting the entire signature on one line for improved readability and consistency.
func(ctx context.Context, method string, req any, reply any,

Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
auto-merge was automatically disabled May 16, 2025 09:27

Head branch was pushed to by a user without write access

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
@wozniakjan
Copy link
Member

wozniakjan commented May 16, 2025

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

@wozniakjan wozniakjan enabled auto-merge (squash) May 16, 2025 09:38
@wozniakjan wozniakjan merged commit 267a58a into kedacore:main May 16, 2025
19 checks passed
@naikaayushnz
Copy link

Will this be a part of v2.17.2 release?

@macb
Copy link

macb commented May 21, 2025

Also ended up here with the same issue. Would appreciate this in a v2.17.2 but using main is a workaround in the meantime.

@joaopaulosr95 joaopaulosr95 deleted the fix/temporal-scaler-tls branch May 21, 2025 12:32
@wozniakjan wozniakjan mentioned this pull request Jun 3, 2025
12 tasks
wozniakjan added a commit to wozniakjan/keda that referenced this pull request Jun 17, 2025
…#6781)

* fix: temporal scaler was not setting up tls for apikey auth

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>

---------

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
wozniakjan added a commit to wozniakjan/keda that referenced this pull request Jun 17, 2025
…#6781)

* fix: temporal scaler was not setting up tls for apikey auth

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>

---------

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
wozniakjan added a commit that referenced this pull request Jun 18, 2025
* feat: grpc mTLS certificates are hot reloaded (#6756)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>

* fix: temporal scaler was not setting up tls for apikey auth (#6781)

* fix: temporal scaler was not setting up tls for apikey auth

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>

---------

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>

* chore: changelog and issue template v2.17.2

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>

---------

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: João Bastos <joaopaulosr95@gmail.com>
@cheelim1
Copy link

has it been fixed in v2.17.2 ?
i'm still facing the error in 2.17.2 when trying to setup keda with temporal cloud

"error": "failed to create Temporal client connection: failed reaching server: connection error: desc = \"error reading server preface: remote error: tls: certificate required\""}

am i missing something?

@rickbrouwer
Copy link
Member

has it been fixed in v2.17.2 ? i'm still facing the error in 2.17.2 when trying to setup keda with temporal cloud

"error": "failed to create Temporal client connection: failed reaching server: connection error: desc = \"error reading server preface: remote error: tls: certificate required\""}

am i missing something?

Yes, that should be fixed in 2.17.2. The message you show is also a bit different from the original issue. Could you share your scaledObject? Maybe it would be good to create a separate issue for that and share it there.

dpochopsky pushed a commit to dpochopsky/keda that referenced this pull request Sep 12, 2025
…#6781)

* fix: temporal scaler was not setting up tls for apikey auth

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>

---------

Signed-off-by: joaopaulosr95 <joaopaulosr95@gmail.com>
Signed-off-by: João Bastos <joaopaulosr95@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: David Pochopsky <david.pochopsky@united.com>
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.

8 participants