Skip to content

Commit

Permalink
Added support for balancer class. (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius authored Nov 25, 2024
1 parent 152acf9 commit 0f59891
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ pub const DEFAULT_LB_ALGORITHM: &str = "least-connections";
pub const DEFAULT_LB_BALANCER_TYPE: &str = "lb11";

pub const FINALIZER_NAME: &str = "robotlb/finalizer";
pub const ROBOTLB_LB_CLASS: &str = "robotlb";
11 changes: 11 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ pub async fn reconcile_service(
return Err(RobotLBError::SkipService);
}

let lb_type = svc
.spec
.as_ref()
.and_then(|s| s.load_balancer_class.as_ref())
.map(String::as_str)
.unwrap_or(consts::ROBOTLB_LB_CLASS);
if lb_type != consts::ROBOTLB_LB_CLASS {
tracing::debug!("Load balancer class is not robotlb. Skipping...");
return Err(RobotLBError::SkipService);
}

tracing::info!("Starting service reconcilation");

let lb = LoadBalancer::try_from_svc(&svc, &context)?;
Expand Down

0 comments on commit 0f59891

Please sign in to comment.