Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: add cluster configuration validation to redpanda preload process #25123

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

WillemKauf
Copy link
Contributor

@WillemKauf WillemKauf commented Feb 20, 2025

Follow up to idea here: #24987 (comment)

There existed a config_multi_property_validation() function in admin/server.cc, the purpose of which was to validate
the cluster config AFTER all updates made via the admin endpoint had been applied.

The other location where changes to the cluster config can be made is externally, in the config_cache.yaml file.
If a user were to modify this file with an invalid (per the rules of config_multi_property_validation()) configuration, it would not be caught until the next time the config was edited via the admin endpoint.

This PR moves config_multi_property_validation() into the static member function config::configuration::validate_config(). It is still used in admin/server.cc, but now it is also used in config/config_manager.cc to validate the cluster config set in the preload process.

If any invalid properties are set, they are reset to their default values at start-up.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.3.x
  • v24.2.x
  • v24.1.x

Release Notes

Improvements

  • Improves the validation for redpanda cluster configs by checking them at start-up.

@WillemKauf WillemKauf requested a review from a team as a code owner February 20, 2025 20:59
@dotnwat
Copy link
Member

dotnwat commented Feb 20, 2025

is this related to #24987 ?

…storage`

To be able to use it in the `configuration` library (otherwise,
a circular dependency is formed in the bazel BUILD).
@WillemKauf WillemKauf force-pushed the config_bootstrap_check branch from e6a597d to 66d3360 Compare February 20, 2025 21:08
@WillemKauf
Copy link
Contributor Author

is this related to #24987 ?

Yes, it is the idea I presented in my comment here: #24987 (comment)

@@ -772,4 +772,31 @@ bool development_feature_property<T>::development_features_enabled(

configuration& shard_local_cfg();

// TODO: Move to anonymous namespace
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO is addressed in the later commit here: 116cb04

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Feb 21, 2025

CI test results

test results on build#62074
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryTest.test_index_recovery ducktape https://buildkite.com/redpanda/redpanda/builds/62074#0195258c-e03e-45a9-8a38-0b5ff029165c FLAKY 1/2
rptest.tests.compaction_recovery_test.CompactionRecoveryTest.test_index_recovery ducktape https://buildkite.com/redpanda/redpanda/builds/62074#0195258f-9a23-4d2a-93b3-af84b10151fb FLAKY 1/4
rptest.tests.delete_records_test.DeleteRecordsTest.test_delete_records_concurrent_truncations.cloud_storage_enabled=True.truncate_point=start_offset ducktape https://buildkite.com/redpanda/redpanda/builds/62074#0195258c-e03d-44fa-b909-36409ac8f255 FLAKY 1/2
test results on build#62110
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryUpgradeTest.test_index_recovery_after_upgrade ducktape https://buildkite.com/redpanda/redpanda/builds/62110#01952a3c-a983-4032-a318-aa14ef292638 FLAKY 1/2

@WillemKauf
Copy link
Contributor Author

Requesting a review from an enterprise member as well 👍

@WillemKauf WillemKauf requested a review from oleiman February 21, 2025 14:08
oleiman
oleiman previously approved these changes Feb 21, 2025
Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks legit. just a few questions. nothing blocking i think

Moves the existing multi-property validation portion of the function
from `admin/server.cc` into `config::configuration` as a static member
function. The rest of the existing function which validate schema registry
and admin endpoint users is left in `admin/server.cc`.

This encapsulates the logic better, and also allows it to be re-used in
other parts of the code which need to perform validation on cluster configs.

Also, change in/out `std::map` parameters to a return struct, containing
a `set` of properties that need to be unset in case of a bad configuration,
as well as the `map` of properties and their corresponding errors.
To reject invalid configurations at start-up.
@WillemKauf
Copy link
Contributor Author

Force push to:

  • Amend commit message per request
  • Use fmt::join() in ::join_properties().

Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. i kinda feel like the whole exercise would be easier to make sense of if the first 4 commits were squashed into one, but that's just an aesthetic preference.

@WillemKauf
Copy link
Contributor Author

i kinda feel like the whole exercise would be easier to make sense of if the first 4 commits were squashed into one,

I'm still learning people's preferences on how commits should be split up 😅 will see if any other reviewers feel the same and I can edit the history from there.

@oleiman
Copy link
Member

oleiman commented Feb 21, 2025

i kinda feel like the whole exercise would be easier to make sense of if the first 4 commits were squashed into one,

I'm still learning people's preferences on how commits should be split up 😅 will see if any other reviewers feel the same and I can edit the history from there.

all good. totally your call at the end of the day 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants