Skip to content

Commit

Permalink
Merge pull request #4010 from mgsharm/cloudformation-settings-extension
Browse files Browse the repository at this point in the history
Cloudformation settings extension
  • Loading branch information
mgsharm authored May 31, 2024
2 parents b136a8b + a9a77d0 commit 948401d
Show file tree
Hide file tree
Showing 22 changed files with 252 additions and 44 deletions.
21 changes: 21 additions & 0 deletions packages/settings-cloudformation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "settings-cloudformation"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

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

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

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

# RPM Requires
[dependencies]
39 changes: 39 additions & 0 deletions packages/settings-cloudformation/settings-cloudformation.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 cloudformation

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}
13 changes: 13 additions & 0 deletions 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 @@ -130,6 +130,7 @@ members = [
"models",

"settings-extensions/aws",
"settings-extensions/cloudformation",
"settings-extensions/container-registry",
"settings-extensions/dns",
"settings-extensions/ecs",
Expand Down
1 change: 1 addition & 0 deletions sources/models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ toml = "0.8"

# settings extensions
settings-extension-aws = { path = "../settings-extensions/aws", version = "0.1" }
settings-extension-cloudformation = { path = "../settings-extensions/cloudformation", version = "0.1" }
settings-extension-container-registry = { path = "../settings-extensions/container-registry", version = "0.1" }
settings-extension-dns = { path = "../settings-extensions/dns", version = "0.1" }
settings-extension-ecs = { path = "../settings-extensions/ecs", version = "0.1" }
Expand Down
6 changes: 2 additions & 4 deletions sources/models/src/aws-dev/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use model_derive::model;
use std::collections::HashMap;

use crate::{
BootSettings, BootstrapContainer, CloudFormationSettings, HostContainer, NetworkSettings,
};
use crate::{BootSettings, BootstrapContainer, HostContainer, NetworkSettings};
use modeled_types::Identifier;

// Note: we have to use 'rename' here because the top-level Settings structure is the only one
Expand All @@ -23,6 +21,6 @@ struct Settings {
pki: settings_extension_pki::PkiSettingsV1,
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
}
7 changes: 2 additions & 5 deletions sources/models/src/aws-ecs-1-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use model_derive::model;
use std::collections::HashMap;

use crate::{
AutoScalingSettings, BootstrapContainer, CloudFormationSettings, HostContainer,
NetworkSettings, OciDefaults,
};
use crate::{AutoScalingSettings, BootstrapContainer, HostContainer, NetworkSettings, OciDefaults};
use modeled_types::Identifier;

// Note: we have to use 'rename' here because the top-level Settings structure is the only one
Expand All @@ -25,7 +22,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
autoscaling: AutoScalingSettings,
dns: settings_extension_dns::DnsSettingsV1,
}
7 changes: 2 additions & 5 deletions sources/models/src/aws-ecs-1/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use model_derive::model;
use std::collections::HashMap;

use crate::{
AutoScalingSettings, BootstrapContainer, CloudFormationSettings, HostContainer,
NetworkSettings, OciDefaults,
};
use crate::{AutoScalingSettings, BootstrapContainer, HostContainer, NetworkSettings, OciDefaults};
use modeled_types::Identifier;

// Note: we have to use 'rename' here because the top-level Settings structure is the only one
Expand All @@ -25,7 +22,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
autoscaling: AutoScalingSettings,
dns: settings_extension_dns::DnsSettingsV1,
}
6 changes: 3 additions & 3 deletions sources/models/src/aws-ecs-2-nvidia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use model_derive::model;
use std::collections::HashMap;

use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings, HostContainer,
NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, HostContainer, NetworkSettings,
OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
autoscaling: AutoScalingSettings,
dns: settings_extension_dns::DnsSettingsV1,
}
6 changes: 3 additions & 3 deletions sources/models/src/aws-ecs-2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use model_derive::model;
use std::collections::HashMap;

use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings, HostContainer,
NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, HostContainer, NetworkSettings,
OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
autoscaling: AutoScalingSettings,
dns: settings_extension_dns::DnsSettingsV1,
}
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.24-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.24/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.25-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.25/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.26-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.26/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.30-nvidia/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
6 changes: 3 additions & 3 deletions sources/models/src/aws-k8s-1.30/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
AutoScalingSettings, BootSettings, BootstrapContainer, CloudFormationSettings,
ContainerRuntimeSettings, HostContainer, KubernetesSettings, NetworkSettings, OciDefaults,
AutoScalingSettings, BootSettings, BootstrapContainer, ContainerRuntimeSettings, HostContainer,
KubernetesSettings, NetworkSettings, OciDefaults,
};
use modeled_types::Identifier;

Expand All @@ -26,7 +26,7 @@ struct Settings {
container_registry: settings_extension_container_registry::RegistrySettingsV1,
oci_defaults: OciDefaults,
oci_hooks: settings_extension_oci_hooks::OciHooksSettingsV1,
cloudformation: CloudFormationSettings,
cloudformation: settings_extension_cloudformation::CloudFormationSettingsV1,
dns: settings_extension_dns::DnsSettingsV1,
container_runtime: ContainerRuntimeSettings,
autoscaling: AutoScalingSettings,
Expand Down
19 changes: 19 additions & 0 deletions sources/settings-extensions/cloudformation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "settings-extension-cloudformation"
version = "0.1.0"
authors = ["Gaurav Sharma <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false

[dependencies]
env_logger = "0.10"
modeled-types = { path = "../../models/modeled-types", version = "0.1" }
model-derive = { path = "../../models/model-derive", version = "0.1" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

[dependencies.bottlerocket-settings-sdk]
git = "https://github.com/bottlerocket-os/bottlerocket-settings-sdk"
tag = "bottlerocket-settings-sdk-v0.1.0-alpha.2"
version = "0.1.0-alpha"
13 changes: 13 additions & 0 deletions sources/settings-extensions/cloudformation/cloudformation.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[extension]
supported-versions = [
"v1"
]
default-version = "v1"

[v1]
[v1.validation.cross-validates]

[v1.templating]
helpers = []

[v1.generation.requires]
Loading

0 comments on commit 948401d

Please sign in to comment.