Skip to content

Commit

Permalink
c/feature_manager: Generate an enterprise features report
Browse files Browse the repository at this point in the history
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 <oren.leiman@redpanda.com>
  • Loading branch information
oleiman committed Sep 17, 2024
1 parent bf972c0 commit 067df42
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/v/cluster/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/v/cluster/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
34 changes: 27 additions & 7 deletions src/v/cluster/feature_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]() {
Expand All @@ -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;
};
Expand All @@ -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() {
Expand Down
3 changes: 3 additions & 0 deletions src/v/cluster/feature_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -98,6 +99,8 @@ class feature_manager {

ss::future<std::error_code> update_license(security::license&& license);

features::enterprise_feature_report report_enterprise_features() const;

private:
void update_node_version(model::node_id, cluster_version v);

Expand Down

0 comments on commit 067df42

Please sign in to comment.