Skip to content

Commit

Permalink
bootstrap-containers: migrate to using configuration file
Browse files Browse the repository at this point in the history
This migrates the bootstrap-containers tool to fetch its settings via a generated toml file.

log:
* add migrations and package changes
* migrate bootstrap-containers to load from config file
* add mount with secret_t
  • Loading branch information
jmt-lab committed Mar 27, 2024
1 parent cf8f2b7 commit bcfb715
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 108 deletions.
2 changes: 2 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,6 @@ version = "1.20.0"
"migrate_v1.20.0_host-containers-config-list-v0-1-0.lz4",
"migrate_v1.20.0_corndog-config-file-v0-1-0.lz4",
"migrate_v1.20.0_corndog-services-cfg-v0-1-0.lz4",
"migrate_v1.20.0_bootstrap-containers-config-file-v0-1-0.lz4",
"migrate_v1.20.0_bootstrap-containers-services-cfg-v0-1-0.lz4",
]
17 changes: 17 additions & 0 deletions packages/os/bootstrap-containers-toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[required-extensions]
bootstrap-containers = "v1"
std = { version = "v1", helpers = ["if_not_null"] }
+++
{{#if_not_null settings.bootstrap-containers}}
{{#each settings.bootstrap-containers}}
["{{@key}}"]
source = "{{{this.source}}}"
mode = "{{{this.mode}}}"
{{#if_not_null this.user-data}}
user-data = "{{{this.user-data}}}"
{{/if_not_null}}
{{#if_not_null this.essential}}
essential = {{this.essential}}
{{/if_not_null}}
{{/each}}
{{/if_not_null}}
4 changes: 3 additions & 1 deletion packages/os/os.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Source14: certdog-toml
Source15: prairiedog-toml
Source16: thar-be-updates-toml
Source17: corndog-toml
Source18: bootstrap-containers-toml
Source19: host-containers-toml

# 1xx sources: systemd units
Expand Down Expand Up @@ -477,7 +478,7 @@ install -d %{buildroot}%{_cross_datadir}/updog
install -p -m 0644 %{_cross_repo_root_json} %{buildroot}%{_cross_datadir}/updog

install -d %{buildroot}%{_cross_templatedir}
install -p -m 0644 %{S:5} %{S:6} %{S:7} %{S:8} %{S:14} %{S:15} %{S:16} %{S:17} %{S:19} \
install -p -m 0644 %{S:5} %{S:6} %{S:7} %{S:8} %{S:14} %{S:15} %{S:16} %{S:17} %{S:18} %{S:19} \
%{buildroot}%{_cross_templatedir}

install -d %{buildroot}%{_cross_unitdir}
Expand Down Expand Up @@ -700,6 +701,7 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
%{_cross_bindir}/bootstrap-containers
%{_cross_unitdir}/[email protected]
%{_cross_tmpfilesdir}/bootstrap-containers.conf
%{_cross_templatedir}/bootstrap-containers-toml

%files -n %{_cross_os}bloodhound
%{_cross_bindir}/bloodhound
Expand Down
21 changes: 17 additions & 4 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 @@ -76,6 +76,8 @@ members = [
"api/migration/migrations/v1.20.0/host-containers-config-list-v0-1-0",
"api/migration/migrations/v1.20.0/corndog-config-file-v0-1-0",
"api/migration/migrations/v1.20.0/corndog-services-cfg-v0-1-0",
"api/migration/migrations/v1.20.0/bootstrap-containers-config-file-v0-1-0",
"api/migration/migrations/v1.20.0/bootstrap-containers-services-cfg-v0-1-0",

"bloodhound",

Expand Down
9 changes: 4 additions & 5 deletions sources/api/bootstrap-containers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ build = "build.rs"
exclude = ["README.md"]

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

[build-dependencies]
generate-readme = { version = "0.1", path = "../../generate-readme" }
Loading

0 comments on commit bcfb715

Please sign in to comment.