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

[DPE-2198] Integrate sysctl lib #118

Merged
merged 12 commits into from
Aug 8, 2023
Merged

Conversation

zmraul
Copy link
Contributor

@zmraul zmraul commented Jul 7, 2023

Integrate sysctl lib into Kafka charm.

Proposed "default" values for os config are:

OS_REQUIREMENTS = {
    "vm.max_map_count": "262144",
    "vm.swappiness": "1",
    "vm.dirty_ratio": "80",
    "vm.dirty_background_ratio": "5",
}

@zmraul zmraul requested review from deusebio and rgildein July 7, 2023 13:14
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
Copy link

@rgildein rgildein left a comment

Choose a reason for hiding this comment

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

I think this is good, there is only one issue with charm config, which should be removed if anything failed.

lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
Copy link
Contributor

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

First pass.

I have two major points:

  1. I would try to re-write slightly the business logic for update to make validation in memory and keep the status as clean as possible. I have a proposal in the comments that I believe would make things more robust.
  2. I believe it would be best to encode in the library the removal of charm_filepath (and possibly creation, even with just empty content, just to make sure it is written in the header of the merged sysctl file). For doing this we should add some handlers to _on_install and _on_remove events (such that this is done by default and charm authors do not forget)

lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
lib/charms/operator_libs_linux/v0/sysctl.py Outdated Show resolved Hide resolved
@zmraul zmraul marked this pull request as ready for review July 27, 2023 08:11
Copy link
Contributor

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@rgildein rgildein 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 to me, thanks for cooperation.

src/charm.py Outdated Show resolved Hide resolved
@zmraul zmraul merged commit db3fe14 into main Aug 8, 2023
6 checks passed
@zmraul zmraul deleted the feature/dpe-2198-integrate-sysctl branch August 8, 2023 07:48
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