Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retry connections to gce metadata server #284

Merged
merged 4 commits into from
Feb 16, 2018
Merged

fix: retry connections to gce metadata server #284

merged 4 commits into from
Feb 16, 2018

Conversation

JustinBeckwith
Copy link
Contributor

@JustinBeckwith JustinBeckwith requested review from ofrobots and a team February 14, 2018 06:04
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 14, 2018
@codecov-io
Copy link

codecov-io commented Feb 14, 2018

Codecov Report

Merging #284 into master will increase coverage by 0.03%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   91.67%   91.71%   +0.03%     
==========================================
  Files          13       13              
  Lines         829      833       +4     
  Branches      178      179       +1     
==========================================
+ Hits          760      764       +4     
  Misses         69       69
Impacted Files Coverage Δ
src/auth/computeclient.ts 95.45% <88.88%> (+0.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78d6813...00a93c3. Read the comment docs.

@@ -24,7 +24,8 @@
"gtoken": "^2.1.0",
"jws": "^3.1.4",
"lodash.isstring": "^4.0.1",
"lru-cache": "^4.1.1"
"lru-cache": "^4.1.1",
"retry-axios": "^0.3.0"

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -68,8 +74,11 @@ export class Compute extends OAuth2Client {
try {
// TODO: In 2.0, we should remove the ability to configure the tokenUrl,
// and switch this over to use the gcp-metadata package instead.
res = await this.transporter.request<CredentialRequest>(

This comment was marked as spam.

This comment was marked as spam.

res = await ax.request<CredentialRequest>({
url,
headers: {'Metadata-Flavor': 'Google'},
raxConfig: {noResponseRetries: 8, retry: 8, instance: ax}

This comment was marked as spam.

This comment was marked as spam.

res = await ax.request<CredentialRequest>({
url,
headers: {'Metadata-Flavor': 'Google'},
raxConfig: {noResponseRetries: 3, retry: 3, instance: ax}

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

{url, headers: {'Metadata-Flavor': 'Google'}});
res = await ax.request<CredentialRequest>({
url,
headers: {'Metadata-Flavor': 'Google'},

This comment was marked as spam.

This comment was marked as spam.

nock(HOST_ADDRESS).get(tokenPath).reply(200, {
access_token: 'abc123',
expires_in: 10000
})

This comment was marked as spam.

This comment was marked as spam.

nock(HOST_ADDRESS).get(tokenPath).times(2).reply(500),
nock(HOST_ADDRESS).get(tokenPath).reply(200, {
access_token: 'abc123',
expires_in: 10000

This comment was marked as spam.

This comment was marked as spam.

@JustinBeckwith
Copy link
Contributor Author

@ofrobots @jonparrott Does this look good?

{url, headers: {'Metadata-Flavor': 'Google'}});
res = await ax.request<CredentialRequest>({
url,
headers: {[gcpMetadata.HEADER_NAME]: 'Google'},

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once question addressed adequately.

Copy link
Contributor

@theacodes theacodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually looks fine to me.

@JustinBeckwith JustinBeckwith merged commit 7a951e0 into googleapis:master Feb 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants