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

Refactor hard-coded configuration strings into const variables to improve code readability and extensibility #917

Merged
merged 11 commits into from
Feb 22, 2023

Conversation

panyuenlau
Copy link
Member

@panyuenlau panyuenlau commented Jan 17, 2023

Q A
Bug fix? no
New feature? no
API breaks? no
Deprecations? no
License Apache 2.0

What's in this PR?

Noticed that the current implementation sets a bunch of hard-coded strings for Kafka and Cruise Control configurations, and I think it's more readable and bug-prune for all the Kafka and Cruise Control configurations to be grouped together in a file so we can use them in the source code

Note: didn't really update the test because I think the tests are fine to use hard-coded strings as they are now

Why?

Concepts that are closely related should be kept vertically close to each other

Test

Test with both internal and external listeners with plaintext, didn't get to test all the security protocols - but triple compared the hard-coded strings with the newly created consts

@panyuenlau panyuenlau changed the title Refactor hard-coded configuration strings into const variables to improve code readability Refactor hard-coded configuration strings into const variables to improve code readability and extensibility Jan 18, 2023
@pregnor
Copy link
Member

pregnor commented Feb 2, 2023

Friendly ping, when to expect this to be finished. (No pressure just informational.)

@panyuenlau
Copy link
Member Author

panyuenlau commented Feb 2, 2023

Friendly ping, when to expect this to be finished. (No pressure just informational.)

The refactoring itself is pretty much done, the main purpose for the refactoring is to prepare for the KRaft support so things won't look even messier when we add the KRaft.

I will just need to do some manual testings to ensure I'm not breaking anything here due to some stupid mistakes

@panyuenlau panyuenlau mentioned this pull request Feb 14, 2023
4 tasks
@panyuenlau panyuenlau marked this pull request as ready for review February 16, 2023 21:03
@panyuenlau panyuenlau requested a review from a team as a code owner February 16, 2023 21:03
pregnor
pregnor previously approved these changes Feb 17, 2023
Copy link
Member

@pregnor pregnor left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for this.

pkg/util/kafka/const.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Kuvesz Kuvesz left a comment

Choose a reason for hiding this comment

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

Looks good, thanks a lot! :)

@panyuenlau panyuenlau merged commit 5fd77be into master Feb 22, 2023
@panyuenlau panyuenlau deleted the refactor branch February 22, 2023 13:53
@panyuenlau panyuenlau mentioned this pull request Jul 27, 2023
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants