Skip to content

Commit

Permalink
redpanda: remove _redpanda_enabled=false mode
Browse files Browse the repository at this point in the history
This was the code path for running schema registry
outside of a redpanda cluster.  Once we always
run schema registry inside a redpanda cluster,
this is no longer necessary.
  • Loading branch information
jcsp committed May 31, 2022
1 parent fc746f8 commit 110044c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 42 deletions.
78 changes: 37 additions & 41 deletions src/v/redpanda/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,36 +342,39 @@ void application::hydrate_config(const po::variables_map& cfg) {
}
};

_redpanda_enabled = config["redpanda"].IsDefined();
if (_redpanda_enabled) {
ss::smp::invoke_on_all([&config, cfg_path] {
config::node().load(cfg_path, config);
}).get0();

auto node_config_errors = config::node().load(config);
for (const auto& i : node_config_errors) {
vlog(
_log.warn,
"Node property '{}' validation error: {}",
i.first,
i.second);
}
if (node_config_errors.size() > 0) {
throw std::invalid_argument("Validation errors in node config");
}

// This includes loading from local bootstrap file or legacy
// config file on first-start or upgrade cases.
_config_preload = cluster::config_manager::preload(config).get0();
ss::smp::invoke_on_all([&config, cfg_path] {
config::node().load(cfg_path, config);
}).get0();

vlog(_log.info, "Cluster configuration properties:");
vlog(_log.info, "(use `rpk cluster config edit` to change)");
config_printer("redpanda", config::shard_local_cfg());
auto node_config_errors = config::node().load(config);
for (const auto& i : node_config_errors) {
vlog(
_log.warn,
"Node property '{}' validation error: {}",
i.first,
i.second);
}

vlog(_log.info, "Node configuration properties:");
vlog(_log.info, "(use `rpk config set <cfg> <value>` to change)");
config_printer("redpanda", config::node());
if (node_config_errors.size() > 0) {
throw std::invalid_argument("Validation errors in node config");
}

// This includes loading from local bootstrap file or legacy
// config file on first-start or upgrade cases.
_config_preload = cluster::config_manager::preload(config).get0();

// This includes loading from local bootstrap file or legacy
// config file on first-start or upgrade cases.
_config_preload = cluster::config_manager::preload(config).get0();

vlog(_log.info, "Cluster configuration properties:");
vlog(_log.info, "(use `rpk cluster config edit` to change)");
config::shard_local_cfg().for_each(config_printer("redpanda"));

vlog(_log.info, "Node configuration properties:");
vlog(_log.info, "(use `rpk config set <cfg> <value>` to change)");
config::node().for_each(config_printer("redpanda"));

if (config["pandaproxy"]) {
_proxy_config.emplace(config["pandaproxy"]);
if (config["pandaproxy_client"]) {
Expand Down Expand Up @@ -403,11 +406,9 @@ void application::check_environment() {
syschecks::systemd_message("checking environment (CPU, Mem)").get();
syschecks::cpu();
syschecks::memory(config::node().developer_mode());
if (_redpanda_enabled) {
storage::directories::initialize(
config::node().data_directory().as_sstring())
.get();
}
storage::directories::initialize(
config::node().data_directory().as_sstring())
.get();
}

static admin_server_cfg
Expand Down Expand Up @@ -561,9 +562,8 @@ make_upload_controller_config(ss::scheduling_group sg) {

// add additional services in here
void application::wire_up_services() {
if (_redpanda_enabled) {
wire_up_redpanda_services();
}
wire_up_redpanda_services();

if (_proxy_config) {
construct_service(_proxy_client, to_yaml(*_proxy_client_config)).get();
construct_service(
Expand Down Expand Up @@ -1110,9 +1110,7 @@ application::set_proxy_client_config(ss::sstring name, std::any val) {
}

void application::start(::stop_signal& app_signal) {
if (_redpanda_enabled) {
start_redpanda(app_signal);
}
start_redpanda(app_signal);

if (_proxy_config) {
_proxy.invoke_on_all(&pandaproxy::rest::proxy::start).get();
Expand All @@ -1130,9 +1128,7 @@ void application::start(::stop_signal& app_signal) {
_schema_reg_config->schema_registry_api());
}

if (_redpanda_enabled) {
start_kafka(app_signal);
}
start_kafka(app_signal);

_admin.invoke_on_all([](admin_server& admin) { admin.set_ready(); }).get();

Expand Down
1 change: 0 additions & 1 deletion src/v/redpanda/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class application {

void setup_metrics();
std::unique_ptr<ss::app_template> _app;
bool _redpanda_enabled{true};
cluster::config_manager::preload_result _config_preload;
std::optional<pandaproxy::rest::configuration> _proxy_config;
std::optional<kafka::client::configuration> _proxy_client_config;
Expand Down

0 comments on commit 110044c

Please sign in to comment.