bottlerocket-os / bottlerocket

An operating system designed for hosting containers
https://bottlerocket.dev
Other
8.78k stars 519 forks source link

Settings extension #4050

Closed mgsharm closed 5 months ago

mgsharm commented 5 months ago

Issue number:

Closes #3651 #3652 #3650 #3663 #3666 #3664

Description of changes:

Testing done:

bootstrap_containers

cargo run proto1 set --setting-version v1 --value '{"mybootstrap":{"source":"uri.to.container.in.oci-compatible-registry.example.com/foo:1.0.0","mode":"once","user-data":"dXNlcmRhdGE=","essential":true}}' 
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
     Running `/Users/mgsharm/bottlerocket/bottlerocket/sources/target/debug/settings-extension-bootstrap-container proto1 set --setting-version v1 --value '{"mybootstrap":{"source":"uri.to.container.in.oci-compatible-registry.example.com/foo:1.0.0","mode":"once","user-data":"dXNlcmRhdGE=","essential":true}}'`

network

cargo run proto1 set --setting-version v1 --value '{"should-wait":true}'
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
     Running `/Users/mgsharm/bottlerocket/bottlerocket/sources/target/debug/settings-extension-autoscaling proto1 set --setting-version v1 --value '{"should-wait":true}'`

host_containers

cargo run proto1 set --setting-version v1 --value '{"foo":{"source":"public.ecr.aws/example/example","enabled":true,"superpowered":true,"user-data":"Zm9vCg=="}}'
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.73s
     Running `/Users/mgsharm/bottlerocket/bottlerocket/sources/target/debug/settings-extension-host-containers proto1 set --setting-version v1 --value '{"foo":{"source":"public.ecr.aws/example/example","enabled":true,"superpowered":true,"user-data":"Zm9vCg=="}}'`

autoscaling

cargo run proto1 set --setting-version v1 --value '{"hostname":"foo","hosts":[["127.0.0.1",["localhost"]]],"https-proxy":"https://example.net","no-proxy":["foo"]}'
   Compiling settings-extension-network v0.1.0 (/Users/mgsharm/bottlerocket/bottlerocket/sources/settings-extensions/network)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.75s
     Running `/Users/mgsharm/bottlerocket/bottlerocket/sources/target/debug/settings-extension-network proto1 set --setting-version v1 --value '{"hostname":"foo","hosts":[["127.0.0.1",["localhost"]]],"https-proxy":"https://example.net","no-proxy":["foo"]}'`

conatiner_runtime

cargo run proto1 set --setting-version v1 --value '{"max-container-log-line-size":1024,"max-concurrent-downloads":5,"enable-unprivileged-ports":true,"enable-unprivileged-icmp":false}'
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s
     Running `/Users/gauravsharma/Work/bottlerocket/sources/target/debug/settings-extension-container-runtime proto1 set --setting-version v1 --value '{"max-container-log-line-size":1024,"max-concurrent-downloads":5,"enable-unprivileged-ports":true,"enable-unprivileged-icmp":false}'`

oci_defaults

cargo run proto1 set --setting-version v1 --value '{"capabilities":{"sys-admin":true,"net-admin":false},"resource-limits":{"max-cpu-time":{"hard-limit":1000,"soft-limit":500}}}'

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.32s
     Running `/Users/gauravsharma/Work/bottlerocket/sources/target/debug/settings-extension-oci-defaults proto1 set --setting-version v1 --value '{"capabilities":{"sys-admin":true,"net-admin":false},"resource-limits":{"max-cpu-time":{"hard-limit":1000,"soft-limit":500}}}'`

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.

sumukhballal commented 5 months ago

Would you be able to do some instance testing as well? Just to be sure everything boots as expected since we are touching bootstrap_containers & host_containers .

mgsharm commented 5 months ago

Addressed comments.