Skip to content

Commit aa5de64

Browse files
committed
fix(windows): scope test-only server code
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
1 parent b69a125 commit aa5de64

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎crates/openshell-server/src/auth/k8s_sa.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@
1818
use super::authenticator::Authenticator;
1919
use super::principal::{Principal, SandboxIdentitySource, SandboxPrincipal};
2020
use async_trait::async_trait;
21+
#[cfg(not(target_os = "windows"))]
22+
use k8s_openapi::api::authentication::v1::{TokenReview, TokenReviewSpec};
2123
#[cfg(any(not(target_os = "windows"), test))]
2224
use k8s_openapi::api::{
23-
authentication::v1::{TokenReview, TokenReviewSpec, TokenReviewStatus, UserInfo},
25+
authentication::v1::{TokenReviewStatus, UserInfo},
2426
core::v1::Pod,
2527
};
2628
#[cfg(any(not(target_os = "windows"), test))]
2729
use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
2830
#[cfg(any(not(target_os = "windows"), test))]
2931
use kube::Error as KubeError;
32+
#[cfg(any(not(target_os = "windows"), test))]
33+
use kube::api::ApiResource;
3034
#[cfg(not(target_os = "windows"))]
31-
use kube::api::{Api, ApiResource, PostParams};
35+
use kube::api::{Api, PostParams};
3236
#[cfg(any(not(target_os = "windows"), test))]
3337
use kube::core::DynamicObject;
34-
#[cfg(not(target_os = "windows"))]
38+
#[cfg(any(not(target_os = "windows"), test))]
3539
use kube::core::gvk::GroupVersionKind;
3640
use std::sync::Arc;
3741
use tonic::Status;

‎crates/openshell-server/src/lib.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ pub(crate) async fn run_server(
282282
let ServerStartupConfig {
283283
config,
284284
config_file,
285+
#[cfg(not(target_os = "windows"))]
285286
guest_tls,
287+
#[cfg(target_os = "windows")]
288+
guest_tls: _,
286289
} = startup;
287290

288291
auth::descriptor_authz::init()
@@ -1019,7 +1022,7 @@ fn builtin_compute_driver(name: &str) -> Option<ComputeDriverKind> {
10191022
name.parse().ok()
10201023
}
10211024

1022-
#[cfg(not(target_os = "windows"))]
1025+
#[cfg(any(not(target_os = "windows"), test))]
10231026
fn kubernetes_sandbox_jwt_expiry_disabled(config: &Config) -> bool {
10241027
config
10251028
.gateway_jwt

0 commit comments

Comments
 (0)