From a5faf6512f4c19aad7c87c53e5bcca10bbb1a595 Mon Sep 17 00:00:00 2001 From: Dustin Decker Date: Mon, 20 Apr 2020 08:07:26 -0700 Subject: [PATCH] Make identities less unique to improve performance Signed-off-by: Dustin Decker --- plugin/path_login.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin/path_login.go b/plugin/path_login.go index 35a2d01e..063b5546 100644 --- a/plugin/path_login.go +++ b/plugin/path_login.go @@ -453,7 +453,7 @@ func (b *GcpAuthBackend) pathGceLogin(ctx context.Context, req *logical.Request, return &logical.Response{ Auth: &logical.Auth{ Alias: &logical.Alias{ - Name: fmt.Sprintf("gce-%s", strconv.FormatUint(instance.Id, 10)), + Name: loginInfo.EmailOrId, }, }, }, nil @@ -475,7 +475,7 @@ func (b *GcpAuthBackend) pathGceLogin(ctx context.Context, req *logical.Request, auth := &logical.Auth{ InternalData: map[string]interface{}{}, Alias: &logical.Alias{ - Name: fmt.Sprintf("gce-%s", strconv.FormatUint(instance.Id, 10)), + Name: serviceAccount.UniqueId, }, Metadata: authMetadata(loginInfo, serviceAccount), DisplayName: instance.Name, @@ -546,9 +546,6 @@ func authMetadata(loginInfo *gcpLoginInfo, serviceAccount *iam.ServiceAccount) m metadata["project_id"] = gceMetadata.ProjectId metadata["project_number"] = strconv.FormatInt(gceMetadata.ProjectNumber, 10) metadata["zone"] = gceMetadata.Zone - metadata["instance_id"] = gceMetadata.InstanceId - metadata["instance_name"] = gceMetadata.InstanceName - metadata["instance_creation_timestamp"] = strconv.FormatInt(gceMetadata.CreatedAt, 10) } return metadata }