Fix auth package to handle fetching token on GCE#84
Merged
Conversation
5 tasks
Collaborator
|
LGTM! Thanks for investigating this! 🚀 |
deadlycoconuts
approved these changes
Apr 19, 2023
shydefoo
added a commit
to caraml-dev/merlin
that referenced
this pull request
Apr 20, 2023
<!-- Thanks for sending a pull request! Here are some tips for you: 1. Run unit tests and ensure that they are passing 2. If your change introduces any API changes, make sure to update the e2e tests 3. Make sure documentation is updated for your PR! --> **What this PR does / why we need it**: * ~~Needs #378 to be merged. Currently changed to use `caraml-dev/mlp` so the MR can be tested with WI. This will be reverted once #378 is merged.~~ * Updates all references to `github.com/gojek/mlp` to `github.com/caraml-dev/mlp` in `api`. This was done to use the new version of mlp, else `go get github.com/caraml-dev/mlp@<new_version>` throws an error. * Use mlp version @2eaf397 (currently pointing to [MR](caraml-dev/mlp#84)) * This new version allows merlin to communicate with mlp api without specifying `GOOGLE_APPLICATION_CREDENTIALS` env var. **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Fixes # **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required. Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". For more information about release notes, see kubernetes' guide here: http://git.k8s.io/community/contributors/guide/release-notes.md --> ```release-note ``` **Checklist** - [ ] Added unit test, integration, and/or e2e tests - [ ] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduce API changes
This was referenced May 17, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR checks if the
Credsobject created has an empty JSON byte slice before attempting to unmarshal the byte slice to construct a http client.The use case is to handle cases when the default credentials are not obtained from
GOOGLE_APPLICATION_CREDENTIALS, but other sources like the GCE Metadata server. See here for complete explanation.Without this check, the error
panic: unexpected end of JSON inputwill be thrown.