Skip to content

Commit e075db9

Browse files
committed
allow more complex blob names (allow subfolders)
Signed-off-by: Markus Blaschke <[email protected]>
1 parent 3af117a commit e075db9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

prometheus/collector/cache.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ import (
1616
"time"
1717

1818
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
19-
"github.com/webdevops/go-common/azuresdk/armclient"
20-
"github.com/webdevops/go-common/utils/to"
2119
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2220
corev1apply "k8s.io/client-go/applyconfigurations/core/v1"
2321
"k8s.io/client-go/kubernetes"
2422
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
2523
"k8s.io/client-go/rest"
24+
25+
"github.com/webdevops/go-common/azuresdk/armclient"
26+
"github.com/webdevops/go-common/utils/to"
2627
)
2728

2829
type (
@@ -107,13 +108,13 @@ func (c *Collector) SetCache(cache *string, cacheTag *string) {
107108
}
108109

109110
storageAccount := fmt.Sprintf(`https://%v/`, c.cache.url.Hostname())
110-
pathParts := strings.SplitN(c.cache.url.Path, "/", 2)
111+
pathParts := strings.Split(c.cache.url.Path, "/")
111112
if len(pathParts) < 2 {
112113
c.logger.Fatalf(`azblob path needs to be specified as azblob://storageaccount.blob.core.windows.net/container/blob, got: %v`, rawSpec)
113114
}
114115

115116
c.cache.spec["azblob:container"] = pathParts[0]
116-
c.cache.spec["azblob:blob"] = pathParts[1]
117+
c.cache.spec["azblob:blob"] = strings.Join(pathParts[1:], "/")
117118

118119
// create a client for the specified storage account
119120
azblobOpts := azblob.ClientOptions{ClientOptions: *azureClient.NewAzCoreClientOptions()}

0 commit comments

Comments
 (0)