Skip to content
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 listing blobs recursively in azure-blob scaler #2036

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

### Improvements

- TODO ([#XXX](https://github.com/kedacore/keda/pull/XXX))
- Support listing blobs recursively in azure-blob scaler ([#1789](https://github.com/kedacore/keda/issues/1789))

### Breaking Changes

Expand Down
10 changes: 6 additions & 4 deletions pkg/scalers/azure_blob_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"strconv"
"strings"

"github.com/kedacore/keda/v2/pkg/scalers/azure"

Expand Down Expand Up @@ -81,12 +82,13 @@ func parseAzureBlobMetadata(config *ScalerConfig) (*azureBlobMetadata, kedav1alp
return nil, "", fmt.Errorf("no blobContainerName given")
}

if val, ok := config.TriggerMetadata["blobDelimiter"]; ok && val != "" {
meta.blobDelimiter = val
}
meta.blobDelimiter = config.TriggerMetadata["blobDelimiter"]

if val, ok := config.TriggerMetadata["blobPrefix"]; ok && val != "" {
meta.blobPrefix = val + meta.blobDelimiter
meta.blobPrefix = val
if !strings.HasSuffix(meta.blobPrefix, defaultBlobDelimiter) {
meta.blobPrefix += defaultBlobPrefix
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as mentioned on the issue #1789

One complication: it seems that the scaler was appending blobDelimiter to blobPrefix, which isn't right. To avoid having a breaking change, I append the default blobDelimiter, i.e: /, to the blobPrefix if it's not there. But we might consider removing that in the future. It'll be a breaking change though, so we might only do it for v3?

}

endpointSuffix, err := azure.ParseAzureStorageEndpointSuffix(config.TriggerMetadata, azure.BlobEndpoint)
Expand Down