Skip to content

Commit

Permalink
chore: add logs to aad-pod-identity
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Sep 1, 2022
1 parent 098a966 commit 05f29da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio

### Improvements

- TODO ([#XXX](https://github.com/kedacore/keda/issue/XXX))
- **General:** Improve error messages in aad-pod-identity integration ([#3610](https://github.com/kedacore/keda/issues/3610))

### Fixes

Expand Down
8 changes: 4 additions & 4 deletions pkg/scalers/azure/azure_aad_podidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ func GetAzureADPodIdentityToken(ctx context.Context, httpClient util.HTTPDoer, i

req, err := http.NewRequestWithContext(ctx, "GET", urlStr, nil)
if err != nil {
return token, err
return token, fmt.Errorf("error getting aad-pod-identity token - %w", err)
}
req.Header = map[string][]string{
"Metadata": {"true"},
}

resp, err := httpClient.Do(req)
if err != nil {
return token, err
return token, fmt.Errorf("error getting aad-pod-identity token - %w", err)
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if err != nil {
return token, err
return token, fmt.Errorf("error getting aad-pod-identity token - %w", err)
}

err = json.Unmarshal(body, &token)
if err != nil {
return token, errors.New(string(body))
return token, fmt.Errorf("error getting aad-pod-identity token - %w", errors.New(string(body)))
}

return token, nil
Expand Down

0 comments on commit 05f29da

Please sign in to comment.