Browse Source

added iam token passing

Added iam token authentification
grigoriypisar 1 year ago
parent
commit
52e23495a9

+ 10 - 0
.mapping.json

@@ -9805,6 +9805,16 @@
   "ydb/tests/tools/idx_test/CMakeLists.linux-x86_64.txt":"",
   "ydb/tests/tools/idx_test/CMakeLists.txt":"",
   "ydb/tests/tools/idx_test/CMakeLists.windows-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/CMakeLists.darwin-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/CMakeLists.linux-aarch64.txt":"",
+  "ydb/tests/tools/kqprun/CMakeLists.linux-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/CMakeLists.txt":"",
+  "ydb/tests/tools/kqprun/CMakeLists.windows-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/src/CMakeLists.darwin-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/src/CMakeLists.linux-aarch64.txt":"",
+  "ydb/tests/tools/kqprun/src/CMakeLists.linux-x86_64.txt":"",
+  "ydb/tests/tools/kqprun/src/CMakeLists.txt":"",
+  "ydb/tests/tools/kqprun/src/CMakeLists.windows-x86_64.txt":"",
   "yt/CMakeLists.txt":"",
   "yt/cpp/CMakeLists.txt":"",
   "yt/cpp/mapreduce/CMakeLists.txt":"",

+ 3 - 3
ydb/core/testlib/test_client.cpp

