()
| 107 | |
| 108 | #[tokio::main] |
| 109 | async fn main() -> Result<()> { |
| 110 | let args = Args::parse(); |
| 111 | tracing_subscriber::fmt() |
| 112 | .with_env_filter( |
| 113 | EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(&args.log_level)), |
| 114 | ) |
| 115 | .init(); |
| 116 | |
| 117 | let socket_path = args |
| 118 | .podman_socket |
| 119 | .unwrap_or_else(PodmanComputeConfig::default_socket_path); |
| 120 | |
| 121 | let driver = PodmanComputeDriver::new(PodmanComputeConfig { |
| 122 | socket_path, |
| 123 | default_image: args.sandbox_image.unwrap_or_default(), |
| 124 | image_pull_policy: args.sandbox_image_pull_policy, |
| 125 | grpc_endpoint: args.grpc_endpoint.unwrap_or_default(), |
| 126 | gateway_port: args.gateway_port, |
| 127 | host_gateway_ip: args |
| 128 | .host_gateway_ip |
| 129 | .unwrap_or_else(PodmanComputeConfig::default_host_gateway_ip), |
| 130 | sandbox_ssh_socket_path: args.sandbox_ssh_socket_path, |
| 131 | network_name: args.network_name, |
| 132 | stop_timeout_secs: args.stop_timeout, |
| 133 | supervisor_image: args.supervisor_image, |
| 134 | guest_tls_ca: args.podman_tls_ca, |
| 135 | guest_tls_cert: args.podman_tls_cert, |
| 136 | guest_tls_key: args.podman_tls_key, |
| 137 | sandbox_pids_limit: args.sandbox_pids_limit, |
| 138 | ..PodmanComputeConfig::default() |
| 139 | }) |
| 140 | .await |
| 141 | .into_diagnostic()?; |
| 142 | |
| 143 | info!(address = %args.bind_address, "Starting Podman compute driver"); |
| 144 | tonic::transport::Server::builder() |
| 145 | .add_service(ComputeDriverServer::new(ComputeDriverService::new(driver))) |
| 146 | .serve_with_shutdown(args.bind_address, async { |
| 147 | tokio::signal::ctrl_c().await.ok(); |
| 148 | info!("Received shutdown signal, draining in-flight requests"); |
| 149 | }) |
| 150 | .await |
| 151 | .into_diagnostic() |
| 152 | } |
nothing calls this directly
no outgoing calls
no test coverage detected