Skip to content

Commit

Permalink
chore: improve aad-pod-identity errors (#3640)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Kerkhove <[email protected]>
  • Loading branch information
JorTurFer and tomkerkhove authored Sep 2, 2022
1 parent 82d506e commit 4e72030
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))
- **Azure AD Pod Identity Authentication:** Improve error messages to emphasize problems around the integration with aad-pod-identity itself ([#3610](https://github.com/kedacore/keda/issues/3610))
- **Prometheus Scaler:** Introduce skipping of certificate check for unsigned certs ([#2310](https://github.com/kedacore/keda/issues/2310))

### 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 4e72030

Please sign in to comment.