Skip to content

feat(mssql): add driverName support for azuresql driver#7567

Open
akarki2005 wants to merge 8 commits intokedacore:mainfrom
akarki2005:feature/mssql-scaler-driver-name-param
Open

feat(mssql): add driverName support for azuresql driver#7567
akarki2005 wants to merge 8 commits intokedacore:mainfrom
akarki2005:feature/mssql-scaler-driver-name-param

Conversation

@akarki2005
Copy link
Copy Markdown

@akarki2005 akarki2005 commented Mar 21, 2026

This PR adds optional driverName support to the MSSQL scaler, allowing users to use the azuresql driver for Azure AD–based authentication.

If not specified, it defaults to sqlserver, so existing configurations remain unchanged.

Checklist

  • I have verified that my change is according to the deprecations & breaking changes policy
  • Tests have been added (if applicable)
  • Ensure make generate-scalers-schema has been run to update any outdated generated files
  • Changelog has been updated and is aligned with our changelog requirements, only when the change impacts end users
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Commits are signed with Developer Certificate of Origin (DCO - learn more)

Fixes #7412
Related Docs: kedacore/keda-docs#1722

@github-actions
Copy link
Copy Markdown

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.

@keda-automation keda-automation requested review from a team March 21, 2026 01:15
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Mar 21, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@akarki2005 akarki2005 force-pushed the feature/mssql-scaler-driver-name-param branch 2 times, most recently from e8a507f to 5d73b28 Compare March 21, 2026 01:50
Signed-off-by: Aayush Karki <akarki2005@gmail.com>
Comment thread pkg/scalers/mssql_scaler.go Outdated
Signed-off-by: Aayush Karki <akarki2005@gmail.com>
@keda-automation keda-automation requested a review from a team March 23, 2026 11:27
@rickbrouwer
Copy link
Copy Markdown
Member

rickbrouwer commented Mar 23, 2026

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

@akarki2005 akarki2005 requested a review from rickbrouwer March 23, 2026 16:23
Copy link
Copy Markdown
Contributor

@dttung2905 dttung2905 left a comment

Choose a reason for hiding this comment

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

lgtm . Thanks @akarki2005 for the contribution. Can we make some changes to the integration test too ? https://github.com/kedacore/keda/blob/main/tests/scalers/mssql/mssql_test.go

Signed-off-by: Aayush Karki <akarki2005@gmail.com>
@keda-automation keda-automation requested a review from a team March 25, 2026 16:59
@akarki2005 akarki2005 requested a review from dttung2905 March 25, 2026 17:29
Signed-off-by: Aayush Karki <akarki2005@gmail.com>
Signed-off-by: Aayush Karki <akarki2005@gmail.com>
Comment thread tests/scalers/mssql/mssql_standalone/mssql_test.go
@akarki2005
Copy link
Copy Markdown
Author

akarki2005 commented Mar 26, 2026

Hi, I've parameterized the integration tests by driver so sqlserver and azuresql are both covered by the same test flow with isolated per-case data. Happy to adjust the structure if there's another preferred pattern.

@rickbrouwer
Copy link
Copy Markdown
Member

rickbrouwer commented Mar 26, 2026

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

Signed-off-by: Aayush Karki <akarki2005@gmail.com>
@akarki2005
Copy link
Copy Markdown
Author

akarki2005 commented Mar 26, 2026

Hi @rickbrouwer, I've pushed a patch for the test teardown issue causing the previous e2e failure (the logs showed a duplicated cleanup of the test namespace). It should be ready for another run whenever convenient.

@rickbrouwer
Copy link
Copy Markdown
Member

rickbrouwer commented Mar 27, 2026

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

@akarki2005
Copy link
Copy Markdown
Author

Hi @rickbrouwer - just following up on this PR. I’ve addressed the earlier feedback (including enum validation and the integration tests), and the latest e2e run is passing.

I noticed the previous change request is now marked as outdated, but the PR is still blocked by that review. Could you take another look when you have a chance? Happy to make any additional changes if needed.