@@ -855,10 +855,10 @@ namespace Tests {
                 auto databaseResolverActorId = NFq::MakeDatabaseResolverActorId();
                 Runtime->RegisterService(
                     databaseResolverActorId,
-                    Runtime->Register(NFq::CreateDatabaseResolver(httpProxyActorId, nullptr), nodeIdx),
+                    Runtime->Register(NFq::CreateDatabaseResolver(httpProxyActorId, Settings->CredentialsFactory), nodeIdx),
                     nodeIdx
                 );
-                
+
                 std::shared_ptr<NFq::TDatabaseAsyncResolverImpl> databaseAsyncResolver;
                 if (queryServiceConfig.GetGeneric().HasMdbGateway() && queryServiceConfig.HasMdbTransformHost()) {
                     databaseAsyncResolver = std::make_shared<NFq::TDatabaseAsyncResolverImpl>(
@@ -873,7 +873,7 @@ namespace Tests {
                 federatedQuerySetupFactory = std::make_shared<NKikimr::NKqp::TKqpFederatedQuerySetupFactoryMock>(
                     NYql::IHTTPGateway::Make(&queryServiceConfig.GetHttpGateway()),
                     NYql::NConnector::MakeClientGRPC(queryServiceConfig.GetGeneric().GetConnector()),
-                    nullptr,
+                    Settings->CredentialsFactory,
                     databaseAsyncResolver,
                     queryServiceConfig.GetS3(),
                     queryServiceConfig.GetGeneric()

+ 2 - 0
ydb/core/testlib/test_client.h

@@ -139,6 +139,7 @@ namespace Tests {
         TString MeteringFilePath;
         TString AwsRegion;
         NKqp::IKqpFederatedQuerySetupFactory::TPtr FederatedQuerySetupFactory = std::make_shared<NKqp::TKqpFederatedQuerySetupFactoryNoop>();
+        NYql::ISecuredServiceAccountCredentialsFactory::TPtr CredentialsFactory;
         bool InitializeFederatedQuerySetupFactory = false;
 
         std::function<IActor*(const NKikimrProto::TAuthConfig&)> CreateTicketParser = NKikimr::CreateTicketParser;
@@ -183,6 +184,7 @@ namespace Tests {
         TServerSettings& SetMeteringFilePath(const TString& path) { EnableMetering = true; MeteringFilePath = path; return *this; }
         TServerSettings& SetAwsRegion(const TString& value) { AwsRegion = value; return *this; }
         TServerSettings& SetFederatedQuerySetupFactory(NKqp::IKqpFederatedQuerySetupFactory::TPtr value) { FederatedQuerySetupFactory = value; return *this; }
+        TServerSettings& SetCredentialsFactory(NYql::ISecuredServiceAccountCredentialsFactory::TPtr credentialsFactory) { CredentialsFactory = std::move(credentialsFactory); return *this; }
         TServerSettings& SetInitializeFederatedQuerySetupFactory(bool value) { InitializeFederatedQuerySetupFactory = value; return *this; }
         TServerSettings& SetPersQueueGetReadSessionsInfoWorkerFactory(
             std::shared_ptr<NKikimr::NMsgBusProxy::IPersQueueGetReadSessionsInfoWorkerFactory> factory

+ 1 - 2
ydb/library/yql/providers/generic/provider/yql_generic_settings.cpp

@@ -3,7 +3,6 @@
 
 #include <ydb/library/yql/providers/common/structured_token/yql_token_builder.h>
 #include <ydb/library/yql/utils/log/log.h>
-#include <util/system/env.h>
 
 namespace NYql {
 
@@ -84,7 +83,7 @@ namespace NYql {
         const auto iamToken = credentials->FindCredentialContent(
             "default_" + cluster.name(),
             "default_generic",
-            cluster.GetToken() ? cluster.GetToken() : GetEnv("YQL_TOKEN"));
+            cluster.GetToken());
         if (iamToken) {
             return b.SetIAMToken(iamToken).ToJson();
         }

+ 1 - 0
ydb/tests/tools/CMakeLists.txt

@@ -7,3 +7,4 @@
 
 
 add_subdirectory(idx_test)
+add_subdirectory(kqprun)

+ 38 - 0
ydb/tests/tools/kqprun/CMakeLists.darwin-x86_64.txt

@@ -0,0 +1,38 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(src)
+
+add_executable(kqprun)
+target_compile_options(kqprun PRIVATE
+  -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_link_libraries(kqprun PUBLIC
+  contrib-libs-cxxsupp
+  yutil
+  library-cpp-cpuid_check
+  library-cpp-getopt
+  tools-kqprun-src
+  datetime2_udf
+  string_udf
+  yson2_udf
+)
+target_link_options(kqprun PRIVATE
+  -Wl,-platform_version,macos,11.0,11.0
+  -fPIC
+  -fPIC
+  -framework
+  CoreFoundation
+)
+target_sources(kqprun PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/tests/tools/kqprun/kqprun.cpp
+)
+target_allocator(kqprun
+  system_allocator
+)
+vcs_info(kqprun)

+ 41 - 0
ydb/tests/tools/kqprun/CMakeLists.linux-aarch64.txt

@@ -0,0 +1,41 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(src)
+
+add_executable(kqprun)
+target_compile_options(kqprun PRIVATE
+  -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_link_libraries(kqprun PUBLIC
+  contrib-libs-linux-headers
+  contrib-libs-cxxsupp
+  yutil
+  library-cpp-getopt
+  tools-kqprun-src
+  datetime2_udf
+  string_udf
+  yson2_udf
+)
+target_link_options(kqprun PRIVATE
+  -ldl
+  -lrt
+  -Wl,--no-as-needed
+  -fPIC
+  -fPIC
+  -lpthread
+  -lrt
+  -ldl
+)
+target_sources(kqprun PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/tests/tools/kqprun/kqprun.cpp
+)
+target_allocator(kqprun
+  cpp-malloc-jemalloc
+)
+vcs_info(kqprun)

+ 43 - 0
ydb/tests/tools/kqprun/CMakeLists.linux-x86_64.txt

@@ -0,0 +1,43 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(src)
+
+add_executable(kqprun)
+target_compile_options(kqprun PRIVATE
+  -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_link_libraries(kqprun PUBLIC
+  contrib-libs-linux-headers
+  contrib-libs-cxxsupp
+  yutil
+  library-cpp-cpuid_check
+  library-cpp-getopt
+  tools-kqprun-src
+  datetime2_udf
+  string_udf
+  yson2_udf
+)
+target_link_options(kqprun PRIVATE
+  -ldl
+  -lrt
+  -Wl,--no-as-needed
+  -fPIC
+  -fPIC
+  -lpthread
+  -lrt
+  -ldl
+)
+target_sources(kqprun PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/tests/tools/kqprun/kqprun.cpp
+)
+target_allocator(kqprun
+  cpp-malloc-tcmalloc
+  libs-tcmalloc-no_percpu_cache
+)
+vcs_info(kqprun)

+ 17 - 0
ydb/tests/tools/kqprun/CMakeLists.txt

@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+  include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+  include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+  include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+  include(CMakeLists.linux-x86_64.txt)
+endif()

+ 31 - 0
ydb/tests/tools/kqprun/CMakeLists.windows-x86_64.txt

@@ -0,0 +1,31 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(src)
+
+add_executable(kqprun)
+target_compile_options(kqprun PRIVATE
+  -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_link_libraries(kqprun PUBLIC
+  contrib-libs-cxxsupp
+  yutil
+  library-cpp-cpuid_check
+  library-cpp-getopt
+  tools-kqprun-src
+  datetime2_udf
+  string_udf
+  yson2_udf
+)
+target_sources(kqprun PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/tests/tools/kqprun/kqprun.cpp
+)
+target_allocator(kqprun
+  system_allocator
+)
+vcs_info(kqprun)

Some files were not shown because too many files changed in this diff