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

credentials: add compute engine creds #2708

Merged
merged 5 commits into from
Mar 25, 2019

Conversation

apolcyn
Copy link
Contributor

@apolcyn apolcyn commented Mar 22, 2019

This is the Go analogue of grpc/grpc-java#5475.

Manually tested that the interop test works in all environments.

@menghanl menghanl changed the title Add compute engine channel creds API to Go credentials: add compute engine channel creds Mar 22, 2019
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this!

// by this API represents the GCE VM's default service account.
//
// This API is experimental.
func NewComputeEngineChannelCredentials() credentials.Bundle {
Copy link
Member

Choose a reason for hiding this comment

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

s/Channel// please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

I am concerned that NewComputeEngineChannelCredentials will be confusingly similar to NewComputeEngineCredentials, but I'll leave this up to your call.

)

func main() {
flag.Parse()
var useGDC bool // use google default creds
var useGDC bool // use google default creds
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency, please either spell GDC out or abbreviate ComputeEngineChannelCreds in the next line :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Abbreviated useComputeEngineChannelCreds to useCEC

@@ -37,7 +37,8 @@ import (
)

const (
googleDefaultCredsName = "google_default_credentials"
googleDefaultCredsName = "google_default_credentials"
computeEngineChannelCredsName = "compute_engine_channel_creds"
Copy link
Member

Choose a reason for hiding this comment

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

I assume "channel" is used here for interop compatibility across languages. If that's the case, maybe still s/Channel// in the code.

It's a little unfortunate that this option doesn't match "google_default_credentials" (no "channel", and "creds" has been abbreviated), but 🤷‍♂️.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I made the s/Channel// change throughout the code, so that the only thing with "channel" in the name is the name of the test case and the custom_credentials_type option.

Personally I prefer to refer to this credentials type, across languages in general, as "compute engine channel credentials", at least in documentation and the test case name. Because "compute engine credentials" (without "channel") IMO is already taken as a name.

I agree that creds should probably be expanded out to credentials, though. That change will require changes outside of this PR though.

Copy link
Member

Choose a reason for hiding this comment

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

I agree that creds should probably be expanded out to credentials, though. That change will require changes outside of this PR though.

I don't really care, since it's just some flags in a binary we use internally.
It's just unfortunate that we ended up with "Google Default Creds" and "Compute Engine Channel Creds", when they're both essentially the same thing.

newPerRPCCreds: func() credentials.PerRPCCredentials {
return oauth.NewComputeEngine()
},
}
bundle, err := c.NewWithMode(internal.CredsBundleModeFallback)
if err != nil {
grpclog.Warningf("google default creds: failed to create new creds: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

This should be changed to "compute engine creds"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@menghanl menghanl merged commit 6d8271a into grpc:master Mar 25, 2019
@dfawley dfawley added the Type: Feature New features or improvements in behavior label Mar 28, 2019
@dfawley dfawley added this to the 1.20 Release milestone Mar 28, 2019
@dfawley dfawley changed the title credentials: add compute engine channel creds credentials: add compute engine creds Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants