From a95d6617f17e374ff0a79b1a49fc1abc2ca0023a Mon Sep 17 00:00:00 2001 From: Dom Delnano Date: Wed, 11 Dec 2024 10:40:11 -0800 Subject: [PATCH] Add UDTF that detects linux kernel header installation and add column to `GetAgentStatus` (#2052) Summary: Add UDTF that detects linux kernel header installation and add column to `GetAgentStatus` This is a prerequisite to accomplish #2051. The `px deploy` command uses the GetAgentStatus UDTF in its final [healthcheck step](https://github.com/pixie-io/pixie/blob/854062111cf4b91a40649a2e2647c88c0a68b0db/src/pixie_cli/pkg/cmd/deploy.go#L607-L613). With this kernel header detection in place, the `px` cli can use the results from the `px/agent_status` script to print a warning message if kernel headers aren't detected. The helm install flow needs to be covered as well. My hope is that this UDTF could be used for that use case as well, but I need to further investigate the details of that. Relevant Issues: #2051 Type of change: /kind feature Test Plan: Skaffolded to a Ubuntu GKE cluster and tested the following - [x] Kelvin always reports `false` as it doesn't bind mount `/` to `/host` - [x] PEM running on host without `linux-headers-$(uname -r)` package reports `false` - [x] PEM running on host with `linux-headers-$(uname -r)` package reports `true` ``` $ gcloud compute ssh gke-dev-cluster-ddelnano-default-pool-a27c1ac2-x5k2 --internal-ip -- 'ls -alh /lib/modules/$(uname -r)/build' lrwxrwxrwx 1 root root 38 Aug 9 15:25 /lib/modules/5.15.0-1065-gke/build -> /usr/src/linux-headers-5.15.0-1065-gke $ gcloud compute ssh gke-dev-cluster-ddelnano-default-pool-a27c1ac2-j6pg --internal-ip -- 'ls -alh /lib/modules/$(uname -r)/build' ls: cannot access '/lib/modules/5.15.0-1065-gke/build': No such file or directory ``` ![Screen Shot 2024-12-02 at 9 30 29 AM](https://github.com/user-attachments/assets/9fa862f8-5a6c-46d6-8899-bfaf2bdf3371) Changelog Message: Add `GetLinuxHeadersStatus` UDTF and add `kernel_headers_installed` column to `GetAgentStatus` --------- Signed-off-by: Dom Del Nano --- src/common/system/kernel_version.h | 5 + src/common/system/linux_headers_utils.cc | 78 ++++++++ src/common/system/linux_headers_utils.h | 46 +++++ src/stirling/utils/linux_headers.cc | 53 +----- src/vizier/funcs/md_udtfs/md_udtfs.cc | 2 + src/vizier/funcs/md_udtfs/md_udtfs_impl.h | 64 ++++++- .../services/agent/kelvin/kelvin_main.cc | 6 +- .../services/agent/kelvin/kelvin_manager.h | 4 +- src/vizier/services/agent/pem/pem_main.cc | 18 +- src/vizier/services/agent/pem/pem_manager.h | 8 +- src/vizier/services/agent/shared/base/info.h | 2 +- .../services/agent/shared/manager/manager.cc | 4 +- .../services/agent/shared/manager/manager.h | 2 +- .../agent/shared/manager/registration.cc | 3 +- .../agent/shared/manager/registration_test.cc | 15 +- .../services/shared/agentpb/agent.pb.go | 167 +++++++++++------- .../services/shared/agentpb/agent.proto | 2 + 17 files changed, 353 insertions(+), 126 deletions(-) create mode 100644 src/common/system/linux_headers_utils.cc create mode 100644 src/common/system/linux_headers_utils.h diff --git a/src/common/system/kernel_version.h b/src/common/system/kernel_version.h index 7b0588d5657..b96a738a14c 100644 --- a/src/common/system/kernel_version.h +++ b/src/common/system/kernel_version.h @@ -75,6 +75,11 @@ enum class KernelVersionOrder { kNewer, }; +struct KernelInfo { + KernelVersion version; + bool kernel_headers_installed; +}; + // Compares two kernel versions and detect their relationship. KernelVersionOrder CompareKernelVersions(KernelVersion a, KernelVersion b); diff --git a/src/common/system/linux_headers_utils.cc b/src/common/system/linux_headers_utils.cc new file mode 100644 index 00000000000..2e2ca144c0a --- /dev/null +++ b/src/common/system/linux_headers_utils.cc @@ -0,0 +1,78 @@ +/* + * Copyright 2018- The Pixie Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "src/common/system/linux_headers_utils.h" + +#include +#include +#include +#include + +#include "src/common/base/file.h" +#include "src/common/fs/fs_wrapper.h" +#include "src/common/system/config.h" + +namespace px { +namespace system { + +StatusOr ResolvePossibleSymlinkToHostPath(const std::filesystem::path p) { + // Check if "p" is a symlink. + std::error_code ec; + const bool is_symlink = std::filesystem::is_symlink(p, ec); + if (ec) { + return error::NotFound(absl::Substitute("Did not find the host headers at path: $0, $1.", + p.string(), ec.message())); + } + + if (!is_symlink) { + // Not a symlink, we are good now. + return p; + } + + // Resolve the symlink, and re-convert to a host path.. + const std::filesystem::path resolved = std::filesystem::read_symlink(p, ec); + if (ec) { + return error::Internal(ec.message()); + } + + // Relative paths containing "../" can result in an invalid host mount path when using + // ToHostPath. Therefore, we need to treat the absolute and relative cases differently. + std::filesystem::path resolved_host_path; + if (resolved.is_absolute()) { + resolved_host_path = system::Config::GetInstance().ToHostPath(resolved); + VLOG(1) << absl::Substitute( + "Symlink target is an absolute path. Converting that to host path: $0 -> $1.", + resolved.string(), resolved_host_path.string()); + } else { + resolved_host_path = p.parent_path(); + resolved_host_path /= resolved.string(); + VLOG(1) << absl::Substitute( + "Symlink target is a relative path. Concatenating it to parent directory: $0", + resolved_host_path.string()); + } + + // Downstream won't be ok unless the resolved host path exists; return an error if needed. + if (!fs::Exists(resolved_host_path)) { + return error::NotFound(absl::Substitute("Did not find host headers at resolved path: $0.", + resolved_host_path.string())); + } + return resolved_host_path; +} + +} // namespace system +} // namespace px diff --git a/src/common/system/linux_headers_utils.h b/src/common/system/linux_headers_utils.h new file mode 100644 index 00000000000..a53147fe2bb --- /dev/null +++ b/src/common/system/linux_headers_utils.h @@ -0,0 +1,46 @@ +/* + * Copyright 2018- The Pixie Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include + +#include "src/common/base/base.h" + +namespace px { +namespace system { + +constexpr std::string_view kLinuxModulesDir = "/lib/modules/"; + +/** + * Resolves a possible symlink path to its corresponding host filesystem path. + * + * This function takes a filesystem path and checks if it is a symbolic link. If it is, + * the symlink is resolved to its target path. Depending on whether the target is an absolute + * or relative path, it is further processed to convert it into a valid host path (as in + * Config::ToHostPath(...) path). + * + * If the input path is not a symlink, it is returned as-is. The function ensures that + * the final resolved path exists in the host filesystem before returning it. Errors are + * returned when the path does not exist, the resolution fails, or when there is an issue + * accessing the filesystem. + */ +StatusOr ResolvePossibleSymlinkToHostPath(const std::filesystem::path p); + +} // namespace system +} // namespace px diff --git a/src/stirling/utils/linux_headers.cc b/src/stirling/utils/linux_headers.cc index 75cbff9fe56..d9edf4b2f38 100644 --- a/src/stirling/utils/linux_headers.cc +++ b/src/stirling/utils/linux_headers.cc @@ -31,6 +31,7 @@ #include "src/common/fs/temp_file.h" #include "src/common/minitar/minitar.h" #include "src/common/system/config.h" +#include "src/common/system/linux_headers_utils.h" #include "src/common/system/proc_pid_path.h" #include "src/common/zlib/zlib_wrapper.h" @@ -83,7 +84,7 @@ StatusOr FindKernelConfig() { // Search for /boot/config- syscfg.ToHostPath(absl::StrCat("/boot/config-", uname)), // Search for /lib/modules//config - syscfg.ToHostPath(absl::StrCat("/lib/modules/", uname, "/config")), + syscfg.ToHostPath(absl::StrCat(px::system::kLinuxModulesDir, uname, "/config")), // TODO(yzhao): https://github.com/lima-vm/alpine-lima/issues/67 once this issue is resolved, // we might consider change these 2 paths into something recommended by rancher-desktop. // The path used by `alpine-lima` in "Live CD" boot mechanism. @@ -209,55 +210,12 @@ Status FindLinuxHeadersDirectory(const std::filesystem::path& lib_modules_dir) { return error::NotFound("Could not find 'source' or 'build' under $0.", lib_modules_dir.string()); } -StatusOr ResolvePossibleSymlinkToHostPath(const std::filesystem::path p) { - // Check if "p" is a symlink. - std::error_code ec; - const bool is_symlink = std::filesystem::is_symlink(p, ec); - if (ec) { - return error::NotFound(absl::Substitute("Did not find the host headers at path: $0, $1.", - p.string(), ec.message())); - } - - if (!is_symlink) { - // Not a symlink, we are good now. - return p; - } - - // Resolve the symlink, and re-convert to a host path.. - const std::filesystem::path resolved = std::filesystem::read_symlink(p, ec); - if (ec) { - return error::Internal(ec.message()); - } - - // Relative paths containing "../" can result in an invalid host mount path when using - // ToHostPath. Therefore, we need to treat the absolute and relative cases differently. - std::filesystem::path resolved_host_path; - if (resolved.is_absolute()) { - resolved_host_path = system::Config::GetInstance().ToHostPath(resolved); - VLOG(1) << absl::Substitute( - "Symlink target is an absolute path. Converting that to host path: $0 -> $1.", - resolved.string(), resolved_host_path.string()); - } else { - resolved_host_path = p.parent_path(); - resolved_host_path /= resolved.string(); - VLOG(1) << absl::Substitute( - "Symlink target is a relative path. Concatenating it to parent directory: $0", - resolved_host_path.string()); - } - - // Downstream won't be ok unless the resolved host path exists; return an error if needed. - if (!fs::Exists(resolved_host_path)) { - return error::NotFound(absl::Substitute("Did not find host headers at resolved path: $0.", - resolved_host_path.string())); - } - return resolved_host_path; -} - Status LinkHostLinuxHeadersKernel(const std::filesystem::path& lib_modules_dir) { const auto host_path = system::Config::GetInstance().ToHostPath(lib_modules_dir); LOG(INFO) << absl::Substitute("Looking for host Linux headers at $0.", host_path.string()); - PX_ASSIGN_OR_RETURN(const auto resolved_host_path, ResolvePossibleSymlinkToHostPath(host_path)); + PX_ASSIGN_OR_RETURN(const auto resolved_host_path, + system::ResolvePossibleSymlinkToHostPath(host_path)); PX_RETURN_IF_ERROR(fs::CreateSymlinkIfNotExists(resolved_host_path, lib_modules_dir)); LOG(INFO) << absl::Substitute("Linked host headers at $0 to symlink in pem namespace at $1.", resolved_host_path.string(), lib_modules_dir.string()); @@ -401,7 +359,8 @@ Status FindOrInstallLinuxHeaders() { // However we find Linux headers (below) we link them into the mount namespace of this // process using one (or both) of the above paths. - const std::filesystem::path pem_ns_lib_modules_dir = "/lib/modules/" + uname; + const std::filesystem::path pem_ns_lib_modules_dir = + std::string(px::system::kLinuxModulesDir) + uname; // Create (or verify existence); does nothing if the directory already exists. PX_RETURN_IF_ERROR(fs::CreateDirectories(pem_ns_lib_modules_dir)); diff --git a/src/vizier/funcs/md_udtfs/md_udtfs.cc b/src/vizier/funcs/md_udtfs/md_udtfs.cc index bbd66679cc0..193c6d45dff 100644 --- a/src/vizier/funcs/md_udtfs/md_udtfs.cc +++ b/src/vizier/funcs/md_udtfs/md_udtfs.cc @@ -37,6 +37,8 @@ void RegisterFuncsOrDie(const VizierFuncFactoryContext& ctx, carnot::udf::Regist registry->RegisterFactoryOrDie>( "GetProfilerSamplingPeriodMS", ctx); + registry->RegisterFactoryOrDie>( + "GetLinuxHeadersStatus", ctx); registry->RegisterOrDie("_DebugMDState"); registry->RegisterFactoryOrDie>( diff --git a/src/vizier/funcs/md_udtfs/md_udtfs_impl.h b/src/vizier/funcs/md_udtfs/md_udtfs_impl.h index b2ef494ee96..7cb40966933 100644 --- a/src/vizier/funcs/md_udtfs/md_udtfs_impl.h +++ b/src/vizier/funcs/md_udtfs/md_udtfs_impl.h @@ -43,6 +43,10 @@ namespace px { namespace vizier { namespace funcs { namespace md { + +constexpr std::string_view kKernelHeadersInstalledDesc = + "Whether the agent had linux headers pre-installed"; + template class UDTFWithMDFactory : public carnot::udf::UDTFFactory { public: @@ -295,7 +299,9 @@ class GetAgentStatus final : public carnot::udf::UDTF { ColInfo("create_time", types::DataType::TIME64NS, types::PatternType::GENERAL, "The creation time of the agent"), ColInfo("last_heartbeat_ns", types::DataType::INT64, types::PatternType::GENERAL, - "Time (in nanoseconds) since the last heartbeat")); + "Time (in nanoseconds) since the last heartbeat"), + ColInfo("kernel_headers_installed", types::DataType::BOOLEAN, types::PatternType::GENERAL, + kKernelHeadersInstalledDesc)); } Status Init(FunctionContext*) { @@ -330,6 +336,8 @@ class GetAgentStatus final : public carnot::udf::UDTF { rw->Append(StringValue(magic_enum::enum_name(agent_status.state()))); rw->Append(agent_info.create_time_ns()); rw->Append(agent_status.ns_since_last_heartbeat()); + rw->Append( + agent_info.info().host_info().kernel_headers_installed()); ++idx_; return idx_ < resp_->info_size(); @@ -396,6 +404,60 @@ class GetProfilerSamplingPeriodMS final : public carnot::udf::UDTF add_context_authentication_func_; }; +/** + * This UDTF retrieves the status of the agents' Linux headers installation. + */ +class GetLinuxHeadersStatus final : public carnot::udf::UDTF { + public: + using MDSStub = vizier::services::metadata::MetadataService::Stub; + using SchemaResponse = vizier::services::metadata::SchemaResponse; + GetLinuxHeadersStatus() = delete; + GetLinuxHeadersStatus(std::shared_ptr stub, + std::function add_context_authentication) + : idx_(0), stub_(stub), add_context_authentication_func_(add_context_authentication) {} + + static constexpr auto Executor() { return carnot::udfspb::UDTFSourceExecutor::UDTF_ONE_KELVIN; } + + static constexpr auto OutputRelation() { + return MakeArray( + ColInfo("asid", types::DataType::INT64, types::PatternType::GENERAL, "The Agent Short ID"), + ColInfo("kernel_headers_installed", types::DataType::BOOLEAN, types::PatternType::GENERAL, + kKernelHeadersInstalledDesc)); + } + + Status Init(FunctionContext*) { + px::vizier::services::metadata::AgentInfoRequest req; + resp_ = std::make_unique(); + + grpc::ClientContext ctx; + add_context_authentication_func_(&ctx); + auto s = stub_->GetAgentInfo(&ctx, req, resp_.get()); + if (!s.ok()) { + return error::Internal("Failed to make RPC call to GetAgentInfo"); + } + return Status::OK(); + } + + bool NextRecord(FunctionContext*, RecordWriter* rw) { + const auto& agent_metadata = resp_->info(idx_); + const auto& agent_info = agent_metadata.agent(); + + const auto asid = agent_info.asid(); + const auto kernel_headers_installed = agent_info.info().host_info().kernel_headers_installed(); + rw->Append(asid); + rw->Append(kernel_headers_installed); + + ++idx_; + return idx_ < resp_->info_size(); + } + + private: + int idx_ = 0; + std::unique_ptr resp_; + std::shared_ptr stub_; + std::function add_context_authentication_func_; +}; + namespace internal { inline rapidjson::GenericStringRef StringRef(std::string_view s) { return rapidjson::GenericStringRef(s.data(), s.size()); diff --git a/src/vizier/services/agent/kelvin/kelvin_main.cc b/src/vizier/services/agent/kelvin/kelvin_main.cc index fdcacad7f64..20dee4787c9 100644 --- a/src/vizier/services/agent/kelvin/kelvin_main.cc +++ b/src/vizier/services/agent/kelvin/kelvin_main.cc @@ -91,8 +91,12 @@ int main(int argc, char** argv) { LOG(INFO) << absl::Substitute("Pixie Kelvin. Version: $0, id: $1, kernel: $2", px::VersionInfo::VersionString(), agent_id.str(), kernel_version.ToString()); + auto kernel_info = px::system::KernelInfo{ + kernel_version, + false /* kernel_headers_installed */, + }; auto manager = KelvinManager::Create(agent_id, FLAGS_pod_name, FLAGS_host_ip, addr, - FLAGS_rpc_port, FLAGS_nats_url, mds_addr, kernel_version) + FLAGS_rpc_port, FLAGS_nats_url, mds_addr, kernel_info) .ConsumeValueOrDie(); TerminationHandler::set_manager(manager.get()); diff --git a/src/vizier/services/agent/kelvin/kelvin_manager.h b/src/vizier/services/agent/kelvin/kelvin_manager.h index e5d2460fd88..51b0c2fc993 100644 --- a/src/vizier/services/agent/kelvin/kelvin_manager.h +++ b/src/vizier/services/agent/kelvin/kelvin_manager.h @@ -44,9 +44,9 @@ class KelvinManager : public Manager { KelvinManager() = delete; KelvinManager(sole::uuid agent_id, std::string_view pod_name, std::string_view host_ip, std::string_view addr, int grpc_server_port, std::string_view nats_url, - std::string_view mds_url, system::KernelVersion kernel_version) + std::string_view mds_url, system::KernelInfo kernel_info) : Manager(agent_id, pod_name, host_ip, grpc_server_port, KelvinManager::Capabilities(), - KelvinManager::Parameters(), nats_url, mds_url, kernel_version) { + KelvinManager::Parameters(), nats_url, mds_url, kernel_info) { info()->address = std::string(addr); } diff --git a/src/vizier/services/agent/pem/pem_main.cc b/src/vizier/services/agent/pem/pem_main.cc index c9a2e81884c..e9fcebc144c 100644 --- a/src/vizier/services/agent/pem/pem_main.cc +++ b/src/vizier/services/agent/pem/pem_main.cc @@ -25,6 +25,7 @@ #include "src/common/base/base.h" #include "src/common/signal/signal.h" #include "src/common/system/kernel_version.h" +#include "src/common/system/linux_headers_utils.h" #include "src/shared/version/version.h" DEFINE_string(nats_url, gflags::StringFromEnv("PL_NATS_URL", "pl-nats"), @@ -68,8 +69,23 @@ int main(int argc, char** argv) { LOG(INFO) << absl::Substitute("Pixie PEM. Version: $0, id: $1, kernel version: $2", px::VersionInfo::VersionString(), agent_id.str(), kernel_version.ToString()); + + auto kernel_headers_installed = false; + auto uname = px::system::GetUname(); + if (uname.ok()) { + const auto host_path = px::system::Config::GetInstance().ToHostPath( + absl::StrCat(px::system::kLinuxModulesDir, uname.ConsumeValueOrDie(), "/build")); + + const auto resolved_host_path = px::system::ResolvePossibleSymlinkToHostPath(host_path); + kernel_headers_installed = resolved_host_path.ok(); + } + + auto kernel_info = px::system::KernelInfo{ + kernel_version, + kernel_headers_installed, + }; auto manager = - PEMManager::Create(agent_id, FLAGS_pod_name, FLAGS_host_ip, FLAGS_nats_url, kernel_version) + PEMManager::Create(agent_id, FLAGS_pod_name, FLAGS_host_ip, FLAGS_nats_url, kernel_info) .ConsumeValueOrDie(); TerminationHandler::set_manager(manager.get()); diff --git a/src/vizier/services/agent/pem/pem_manager.h b/src/vizier/services/agent/pem/pem_manager.h index 442c7a34bce..9dcbab9b4f9 100644 --- a/src/vizier/services/agent/pem/pem_manager.h +++ b/src/vizier/services/agent/pem/pem_manager.h @@ -53,18 +53,18 @@ class PEMManager : public Manager { protected: PEMManager() = delete; PEMManager(sole::uuid agent_id, std::string_view pod_name, std::string_view host_ip, - std::string_view nats_url, px::system::KernelVersion kernel_version) + std::string_view nats_url, px::system::KernelInfo kernel_info) : PEMManager(agent_id, pod_name, host_ip, nats_url, px::stirling::Stirling::Create(px::stirling::CreateSourceRegistryFromFlag()), - kernel_version) {} + kernel_info) {} // Constructor which creates the HostInfo for an agent (runs once per node). PEMManager(sole::uuid agent_id, std::string_view pod_name, std::string_view host_ip, std::string_view nats_url, std::unique_ptr stirling, - px::system::KernelVersion kernel_version) + px::system::KernelInfo kernel_info) : Manager(agent_id, pod_name, host_ip, /*grpc_server_port*/ 0, PEMManager::Capabilities(), PEMManager::Parameters(), nats_url, - /*mds_url*/ "", kernel_version), + /*mds_url*/ "", kernel_info), stirling_(std::move(stirling)), node_available_memory_(prometheus::BuildGauge() .Name("node_available_memory") diff --git a/src/vizier/services/agent/shared/base/info.h b/src/vizier/services/agent/shared/base/info.h index 62ea8e5f1e3..1f35eba58c0 100644 --- a/src/vizier/services/agent/shared/base/info.h +++ b/src/vizier/services/agent/shared/base/info.h @@ -43,7 +43,7 @@ struct Info { std::string address; std::string pod_name; std::string host_ip; - system::KernelVersion kernel_version; + system::KernelInfo kernel_info; services::shared::agent::AgentCapabilities capabilities; services::shared::agent::AgentParameters parameters; }; diff --git a/src/vizier/services/agent/shared/manager/manager.cc b/src/vizier/services/agent/shared/manager/manager.cc index 75fac1db7a0..004eb5ba2ea 100644 --- a/src/vizier/services/agent/shared/manager/manager.cc +++ b/src/vizier/services/agent/shared/manager/manager.cc @@ -98,7 +98,7 @@ std::shared_ptr CreateCronScri Manager::Manager(sole::uuid agent_id, std::string_view pod_name, std::string_view host_ip, int grpc_server_port, services::shared::agent::AgentCapabilities capabilities, services::shared::agent::AgentParameters parameters, std::string_view nats_url, - std::string_view mds_url, system::KernelVersion kernel_version) + std::string_view mds_url, system::KernelInfo kernel_info) : grpc_channel_creds_(SSL::DefaultGRPCClientCreds()), time_system_(std::make_unique()), api_(std::make_unique(time_system_.get())), @@ -134,7 +134,7 @@ Manager::Manager(sole::uuid agent_id, std::string_view pod_name, std::string_vie info_.parameters = std::move(parameters); info_.pod_name = std::string(pod_name); info_.host_ip = std::string(host_ip); - info_.kernel_version = kernel_version; + info_.kernel_info = kernel_info; } Status Manager::Init() { diff --git a/src/vizier/services/agent/shared/manager/manager.h b/src/vizier/services/agent/shared/manager/manager.h index 67f8a161081..3d7a8a4f49e 100644 --- a/src/vizier/services/agent/shared/manager/manager.h +++ b/src/vizier/services/agent/shared/manager/manager.h @@ -109,7 +109,7 @@ class Manager : public BaseManager { Manager(sole::uuid agent_id, std::string_view pod_name, std::string_view host_ip, int grpc_server_port, services::shared::agent::AgentCapabilities capabilities, services::shared::agent::AgentParameters parameters, std::string_view nats_url, - std::string_view mds_url, system::KernelVersion kernel_version); + std::string_view mds_url, system::KernelInfo kernel_info); Status Init(); Status RegisterMessageHandler(MsgCase c, std::shared_ptr handler, diff --git a/src/vizier/services/agent/shared/manager/registration.cc b/src/vizier/services/agent/shared/manager/registration.cc index fe9ad3587e1..9edbfae79aa 100644 --- a/src/vizier/services/agent/shared/manager/registration.cc +++ b/src/vizier/services/agent/shared/manager/registration.cc @@ -90,8 +90,9 @@ Status RegistrationHandler::DispatchRegistration() { host_info->set_hostname(agent_info()->hostname); host_info->set_pod_name(agent_info()->pod_name); host_info->set_host_ip(agent_info()->host_ip); - auto kernel_version_proto = KernelToProto(agent_info()->kernel_version); + auto kernel_version_proto = KernelToProto(agent_info()->kernel_info.version); host_info->mutable_kernel()->CopyFrom(kernel_version_proto); + host_info->set_kernel_headers_installed(agent_info()->kernel_info.kernel_headers_installed); *req_info->mutable_capabilities() = agent_info()->capabilities; *req_info->mutable_parameters() = agent_info()->parameters; diff --git a/src/vizier/services/agent/shared/manager/registration_test.cc b/src/vizier/services/agent/shared/manager/registration_test.cc index 3811ed47e08..b05ef7bf592 100644 --- a/src/vizier/services/agent/shared/manager/registration_test.cc +++ b/src/vizier/services/agent/shared/manager/registration_test.cc @@ -62,8 +62,11 @@ class RegistrationHandlerTest : public ::testing::Test { agent_info_.pod_name = "pod_name"; agent_info_.host_ip = "host_ip"; agent_info_.capabilities.set_collects_data(true); - agent_info_.kernel_version = - system::ParseKernelVersionString("5.15.0-106-generic").ValueOrDie(); + auto kernel_info = system::KernelInfo{ + system::ParseKernelVersionString("5.15.0-106-generic").ValueOrDie(), + true /*kernel_headers_installed*/, + }; + agent_info_.kernel_info = kernel_info; auto register_hook = [this](uint32_t asid) -> Status { called_register_++; @@ -114,9 +117,11 @@ TEST_F(RegistrationHandlerTest, RegisterAgent) { EXPECT_EQ(agent_info_.hostname, req.info().host_info().hostname()); EXPECT_EQ(agent_info_.pod_name, req.info().host_info().pod_name()); EXPECT_EQ(agent_info_.host_ip, req.info().host_info().host_ip()); - EXPECT_EQ(agent_info_.kernel_version.version, req.info().host_info().kernel().version()); - EXPECT_EQ(agent_info_.kernel_version.major_rev, req.info().host_info().kernel().major_rev()); - EXPECT_EQ(agent_info_.kernel_version.minor_rev, req.info().host_info().kernel().minor_rev()); + EXPECT_EQ(agent_info_.kernel_info.version.version, req.info().host_info().kernel().version()); + EXPECT_EQ(agent_info_.kernel_info.version.major_rev, req.info().host_info().kernel().major_rev()); + EXPECT_EQ(agent_info_.kernel_info.version.minor_rev, req.info().host_info().kernel().minor_rev()); + EXPECT_EQ(agent_info_.kernel_info.kernel_headers_installed, + req.info().host_info().kernel_headers_installed()); auto registration_ack = std::make_unique(); registration_ack->mutable_register_agent_response()->set_asid(10); diff --git a/src/vizier/services/shared/agentpb/agent.pb.go b/src/vizier/services/shared/agentpb/agent.pb.go index 04334195703..28f81f966db 100755 --- a/src/vizier/services/shared/agentpb/agent.pb.go +++ b/src/vizier/services/shared/agentpb/agent.pb.go @@ -275,10 +275,11 @@ func (m *KernelVersion) GetMinorRev() uint32 { } type HostInfo struct { - Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` - PodName string `protobuf:"bytes,2,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` - HostIP string `protobuf:"bytes,3,opt,name=host_ip,json=hostIp,proto3" json:"host_ip,omitempty"` - Kernel *KernelVersion `protobuf:"bytes,4,opt,name=kernel,proto3" json:"kernel,omitempty"` + Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` + PodName string `protobuf:"bytes,2,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + HostIP string `protobuf:"bytes,3,opt,name=host_ip,json=hostIp,proto3" json:"host_ip,omitempty"` + Kernel *KernelVersion `protobuf:"bytes,4,opt,name=kernel,proto3" json:"kernel,omitempty"` + KernelHeadersInstalled bool `protobuf:"varint,5,opt,name=kernel_headers_installed,json=kernelHeadersInstalled,proto3" json:"kernel_headers_installed,omitempty"` } func (m *HostInfo) Reset() { *m = HostInfo{} } @@ -341,6 +342,13 @@ func (m *HostInfo) GetKernel() *KernelVersion { return nil } +func (m *HostInfo) GetKernelHeadersInstalled() bool { + if m != nil { + return m.KernelHeadersInstalled + } + return false +} + type Agent struct { Info *AgentInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` CreateTimeNS int64 `protobuf:"varint,2,opt,name=create_time_ns,json=createTimeNs,proto3" json:"create_time_ns,omitempty"` @@ -475,61 +483,62 @@ func init() { } var fileDescriptor_fef0af3bd5248f34 = []byte{ - // 852 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xc6, 0x49, 0x6c, 0x4f, 0xe2, 0xc6, 0x9d, 0x56, 0xaa, 0x09, 0xd5, 0x6e, 0xe4, 0x82, - 0x54, 0x0a, 0xac, 0x51, 0x90, 0x80, 0x0b, 0x20, 0x3b, 0x76, 0x89, 0xd5, 0xb2, 0xb1, 0x66, 0x9d, - 0x20, 0xb8, 0x8c, 0xc6, 0xbb, 0x93, 0x78, 0xa8, 0xbd, 0x3b, 0x9a, 0x19, 0x5b, 0x55, 0x4f, 0x1c, - 0x39, 0xf2, 0x17, 0xb8, 0x71, 0xe2, 0x77, 0x70, 0xcc, 0xb1, 0xa7, 0x15, 0xd9, 0x70, 0xe0, 0xd8, - 0x9f, 0x80, 0xf6, 0xed, 0xba, 0xa9, 0x5b, 0x89, 0xe4, 0xb4, 0xf3, 0xde, 0xf7, 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76, 0x69, 0x97, 0xce, 0x2f, 0xed, 0xd2, 0xcb, 0x4b, 0xbb, 0xf4, 0x53, 0xa5, 0xf8, 0xfd, - 0x8f, 0x37, 0xe1, 0x47, 0xfc, 0xf9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x91, 0x00, 0xa3, - 0x2b, 0x06, 0x00, 0x00, + // 879 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x49, 0x6c, 0x4f, 0xe2, 0xc6, 0x9d, 0x56, 0xd4, 0x84, 0x6a, 0x37, 0x72, 0x41, + 0x2a, 0x05, 0xd6, 0x28, 0x48, 0xd0, 0x0b, 0x20, 0x3b, 0x76, 0xb1, 0xd5, 0xb2, 0xb1, 0x66, 0x9d, + 0x20, 0xb8, 0x8c, 0xc6, 0xbb, 0x93, 0x78, 0xe8, 0x7a, 0x77, 0x34, 0x33, 0xb6, 0xaa, 0x9e, 0x38, + 0x72, 0xe4, 0x2f, 0x70, 0xe3, 0xa7, 0x70, 0xcc, 0xb1, 0x27, 0x8b, 0x6c, 0x38, 0xf4, 0xd8, 0x9f, + 0x80, 0xf6, 0xad, 0xdd, 0xd4, 0x8d, 0x44, 0x72, 0xda, 0xf7, 0xde, 0xf7, 0x7d, 0xef, 0xcd, 0x7c, + 0x6f, 0x64, 0x23, 0x57, 0xab, 0xa0, 0x39, 0x13, 0x2f, 0x05, 0x57, 0x4d, 0xcd, 0xd5, 0x4c, 0x04, + 0x5c, 0x37, 0xf5, 0x98, 0x29, 0x1e, 0x36, 0xd9, 0x29, 0x8f, 0x8d, 0x1c, 0xe5, 0x5f, 0x57, 0xaa, + 0xc4, 0x24, 0xd8, 0x91, 0x2f, 0xdc, 0x9c, 0xee, 0x2e, 0xe9, 0x6e, 0x4e, 0x77, 0x81, 0xb6, 0xfb,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 0xff, 0x4a, 0xa6, 0x4a, 0x57, 0x65, 0x06, 0x00, 0x00, } func (x AgentState) String() string { @@ -684,6 +693,9 @@ func (this *HostInfo) Equal(that interface{}) bool { if !this.Kernel.Equal(that1.Kernel) { return false } + if this.KernelHeadersInstalled != that1.KernelHeadersInstalled { + return false + } return true } func (this *Agent) Equal(that interface{}) bool { @@ -804,7 +816,7 @@ func (this *HostInfo) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 8) + s := make([]string, 0, 9) s = append(s, "&agentpb.HostInfo{") s = append(s, "Hostname: "+fmt.Sprintf("%#v", this.Hostname)+",\n") s = append(s, "PodName: "+fmt.Sprintf("%#v", this.PodName)+",\n") @@ -812,6 +824,7 @@ func (this *HostInfo) GoString() string { if this.Kernel != nil { s = append(s, "Kernel: "+fmt.Sprintf("%#v", this.Kernel)+",\n") } + s = append(s, "KernelHeadersInstalled: "+fmt.Sprintf("%#v", this.KernelHeadersInstalled)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1046,6 +1059,16 @@ func (m *HostInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.KernelHeadersInstalled { + i-- + if m.KernelHeadersInstalled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } if m.Kernel != nil { { size, err := m.Kernel.MarshalToSizedBuffer(dAtA[:i]) @@ -1269,6 +1292,9 @@ func (m *HostInfo) Size() (n int) { l = m.Kernel.Size() n += 1 + l + sovAgent(uint64(l)) } + if m.KernelHeadersInstalled { + n += 2 + } return n } @@ -1370,6 +1396,7 @@ func (this *HostInfo) String() string { `PodName:` + fmt.Sprintf("%v", this.PodName) + `,`, `HostIP:` + fmt.Sprintf("%v", this.HostIP) + `,`, `Kernel:` + strings.Replace(this.Kernel.String(), "KernelVersion", "KernelVersion", 1) + `,`, + `KernelHeadersInstalled:` + fmt.Sprintf("%v", this.KernelHeadersInstalled) + `,`, `}`, }, "") return s @@ -2039,6 +2066,26 @@ func (m *HostInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KernelHeadersInstalled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.KernelHeadersInstalled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipAgent(dAtA[iNdEx:]) diff --git a/src/vizier/services/shared/agentpb/agent.proto b/src/vizier/services/shared/agentpb/agent.proto index a0565641cf2..e717818533f 100644 --- a/src/vizier/services/shared/agentpb/agent.proto +++ b/src/vizier/services/shared/agentpb/agent.proto @@ -62,6 +62,8 @@ message HostInfo { string host_ip = 3 [ (gogoproto.customname) = "HostIP" ]; // Version of the kernel running on the host. KernelVersion kernel = 4; + // Whether kernel headers were preinstalled on the host. + bool kernel_headers_installed = 5; } // Agent contains information about a specific agent instance.