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 2, 2022
1 parent 90d19d2 commit 574cf11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
### Improvements

- **General:** Add explicit seccompProfile type to securityContext config ([#3561](https://github.com/kedacore/keda/issues/3561))
- **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 574cf11

Please sign in to comment.