From 067df42f1df3d30b50230d1c3df34efaafc276ae Mon Sep 17 00:00:00 2001 From: Oren Leiman Date: Thu, 12 Sep 2024 16:24:20 -0700 Subject: [PATCH] c/feature_manager: Generate an enterprise features report Also refactor feature_manager::license_required_feature_enabled to use the report rather than calculating feature status on its own. Signed-off-by: Oren Leiman --- src/v/cluster/BUILD | 1 + src/v/cluster/CMakeLists.txt | 1 + src/v/cluster/feature_manager.cc | 34 +++++++++++++++++++++++++------- src/v/cluster/feature_manager.h | 3 +++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/v/cluster/BUILD b/src/v/cluster/BUILD index 84dbce9fe7120..af48b21fe5358 100644 --- a/src/v/cluster/BUILD +++ b/src/v/cluster/BUILD @@ -593,6 +593,7 @@ redpanda_cc_library( "//src/v/container:fragmented_vector", "//src/v/container:intrusive", "//src/v/features", + "//src/v/features:enterprise_features", "//src/v/finjector", "//src/v/hashing:murmur", "//src/v/hashing:secure", diff --git a/src/v/cluster/CMakeLists.txt b/src/v/cluster/CMakeLists.txt index 1f50bec1fe488..8b6ce64006104 100644 --- a/src/v/cluster/CMakeLists.txt +++ b/src/v/cluster/CMakeLists.txt @@ -273,6 +273,7 @@ v_cc_library( v::cluster_topic_properties v::features v::version + v::enterprise_features ) add_subdirectory(tests) add_subdirectory(cloud_metadata/tests) diff --git a/src/v/cluster/feature_manager.cc b/src/v/cluster/feature_manager.cc index a2d34f949c193..5eef5df8ec8f6 100644 --- a/src/v/cluster/feature_manager.cc +++ b/src/v/cluster/feature_manager.cc @@ -195,6 +195,11 @@ ss::future<> feature_manager::stop() { } bool feature_manager::license_required_feature_enabled() const { + return report_enterprise_features().any(); +} + +features::enterprise_feature_report +feature_manager::report_enterprise_features() const { const auto& cfg = config::shard_local_cfg(); const auto& node_cfg = config::node(); auto has_gssapi = [&cfg]() { @@ -205,7 +210,7 @@ bool feature_manager::license_required_feature_enabled() const { return config::oidc_is_enabled_kafka() || config::oidc_is_enabled_http(); }; - auto has_schma_id_validation = [&cfg]() { + auto has_schema_id_validation = [&cfg]() { return cfg.enable_schema_id_validation() != pandaproxy::schema_registry::schema_id_validation_mode::none; }; @@ -219,12 +224,27 @@ bool feature_manager::license_required_feature_enabled() const { = n_roles >= 2 || (n_roles == 1 && !_role_store.local().contains(security::default_role)); - return cfg.audit_enabled || cfg.cloud_storage_enabled - || cfg.partition_autobalancing_mode - == model::partition_autobalancing_mode::continuous - || cfg.core_balancing_continuous() || has_gssapi() || has_oidc() - || has_schma_id_validation() || has_non_default_roles - || fips_enabled(); + features::enterprise_feature_report report; + report.set( + features::license_required_feature::audit_logging, cfg.audit_enabled()); + report.set( + features::license_required_feature::cloud_storage, + cfg.cloud_storage_enabled()); + report.set( + features::license_required_feature::partition_auto_balancing_continuous, + cfg.partition_autobalancing_mode() + == model::partition_autobalancing_mode::continuous); + report.set( + features::license_required_feature::core_balancing_continuous, + cfg.core_balancing_continuous()); + report.set(features::license_required_feature::gssapi, has_gssapi()); + report.set(features::license_required_feature::oidc, has_oidc()); + report.set( + features::license_required_feature::schema_id_validation, + has_schema_id_validation()); + report.set(features::license_required_feature::rbac, has_non_default_roles); + report.set(features::license_required_feature::fips, fips_enabled()); + return report; } ss::future<> feature_manager::maybe_log_license_check_info() { diff --git a/src/v/cluster/feature_manager.h b/src/v/cluster/feature_manager.h index 6681e1b6f85e2..4da4d6b90e098 100644 --- a/src/v/cluster/feature_manager.h +++ b/src/v/cluster/feature_manager.h @@ -15,6 +15,7 @@ #include "cluster/feature_barrier.h" #include "cluster/fwd.h" #include "cluster/types.h" +#include "features/enterprise_features.h" #include "raft/notification.h" #include "security/fwd.h" @@ -98,6 +99,8 @@ class feature_manager { ss::future update_license(security::license&& license); + features::enterprise_feature_report report_enterprise_features() const; + private: void update_node_version(model::node_id, cluster_version v);