Skip to content

settings: add merge-default-eviction-settings and kernel.zram.size - #4991

Merged
ginglis13 merged 4 commits into
bottlerocket-os:developfrom
qianxjcraig:br4916-settings-032-20261030
Nov 7, 2026
Merged

ginglis13 merged 4 commits into
bottlerocket-os:developfrom
qianxjcraig:br4916-settings-032-20261030

Conversation

@qianxjcraig

@qianxjcraig qianxjcraig commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue number:

Related: #4916, #4903

Description of changes:

Bump bottlerocket-settings-models to v0.33.0, and add migrations and defaults for:

Depends on:

Testing done:

cargo test --locked --workspace passes, and the merged aws-k8s-1.35 defaults contain the zram service.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Signed-off-by: Craig Qian <qianxj@amazon.com>
Signed-off-by: Craig Qian <qianxj@amazon.com>
Render settings.kernel.zram changes into corndog.toml without restarting
swap preparation. The new capacity takes effect after reboot.

Signed-off-by: Craig Qian <qianxj@amazon.com>
Remove the zram settings and service on downgrade.

Signed-off-by: Craig Qian <qianxj@amazon.com>
@qianxjcraig
qianxjcraig force-pushed the br4916-settings-032-20261030 branch from 97b7e64 to 5f14f8b Compare November 6, 2026 23:54
@qianxjcraig

Copy link
Copy Markdown
Contributor Author

Rebased #4991 on develop after #4974

@qianxjcraig

qianxjcraig commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Tested upgrade and downgrade on aws-k8s-1.35 (x86_64), with images built locally against core-kit from develop.

1.68.1 -> 1.69.0

$ apiclient get os.version_id
"version_id": "1.69.0"
$ journalctl -b -u migrator
migrator: Running migration 'migrate_v1.69.0_kubernetes-merge-default-eviction-settings.lz4'
migrator: Running migration 'migrate_v1.69.0_kernel-zram-size.lz4'
systemd: Finished Bottlerocket data store migrator.
$ apiclient get services.zram
{"services": {"zram": {"configuration-files": ["corndog-toml"], "restart-commands": []}}}
$ cat /sys/block/zram0/disksize
1073741824
$ systemctl is-system-running
running

1.69.0 -> 1.68.1 (after setting kernel.zram.size=512Mi and kubernetes.merge-default-eviction-settings=true)

$ apiclient get os.version_id
"version_id": "1.68.1"
$ journalctl -b -u migrator
migrator: Running migration 'migrate_v1.69.0_kernel-zram-size.lz4'
migrator: Running migration 'migrate_v1.69.0_kubernetes-merge-default-eviction-settings.lz4'
systemd: Finished Bottlerocket data store migrator.
$ apiclient get settings.kernel.zram services.zram settings.kubernetes.merge-default-eviction-settings
{}
$ systemctl is-system-running
running

1.68.1: the new settings are rejected

$ apiclient set kernel.zram.size=512Mi
Failed to change settings: ... Status 400 ... unknown field `zram`, expected one of `lockdown`, `modules`, `sysctl`, `hugepages`, `drivers`
$ apiclient set kubernetes.merge-default-eviction-settings=true
Failed to change settings: ... Status 400 ... unknown field `merge-default-eviction-settings`, expected one of `cluster-name`, ...
$ apiclient get settings.kernel.zram settings.kubernetes.merge-default-eviction-settings
{}

Rendered config, 1.68.1

$ cat /etc/corndog.toml
lockdown = "integrity"
$ grep -i evict /etc/kubernetes/kubelet/config
(no output)

Rendered config, 1.69.0 (after setting kernel.zram.size=512Mi and kubernetes.merge-default-eviction-settings=true)

$ cat /etc/corndog.toml
lockdown = "integrity"

[zram]
size = "512Mi"
$ grep mergeDefaultEvictionSettings /etc/kubernetes/kubelet/config
mergeDefaultEvictionSettings: true

@qianxjcraig
qianxjcraig marked this pull request as ready for review November 7, 2026 00:09
"settings.kernel.zram",
"services.zram",
]))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You will need another migrations for the metadata. So another rust crate with main.rs containing this:

fn run() -> Result<()> {
    migrate(AddMetadataMigration(&[SettingMetadata {
        metadata: &["affected-services"],
        setting: "settings.kernel.zram",
    }]))
}

This is because you added this in the shared-defaults:

[metadata.settings.kernel.zram]
affected-services = ["zram"]

@piyush-jena piyush-jena left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

^

I was told that metadata migrations might not be required anymore. Can you please verify this?

@piyush-jena piyush-jena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nvm I verified

@ginglis13
ginglis13 merged commit 6c4f2cb into bottlerocket-os:develop Nov 7, 2026
3 checks passed
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