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

Upstream Using InMemory token cache for admin clientset in propeller #5621

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions flytepropeller/pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/flyteorg/flyte/flyteidl/clients/go/admin"
tokenCache "github.com/flyteorg/flyte/flyteidl/clients/go/admin/cache"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/flytek8s"
flyteK8sConfig "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/flytek8s/config"
Expand Down Expand Up @@ -302,14 +303,15 @@

func getAdminClient(ctx context.Context) (client service.AdminServiceClient, signalClient service.SignalServiceClient, opt []grpc.DialOption, err error) {
cfg := admin.GetConfig(ctx)
clients, err := admin.NewClientsetBuilder().WithConfig(cfg).Build(ctx)
tc := tokenCache.NewTokenCacheInMemoryProvider()
clients, err := admin.NewClientsetBuilder().WithConfig(cfg).WithTokenCache(tc).Build(ctx)

Check warning on line 307 in flytepropeller/pkg/controller/controller.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/controller.go#L306-L307

Added lines #L306 - L307 were not covered by tests
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to initialize clientset. Error: %w", err)
}

credentialsFuture := admin.NewPerRPCCredentialsFuture()
opts := []grpc.DialOption{
grpc.WithChainUnaryInterceptor(admin.NewAuthInterceptor(cfg, nil, credentialsFuture, nil)),
grpc.WithChainUnaryInterceptor(admin.NewAuthInterceptor(cfg, tc, credentialsFuture, nil)),

Check warning on line 314 in flytepropeller/pkg/controller/controller.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/controller.go#L314

Added line #L314 was not covered by tests
grpc.WithPerRPCCredentials(credentialsFuture),
}

Expand Down
Loading