Skip to content

Commit 293293b

Browse files
committed
Merge origin/main into chore/get-a-vm-running
origin/main (#32) refactored Hyper.Config into Hyper.Cfg.* modules (Cfg.Tools/Jails/Dirs/Budget/Otel/Toml/...) and deleted config.ex. This branch had independent VM-boot work on the same files. Resolution: - config.ex: accept main's deletion; rewrite all Hyper.Config.X callers to the Hyper.Cfg.{Tools,Jails,Dirs,Img}.Y equivalents (jailer, node, reclaim, dmsetup). - suid_helper/{blockdev,dmsetup,losetup}, jailer: keep THIS branch's helper-routed architecture (no --bin; the merged Rust helper reads tool paths from config and owns the privileged jailer flags). - node.ex: keep check_firecracker_bins + dropped FireVMM.Provider (branch), but load budget via Hyper.Cfg.Budget (main). - fire_vmm/provider.ex: stays deleted (branch dropped Provider). - umoci.ex, runtime.exs, config.md: take main (already carry these features, refactored; config.md is main's comprehensive restructure). - jailer_test: stub via Hyper.Cfg.Toml.put_cache/reload. Gate green: compile --warnings-as-errors, format, 250 tests, dialyzer 0.
2 parents ed6ad5d + 9ee5de4 commit 293293b

59 files changed

Lines changed: 1511 additions & 810 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/config.exs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ config :opentelemetry,
1212
# iex --name a@127.0.0.1 --cookie hyper -S mix
1313
# iex --name b@127.0.0.1 --cookie hyper -S mix
1414
#
15-
# Swap the strategy for prod (DNSPoll / EC2 tags).
16-
config :libcluster,
15+
# Swap the strategy for prod (DNSPoll / EC2 tags). Hyper forwards this straight
16+
# to libcluster; see `Hyper.Cfg.Cluster`.
17+
config :hyper, Hyper.Cfg.Cluster,
1718
topologies: [
1819
hyper: [
1920
strategy: Cluster.Strategy.Epmd,
@@ -24,7 +25,7 @@ config :libcluster,
2425
if config_env() == :test do
2526
config :opentelemetry, traces_exporter: :none
2627
# No cluster formation during tests.
27-
config :libcluster, topologies: []
28+
config :hyper, Hyper.Cfg.Cluster, topologies: []
2829

2930
# JUnit XML for Codecov Test Analytics. A fixed report_dir (not the default
3031
# app_path) gives CI a stable path; automatic_create_dir? mkdirs it since

config/runtime.exs

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,39 @@ import Config
22

33
# Per-node resource budget. Lives in runtime config because it builds `Unit.*`
44
# values, which are only loadable once the app's modules are on the code path.
5-
config :hyper, Hyper.Node.Config.Budget,
5+
config :hyper, Hyper.Cfg.Budget,
66
mem_max: Unit.Information.gib(4),
77
disk_max: Unit.Information.gib(4),
88
cpu_max_load: 0.8,
9+
cpu_max_cap: 4.0,
910
disk_bw_cap: Unit.Bandwidth.gibps(1),
1011
disk_bw_max_load: 0.8,
1112
net_bw_cap: Unit.Bandwidth.gibps(1),
1213
net_bw_max_load: 0.8
1314

14-
# Where to send traces. Defaults to Honeycomb; override OTEL_EXPORTER_OTLP_*
15-
# to point at any OTLP/HTTP backend (Collector, Grafana, etc).
16-
if config_env() != :test do
17-
custom_endpoint = System.get_env("OTEL_EXPORTER_OTLP_ENDPOINT")
18-
api_key = System.get_env("HONEYCOMB_API_KEY")
19-
20-
cond do
21-
api_key not in [nil, ""] ->
22-
config :opentelemetry_exporter,
23-
otlp_protocol: :http_protobuf,
24-
otlp_endpoint: custom_endpoint || "https://api.honeycomb.io",
25-
otlp_headers: [{"x-honeycomb-team", api_key}]
26-
27-
custom_endpoint not in [nil, ""] ->
28-
# A custom OTLP backend (e.g. a local Collector) needs no Honeycomb key.
29-
config :opentelemetry_exporter,
30-
otlp_protocol: :http_protobuf,
31-
otlp_endpoint: custom_endpoint,
32-
otlp_headers: []
33-
34-
true ->
35-
# No backend configured: exporting to the Honeycomb default with no key
36-
# 401s on every batch. Stay silent instead (typical for local dev). Set
37-
# HONEYCOMB_API_KEY or OTEL_EXPORTER_OTLP_ENDPOINT to enable tracing.
38-
config :opentelemetry, traces_exporter: :none
39-
end
40-
end
41-
4215
# Operator overrides from a well-known location. An optional Elixir config file
4316
# at /etc/hyper/config.exs (override the path with HYPER_CONFIG) is merged in
4417
# last, so its values win over every default set above. An absent file is a
45-
# no-op -- the normal case in dev and CI. Skipped under :test so the suite never
18+
# no-op the normal case in dev and CI. Skipped under :test so the suite never
4619
# reads host state.
20+
#
21+
# OpenTelemetry exporter wiring is resolved through Hyper.Cfg.Otel so that the
22+
# operator's `config :hyper, Hyper.Cfg.Otel, ...` stanza (if present) takes
23+
# precedence over the TOML table and environment variables.
4724
if config_env() != :test do
4825
hyper_config = System.get_env("HYPER_CONFIG") || "/etc/hyper/config.exs"
4926

50-
if File.exists?(hyper_config) do
51-
for {app, kw} <- Config.Reader.read!(hyper_config, env: config_env()) do
52-
config app, kw
53-
end
27+
operator =
28+
if File.exists?(hyper_config),
29+
do: Config.Reader.read!(hyper_config, env: config_env()),
30+
else: []
31+
32+
otel_exs = get_in(operator, [:hyper, Hyper.Cfg.Otel]) || []
33+
34+
case Hyper.Cfg.Otel.exporter_options(otel_exs) do
35+
{:ok, opts} -> config :opentelemetry_exporter, opts
36+
:none -> config :opentelemetry, traces_exporter: :none
5437
end
38+
39+
for {app, kw} <- operator, do: config(app, kw)
5540
end

0 commit comments

Comments
 (0)