Refactor openstack swift scaler#7232
Conversation
|
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:
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. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
dfc8e36 to
3aa2881
Compare
|
/run-e2e openstack_swift |
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the OpenStack Swift scaler to use KEDA's typed configuration framework, consolidating metadata parsing and validation logic while maintaining backward compatibility.
- Consolidated
openstackSwiftMetadataandopenstackSwiftAuthenticationMetadatainto a single struct with KEDA struct tags - Replaced manual parsing logic with the TypedConfig framework
- Moved authentication validation into a dedicated
Validate()method
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/scalers/openstack_swift_scaler.go | Refactored metadata structs to use KEDA tags; consolidated parsing functions; added validation method; simplified field access with PascalCase naming |
| pkg/scalers/openstack_swift_scaler_test.go | Updated tests to use the unified parsing function; removed redundant authentication metadata parsing |
| schema/generated/scalers-schema.yaml | Added OpenStack Swift scaler schema definition with all parameters |
| schema/generated/scalers-schema.json | Added OpenStack Swift scaler schema definition in JSON format |
Comments suppressed due to low confidence (1)
pkg/scalers/openstack_swift_scaler.go:108
- Potential nil pointer dereference. If neither
AppCredentialIDnorUserIDis set in the metadata (which passes validation),authOptswill remain nil and dereferencing it here will cause a panic. The validation method should ensure at least one authentication method is configured before reaching this point, but the code path allowsauthOptsto be nil.
provider, err := openstack.AuthenticatedClient(*authOpts)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
|
/run-e2e openstack_swift |
|
/run-e2e openstack_swift |
I think that yesterdays CF issues affected it, as the GH failed in the beginning |
* Refactor openstack swift scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Add new schemas for scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Fix from code review Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * fix alignment in openstack swift scaler Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> --------- Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com> Signed-off-by: Dmitriy Altuhov <altuhovd@gmail.com>
* Refactor openstack swift scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Add new schemas for scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Fix from code review Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * fix alignment in openstack swift scaler Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> --------- Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
* Refactor openstack swift scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Add new schemas for scaler Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * Fix from code review Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> * fix alignment in openstack swift scaler Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> --------- Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg> Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Checklist
Relates to #5797