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

static-pods: remove conditional compilation #3891

Merged
merged 3 commits into from
Apr 19, 2024
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
2 changes: 2 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,6 @@ version = "1.20.0"
"migrate_v1.20.0_update-ecs-config-path.lz4",
"migrate_v1.20.0_update-ecs-config-template-path.lz4",
"migrate_v1.20.0_add-ntp-default-options-v0-1-0.lz4",
"migrate_v1.20.0_static-pods-add-prefix-v0-1-0.lz4",
"migrate_v1.20.0_static-pods-services-cfg-v0-1-0.lz4",
]
1 change: 1 addition & 0 deletions packages/kubernetes-1.23/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider = { path = "../ecr-credential-provider" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.23/kubernetes-1.23.spec
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.23
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.24/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider = { path = "../ecr-credential-provider" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.24/kubernetes-1.24.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.24
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.25/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider = { path = "../ecr-credential-provider" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.25/kubernetes-1.25.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.25
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.26/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider = { path = "../ecr-credential-provider" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.26/kubernetes-1.26.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.26
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.27/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider-1_27 = { path = "../ecr-credential-provider-1.27" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.27/kubernetes-1.27.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider-1.27
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.27
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.28/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider-1_27 = { path = "../ecr-credential-provider-1.27" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.28/kubernetes-1.28.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider-1.27
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.28
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.29/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider-1_29 = { path = "../ecr-credential-provider-1.29" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.29/kubernetes-1.29.spec
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Requires: %{_cross_os}containerd
Requires: %{_cross_os}findutils
Requires: %{_cross_os}ecr-credential-provider-1.29
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.29
%{summary}.
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.30/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ glibc = { path = "../glibc" }
[dependencies]
aws-signing-helper = { path = "../aws-signing-helper" }
ecr-credential-provider-1_29 = { path = "../ecr-credential-provider-1.29" }
static-pods = { path = "../static-pods" }
# `conntrack-tools`, `containerd` and `findutils` are only needed at runtime,
# and are pulled in by `release`.
# conntrack-tools = { path = "../conntrack-tools" }
Expand Down
1 change: 1 addition & 0 deletions packages/kubernetes-1.30/kubernetes-1.30.spec
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Requires: %{_cross_os}findutils
# TODO: update to ecr-credential-provider-1.30
Requires: %{_cross_os}ecr-credential-provider-1.29
Requires: %{_cross_os}aws-signing-helper
Requires: %{_cross_os}static-pods

%description -n %{_cross_os}kubelet-1.30
%{summary}.
Expand Down
18 changes: 0 additions & 18 deletions packages/os/os.spec
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ Requires: %{_cross_os}updog
Requires: %{_cross_os}pluto
%endif

%if %{with k8s_runtime}
Requires: %{_cross_os}static-pods
%endif

%if %{with aws_platform}
Requires: %{_cross_os}shibaken
Requires: %{_cross_os}cfsignal
Expand Down Expand Up @@ -244,13 +240,6 @@ Summary: Dynamic setting generator for kubernetes
%{summary}.
%endif

%if %{with k8s_runtime}
%package -n %{_cross_os}static-pods
Summary: Manages user-defined K8S static pods
%description -n %{_cross_os}static-pods
%{summary}.
%endif

%if %{with aws_platform}
%package -n %{_cross_os}shibaken
Summary: Run tasks reliant on IMDS
Expand Down Expand Up @@ -384,7 +373,6 @@ echo "** Output from non-static builds:"
-p bloodhound \
-p xfscli \
%{?with_aws_platform: -p shibaken} \
%{?with_k8s_runtime: -p static-pods} \
%{?with_nvidia_flavor: -p driverdog} \
%{nil}

Expand Down Expand Up @@ -418,7 +406,6 @@ for p in \
ghostdog bootstrap-containers \
shimpei bloodhound bottlerocket-checks \
%{?with_aws_platform: shibaken} \
%{?with_k8s_runtime: static-pods} \
%{?with_nvidia_flavor: driverdog} \
; do
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/${p} %{buildroot}%{_cross_bindir}
Expand Down Expand Up @@ -699,11 +686,6 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
%{_cross_datadir}/eks/eni-max-pods
%endif

%if %{with k8s_runtime}
%files -n %{_cross_os}static-pods
%{_cross_bindir}/static-pods
%endif

%files -n %{_cross_os}shimpei
%{_cross_bindir}/shimpei
%{_cross_templatedir}/oci-default-hooks-json
Expand Down
19 changes: 19 additions & 0 deletions packages/static-pods/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "static-pods"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[package.metadata.build-package]
source-groups = [
"api/static-pods"
]
Comment on lines +8 to +11
Copy link
Contributor

Choose a reason for hiding this comment

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

If static-pods no longer depends on the API, it should move out from under sources/api so that this package can watch the specific directory (sources/static-pods) and so that changes don't also trigger a rebuild of os.


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

jmt-lab marked this conversation as resolved.
Show resolved Hide resolved
[build-dependencies]
glibc = { path = "../glibc" }

[dependencies]
15 changes: 15 additions & 0 deletions packages/static-pods/static-pods-toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[required-extensions]
kubernetes = "v1"
std = { version = "v1", helpers = ["if_not_null"] }
+++
{{#if_not_null settings.kubernetes.static-pods}}
{{#each settings.kubernetes.static-pods}}
["{{@key}}"]
{{#if_not_null this.enabled}}
enabled = {{this.enabled}}
{{/if_not_null}}
{{#if_not_null this.manifest}}
manifest = "{{{this.manifest}}}"
{{/if_not_null}}
{{/each}}
{{/if_not_null}}
38 changes: 38 additions & 0 deletions packages/static-pods/static-pods.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%global _cross_first_party 1
%undefine _debugsource_packages

Name: %{_cross_os}static-pods
Version: 0.0
Release: 0%{?dist}
Summary: Manages user-defined K*S static pods
License: Apache-2.0 OR MIT
URL: https://github.com/bottlerocket-os/bottlerocket

Source0: static-pods-toml

BuildRequires: %{_cross_os}glibc-devel

%description
%{summary}.

%prep
%setup -T -c
%cargo_prep

%build
mkdir bin

echo "** Compile static-pods agent"
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p static-pods

%install
install -d %{buildroot}%{_cross_bindir}
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/static-pods %{buildroot}%{_cross_bindir}

install -d %{buildroot}%{_cross_templatedir}
install -p -m 0644 %{S:0} %{buildroot}%{_cross_templatedir}

%files
%{_cross_bindir}/static-pods
%{_cross_templatedir}/static-pods-toml
22 changes: 17 additions & 5 deletions sources/Cargo.lock

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

2 changes: 2 additions & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ members = [
"api/migration/migrations/v1.20.0/update-ecs-config-path",
"api/migration/migrations/v1.20.0/update-ecs-config-template-path",
"api/migration/migrations/v1.20.0/add-ntp-default-options-v0-1-0",
"api/migration/migrations/v1.20.0/static-pods-add-prefix-v0-1-0",
"api/migration/migrations/v1.20.0/static-pods-services-cfg-v0-1-0",

"bloodhound",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "static-pods-add-prefix-v0-1-0"
version = "0.1.0"
authors = ["Jarrett Tierney <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use migration_helpers::common_migrations::AddPrefixesMigration;
use migration_helpers::{migrate, Result};
use std::process;

fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"configuration-files.static-pods-toml",
]))
}

fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "static-pods-services-cfg-v0-1-0"
version = "0.1.0"
authors = ["Jarrett Tierney <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" }
jmt-lab marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use migration_helpers::common_migrations::{ListReplacement, ReplaceListsMigration};
use migration_helpers::{migrate, Result};
use std::process;

fn run() -> Result<()> {
migrate(ReplaceListsMigration(vec![ListReplacement {
setting: "services.static-pods.configuration-files",
old_vals: &[],
new_vals: &["static-pods-toml"],
}]))
}

fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
8 changes: 3 additions & 5 deletions sources/api/static-pods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ build = "build.rs"
exclude = ["README.md"]

[dependencies]
constants = { path = "../../constants", version = "0.1" }
base64 = "0.21"
log = "0.4"
models = { path = "../../models", version = "0.1" }
schnauzer = { path = "../schnauzer", version = "0.1" }
modeled-types = { path = "../../models/modeled-types", version = "0.1" }
serde = { version = "1", features = ["default"]}
simplelog = "0.12"
snafu = "0.8"
tokio = { version = "~1.32", default-features = false, features = ["macros", "rt-multi-thread", "time"] } # LTS
toml = "0.8"
tempfile = "3"

[build-dependencies]
bottlerocket-variant = { version = "0.1", path = "../../bottlerocket-variant" }
generate-readme = { version = "0.1", path = "../../generate-readme" }
6 changes: 1 addition & 5 deletions sources/api/static-pods/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use bottlerocket_variant::Variant;

fn main() {
let variant = Variant::from_env().unwrap();
variant.emit_cfgs();
generate_readme::from_file("src/static_pods.rs").unwrap();
generate_readme::from_main().unwrap();
}
Loading