-
Notifications
You must be signed in to change notification settings - Fork 921
fix(install): drop podman as hard dependency for RPM installation #2137
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
base: main
Are you sure you want to change the base?
Changes from all commits
5e74178
095565e
b1ee5e6
d66a078
d58c55f
bbc12cd
64a5ae0
9ceadeb
126f9b9
72fad27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,17 +39,19 @@ struct Cli { | |
| enum Commands { | ||
| /// Generate mTLS PKI and write Kubernetes Secrets (Helm pre-install hook). | ||
| GenerateCerts(certgen::CertgenArgs), | ||
| /// Inspect or update the gateway TOML configuration. | ||
| Config(crate::config_command::ConfigArgs), | ||
| } | ||
|
|
||
| #[derive(clap::Args, Debug)] | ||
| #[allow(clippy::struct_excessive_bools)] | ||
| struct RunArgs { | ||
| /// Path to a TOML configuration file (see RFC 0003). | ||
| /// Path to the gateway TOML configuration file (see RFC 0003). | ||
| /// | ||
| /// When set, gateway-wide settings and per-driver tables are read from | ||
| /// the file. Gateway command-line flags and `OPENSHELL_*` environment | ||
| /// variables continue to take precedence over gateway file values. | ||
| #[arg(long, env = "OPENSHELL_GATEWAY_CONFIG")] | ||
| /// Gateway startup reads this file. Config subcommands update it. Gateway | ||
| /// command-line flags and `OPENSHELL_*` environment variables continue to | ||
| /// take precedence over file values at runtime. | ||
| #[arg(long, env = "OPENSHELL_GATEWAY_CONFIG", global = true)] | ||
|
Comment on lines
+51
to
+54
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the |
||
| config: Option<PathBuf>, | ||
|
|
||
| /// IP address to bind the server, health, and metrics listeners to. | ||
|
|
@@ -228,6 +230,7 @@ pub async fn run_cli() -> Result<()> { | |
|
|
||
| match cli.command { | ||
| Some(Commands::GenerateCerts(args)) => certgen::run(args).await, | ||
| Some(Commands::Config(args)) => crate::config_command::run(args, cli.run.config), | ||
| None => Box::pin(run_from_args(cli.run, matches)).await, | ||
| } | ||
| } | ||
|
|
@@ -1075,6 +1078,65 @@ mod tests { | |
| )); | ||
| } | ||
|
|
||
| #[test] | ||
| fn config_set_uses_explicit_config_path() { | ||
| let _lock = ENV_LOCK | ||
| .lock() | ||
| .unwrap_or_else(std::sync::PoisonError::into_inner); | ||
| let _g = EnvVarGuard::remove("OPENSHELL_GATEWAY_CONFIG"); | ||
| let temp = tempfile::tempdir().unwrap(); | ||
| let path = temp.path().join("custom/gateway.toml"); | ||
| let path_string = path.to_string_lossy().into_owned(); | ||
|
|
||
| let cli = Cli::try_parse_from([ | ||
| "openshell-gateway", | ||
| "config", | ||
| "set", | ||
| "--config", | ||
| &path_string, | ||
| "--compute-driver", | ||
| "podman", | ||
| "--bind-address", | ||
| "0.0.0.0:17670", | ||
| ]) | ||
| .expect("config set should parse without runtime arguments"); | ||
| let Cli { command, run } = cli; | ||
| let Some(super::Commands::Config(args)) = command else { | ||
| panic!("expected config subcommand"); | ||
| }; | ||
|
|
||
| crate::config_command::run(args, run.config).unwrap(); | ||
|
|
||
| let loaded = crate::config_file::load(&path).unwrap(); | ||
| assert_eq!( | ||
| loaded.openshell.gateway.compute_drivers, | ||
| Some(vec!["podman".to_string()]) | ||
| ); | ||
| assert_eq!( | ||
| loaded.openshell.gateway.bind_address, | ||
| Some("0.0.0.0:17670".parse().unwrap()) | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn config_set_requires_at_least_one_setting() { | ||
| let error = Cli::try_parse_from(["openshell-gateway", "config", "set"]) | ||
| .expect_err("config set without a setting should fail"); | ||
|
|
||
| assert_eq!( | ||
| error.kind(), | ||
| clap::error::ErrorKind::MissingRequiredArgument | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn config_detect_driver_parses_without_runtime_arguments() { | ||
| let cli = Cli::try_parse_from(["openshell-gateway", "config", "detect-driver"]) | ||
| .expect("config detect-driver should parse"); | ||
|
|
||
| assert!(matches!(cli.command, Some(super::Commands::Config(_)))); | ||
| } | ||
|
|
||
| #[test] | ||
| fn bare_invocation_with_no_db_url_parses_for_runtime_defaults() { | ||
| // db_url is Option<String> at the clap level so subcommand parsing | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to this change, but currently the Docker driver will stop all sandboxes if the gateway is restarted (as it would be under upgrade).