Skip to content

Commit de61ac2

Browse files
committed
WIP
1 parent 836af72 commit de61ac2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/storage/azure/azure.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ func NewDriver(ctx context.Context, c *imageregistryv1.ImageRegistryConfigStorag
334334
}
335335

336336
func (d *driver) newAzClient(cfg *Azure, environment autorestazure.Environment, tagset map[string]*string) (*azureclient.Client, error) {
337+
klog.V(2).Infof("Debug: Creating azureclient with shared cache pointer = %p", &d.azureCredentials)
337338
client, err := azureclient.New(&azureclient.Options{
338339
Environment: environment,
339340
TenantID: cfg.TenantID,

pkg/storage/azure/azureclient/azureclient.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ func (c *Client) getCreds(ctx context.Context) (azcore.TokenCredential, error) {
120120
var ok bool
121121
credCache := c.getCredentialCache()
122122

123+
// Debug: Log cache information
124+
klog.V(2).Infof("Debug: credCache pointer = %p, using external cache = %t", credCache, c.opts.CredentialCache != nil)
125+
123126
// We need to only store the Azure credentials once and reuse them after that.
124127
storedCreds, found := credCache.Load(azureCredentialsKey)
128+
klog.V(2).Infof("Debug: Cache lookup for key '%s': found = %t", azureCredentialsKey, found)
125129
if !found {
126130
klog.V(2).Info("Using UserAssignedIdentityCredentials for Azure authentication for managed Azure HCP")
127131
clientOptions := azcore.ClientOptions{
@@ -132,7 +136,9 @@ func (c *Client) getCreds(ctx context.Context) (azcore.TokenCredential, error) {
132136
return nil, err
133137
}
134138
credCache.Store(azureCredentialsKey, creds)
139+
klog.V(2).Infof("Debug: Stored credentials in cache with key '%s'", azureCredentialsKey)
135140
} else {
141+
klog.V(2).Info("Debug: Found existing credentials in cache, reusing them")
136142
creds, ok = storedCreds.(azcore.TokenCredential)
137143
if !ok {
138144
return nil, fmt.Errorf("expected %T to be a TokenCredential", storedCreds)

0 commit comments

Comments
 (0)