Skip to content

Commit

Permalink
Expose flyteadmin client's auth opt (#252)
Browse files Browse the repository at this point in the history
* Expose flyteadmin client's auth opt
Signed-off-by: Sean Lin <[email protected]>

* Move authOpt to global
Signed-off-by: Sean Lin <[email protected]>

* minor fix
Signed-off-by: Sean Lin <[email protected]>
  • Loading branch information
mayitbeegh authored Jan 29, 2022
1 parent 4d9fdff commit 6313749
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions flyteidl/clients/go/admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
var (
once = sync.Once{}
adminConnection *grpc.ClientConn
authOpt *grpc.DialOption

// A new connection just for auth metadata service since it will be used to retrieve auth
// related information that's needed to initialize the Clientset.
Expand All @@ -41,6 +42,11 @@ type Clientset struct {
authMetadataServiceClient service.AuthMetadataServiceClient
healthServiceClient grpc_health_v1.HealthClient
identityServiceClient service.IdentityServiceClient
authOpt grpc.DialOption
}

func (c Clientset) AuthOpt() grpc.DialOption {
return c.authOpt
}

// AdminClient retrieves the AdminServiceClient
Expand Down Expand Up @@ -195,6 +201,7 @@ func initializeClients(ctx context.Context, cfg *Config, tokenCache pkce.TokenCa

if opt != nil {
opts = append(opts, opt)
authOpt = &opt
}

adminConnection, err = NewAdminConnection(ctx, cfg, opts...)
Expand All @@ -208,6 +215,9 @@ func initializeClients(ctx context.Context, cfg *Config, tokenCache pkce.TokenCa
cs.authMetadataServiceClient = service.NewAuthMetadataServiceClient(adminConnection)
cs.identityServiceClient = service.NewIdentityServiceClient(adminConnection)
cs.healthServiceClient = grpc_health_v1.NewHealthClient(adminConnection)
if authOpt != nil {
cs.authOpt = *authOpt
}
return &cs, nil
}

Expand Down

0 comments on commit 6313749

Please sign in to comment.