Skip to content
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

Added support for balancer class. #16

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading