Skip to content

Commit

Permalink
config workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm committed Jul 1, 2024
1 parent 8bb7ab3 commit 63be163
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions golem-shard-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use tracing_subscriber::EnvFilter;
use worker_executor::{WorkerExecutorService, WorkerExecutorServiceDefault};

use crate::http_server::HttpServerImpl;
use crate::shard_manager_config::HealthCheckMode;
use crate::shard_manager_config::{HealthCheckK8sConfig, HealthCheckMode};

pub struct ShardManagerServiceImpl {
shard_management: ShardManagement,
Expand Down Expand Up @@ -247,12 +247,12 @@ async fn async_main(

let health_check: Arc<dyn HealthCheck + Send + Sync> =
match &shard_manager_config.health_check.mode {
HealthCheckMode::Grpc => Arc::new(GrpcHealthCheck::new(
HealthCheckMode::Grpc(_) => Arc::new(GrpcHealthCheck::new(
worker_executors.clone(),
shard_manager_config.worker_executors.retries.clone(),
)),
#[cfg(feature = "kubernetes")]
HealthCheckMode::K8s { namespace } => Arc::new(
HealthCheckMode::K8s(HealthCheckK8sConfig { namespace }) => Arc::new(
crate::healthcheck::kubernetes::KubernetesHealthCheck::new(
namespace.clone(),
shard_manager_config.worker_executors.retries.clone(),
Expand Down
3 changes: 3 additions & 0 deletions golem-shard-manager/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,6 @@ fn shard_ids_to_ranges<'a, T: Iterator<Item = &'a ShardId>>(ids: T) -> Vec<Shard

result
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Empty {}
12 changes: 8 additions & 4 deletions golem-shard-manager/src/shard_manager_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use std::time::Duration;

use crate::model::Empty;
use figment::providers::{Env, Format, Toml};
use figment::Figment;
use golem_common::config::{RedisConfig, RetryConfig};
Expand Down Expand Up @@ -61,11 +62,14 @@ pub struct HealthCheckConfig {
#[derive(Clone, Debug, Deserialize)]
#[serde(tag = "type", content = "config")]
pub enum HealthCheckMode {
Grpc,
Grpc(Empty),
#[cfg(feature = "kubernetes")]
K8s {
namespace: String,
},
K8s(HealthCheckK8sConfig),
}

#[derive(Clone, Debug, Deserialize)]
pub struct HealthCheckK8sConfig {
pub namespace: String,
}

#[cfg(test)]
Expand Down

0 comments on commit 63be163

Please sign in to comment.