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

settings: add updates settings extension #3689

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/settings-updates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "settings-updates"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
source-groups = [
"settings-extensions/updates"
]

# RPM BuildRequires
[build-dependencies]
glibc = { path = "../glibc" }

# RPM Requires
[dependencies]
39 changes: 39 additions & 0 deletions packages/settings-updates/settings-updates.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%global _cross_first_party 1
%undefine _debugsource_packages

%global extension_name updates

Name: %{_cross_os}settings-%{extension_name}
Version: 0.0
Release: 0%{?dist}
Summary: settings-%{extension_name}
License: Apache-2.0 OR MIT
URL: /~https://github.com/bottlerocket-os/bottlerocket

BuildRequires: %{_cross_os}glibc-devel

%description
%{summary}.

%prep
%setup -T -c
%cargo_prep

%build
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p settings-extension-%{extension_name}

%install
install -d %{buildroot}%{_cross_libexecdir}
install -p -m 0755 \
${HOME}/.cache/%{__cargo_target}/release/settings-extension-%{extension_name} \
%{buildroot}%{_cross_libexecdir}

install -d %{buildroot}%{_cross_libexecdir}/settings
ln -sf \
../settings-extension-%{extension_name} \
%{buildroot}%{_cross_libexecdir}/settings/%{extension_name}

%files
%{_cross_libexecdir}/settings-extension-%{extension_name}
%{_cross_libexecdir}/settings/%{extension_name}
16 changes: 15 additions & 1 deletion sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ members = [
"settings-extensions/motd",
"settings-extensions/ntp",
"settings-extensions/container-registry",
"settings-extensions/updates",

"parse-datetime",

Expand Down
4 changes: 3 additions & 1 deletion sources/api/bork/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ publish = false
exclude = ["README.md"]

[dependencies]
rand = "0.8"
serde_json = "1"

# generation logic moved to updates settings extension
settings-extension-updates = { path = "../../settings-extensions/updates", version = "0.1" }
5 changes: 1 addition & 4 deletions sources/api/bork/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use rand::{thread_rng, Rng};

fn main() {
let mut rng = thread_rng();
let val = rng.gen_range(0..2048);
let val = settings_extension_updates::generate::generate_seed();

// sundog expects JSON-serialized output so that many types can be represented, allowing the
// API model to use more accurate types.
Expand Down
1 change: 1 addition & 0 deletions sources/models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ toml = "0.5"
settings-extension-motd = { path = "../settings-extensions/motd", version = "0.1" }
settings-extension-ntp = { path = "../settings-extensions/ntp", version = "0.1" }
settings-extension-container-registry = { path = "../settings-extensions/container-registry", version = "0.1" }
settings-extension-updates = { path = "../settings-extensions/updates", version = "0.1" }

[build-dependencies]
bottlerocket-variant = { version = "0.1", path = "../bottlerocket-variant" }
Expand Down
3 changes: 1 addition & 2 deletions sources/models/src/aws-dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::collections::HashMap;
use crate::{
AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings, DnsSettings,
HostContainer, KernelSettings, MetricsSettings, NetworkSettings, OciHooks, PemCertificate,
UpdatesSettings,
};
use modeled_types::Identifier;

Expand All @@ -13,7 +12,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-ecs-1-nvidia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;
use crate::{
AutoScalingSettings, AwsSettings, BootstrapContainer, CloudFormationSettings, DnsSettings,
ECSSettings, HostContainer, KernelSettings, MetricsSettings, NetworkSettings, OciDefaults,
OciHooks, PemCertificate, UpdatesSettings,
OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -13,7 +13,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-ecs-1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;
use crate::{
AutoScalingSettings, AwsSettings, BootstrapContainer, CloudFormationSettings, DnsSettings,
ECSSettings, HostContainer, KernelSettings, MetricsSettings, NetworkSettings, OciDefaults,
OciHooks, PemCertificate, UpdatesSettings,
OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -13,7 +13,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-ecs-2-nvidia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, ECSSettings, HostContainer, KernelSettings, MetricsSettings, NetworkSettings,
OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -13,7 +13,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-ecs-2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, ECSSettings, HostContainer, KernelSettings, MetricsSettings, NetworkSettings,
OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -13,7 +13,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.24-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, HostContainer, KernelSettings, KubernetesSettings, MetricsSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.24/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, DnsSettings, HostContainer, KernelSettings, KubernetesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.25-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, HostContainer, KernelSettings, KubernetesSettings, MetricsSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.25/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, DnsSettings, HostContainer, KernelSettings, KubernetesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.26-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, HostContainer, KernelSettings, KubernetesSettings, MetricsSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.26/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, DnsSettings, HostContainer, KernelSettings, KubernetesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.28-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
DnsSettings, HostContainer, KernelSettings, KubernetesSettings, MetricsSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/aws-k8s-1.28/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AutoScalingSettings, AwsSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, DnsSettings, HostContainer, KernelSettings, KubernetesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate, UpdatesSettings,
MetricsSettings, NetworkSettings, OciDefaults, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -14,7 +14,7 @@ use std::collections::HashMap;
struct Settings {
motd: settings_extension_motd::MotdV1,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
4 changes: 2 additions & 2 deletions sources/models/src/metal-dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;

use crate::{
BootSettings, BootstrapContainer, DnsSettings, HostContainer, KernelSettings, MetricsSettings,
NetworkSettings, OciHooks, PemCertificate, UpdatesSettings,
NetworkSettings, OciHooks, PemCertificate,
};
use modeled_types::Identifier;

Expand All @@ -12,7 +12,7 @@ use modeled_types::Identifier;
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: settings_extension_motd::MotdV1,
updates: UpdatesSettings,
updates: settings_extension_updates::UpdatesSettingsV1,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: settings_extension_ntp::NtpSettingsV1,
Expand Down
Loading