@rickbrouwer
Copy link
Copy Markdown
Member

which PR do you mean that is outdated?

@akarki2005
Copy link
Copy Markdown
Author

akarki2005 commented Mar 30, 2026

Hi @rickbrouwer, sorry for the confusion - I meant to say the earlier review comments on this PR are now resolved.

I was hoping for another review on this PR to check if everything looks good or if there's anything else I should address. Thanks!

@rickbrouwer
Copy link
Copy Markdown
Member

I will review your PR soon. Sometimes that takes a bit longer due to other work and other reviews. The maintainers and reviewers will see that all checks are green and will surely do a review soon as well.

Copy link
Copy Markdown
Member

@rickbrouwer rickbrouwer left a comment

Choose a reason for hiding this comment

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

The unit tests are incorrect regarding expectedConnectionString. However, the test passed. I suspect there is an error somewhere in the test causing the check to be incorrect. Can you check that?

Comment thread pkg/scalers/mssql_scaler_test.go Outdated
Comment thread pkg/scalers/mssql_scaler_test.go Outdated
Comment thread pkg/scalers/mssql_scaler_test.go Outdated
@rickbrouwer
Copy link
Copy Markdown
Member

@dttung2905 asked for an E2E test. The drivers are currently being tested in the E2E, so that is great. However, I think it would be valuable if we specifically included Azure AD Auth (managed identity, workload identity, etc.) in the E2E test via the Azure SQL driver.

@dttung2905
Copy link
Copy Markdown
Contributor

I totally agree with @rickbrouwer on this

Signed-off-by: Aayush Karki <akarki2005@gmail.com>
@keda-automation keda-automation requested a review from a team April 6, 2026 04:33
Comment thread tests/scalers/mssql/mssql_standalone/mssql_test.go
@akarki2005
Copy link
Copy Markdown
Author

akarki2005 commented Apr 6, 2026

Hi, thanks so much for the detailed feedback and suggestions - I've made some changes to fix the identified gaps.

  1. I've fixed the incorrect expectedConnectionString values, and have updated the test logic itself to now explicitly validate the connection string.
  2. Regarding Azure AD auth, I added an e2e test for Azure SQL using the azuresql driver with workload identity. The test mirrors existing structure in tests/scalers/postgressql/azure_postgressql_flex_server_aad_wi_test.go.

Happy to make additional adjustments to the test structure or coverage if needed.

@akarki2005 akarki2005 force-pushed the feature/mssql-scaler-driver-name-param branch from b1f4084 to 90ce961 Compare April 6, 2026 17:34
Comment on lines +54 to +58
spec:
secretTargetRef:
- parameter: password
name: {{.SecretName}}
key: mssql-sa-password
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
spec:
secretTargetRef:
- parameter: password
name: {{.SecretName}}
key: mssql-sa-password
spec:
secretTargetRef:
- parameter: password
name: {{.SecretName}}
key: mssql-sa-password

"replica count should be %d after 3 minutes", data.MaxReplicaCount)
}

func testScaleIn(t *testing.T, kc *kubernetes.Clientset, data templateData) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm taking a quick look at how this is going to work. I see an activation of 10 and another 10 in the scaleout. But shouldn't those rows be cleared to ScaleIn?

}

type mssqlMetadata struct {
DriverName string `keda:"name=driverName, order=authParams;triggerMetadata, enum=sqlserver;azuresql, default=sqlserver"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are some tabs and spaces between driverName and the order. Can you make them spaces only?

@rickbrouwer rickbrouwer added waiting-author-response All PR's or Issues where we are waiting for a response from the author merge-conflict This PR has a merge conflict labels Apr 9, 2026
@rickbrouwer
Copy link
Copy Markdown
Member

Any status @akarki2005 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict This PR has a merge conflict waiting-author-response All PR's or Issues where we are waiting for a response from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSSQL scaler supports all Azure Active Directory authentication methods provided by driver

3 participants