@@ -122,6 +122,10 @@ func TestCCMLoadBalancers(t *testing.T) {
122
122
name : "Get Load Balancer" ,
123
123
f : testGetLoadBalancer ,
124
124
},
125
+ {
126
+ name : "Create Load Balancer With loadBalancerClass" ,
127
+ f : testCreateNodeBalancerWithLBClass ,
128
+ },
125
129
{
126
130
name : "Create Load Balancer Without Firewall" ,
127
131
f : testCreateNodeBalancerWithOutFirewall ,
@@ -270,6 +274,48 @@ func stubService(fake *fake.Clientset, service *v1.Service) {
270
274
_ , _ = fake .CoreV1 ().Services ("" ).Create (context .TODO (), service , metav1.CreateOptions {})
271
275
}
272
276
277
+ func testCreateNodeBalancerWithLBClass (t * testing.T , client * linodego.Client , _ * fakeAPI ) {
278
+ lbClass := "io.cilium/bgp-control-plane"
279
+ svc := & v1.Service {
280
+ ObjectMeta : metav1.ObjectMeta {
281
+ Name : randString (),
282
+ UID : "foobar123" ,
283
+ Annotations : map [string ]string {
284
+ annotations .AnnLinodeThrottle : "15" ,
285
+ annotations .AnnLinodeLoadBalancerTags : "fake,test,yolo" ,
286
+ },
287
+ },
288
+ Spec : v1.ServiceSpec {
289
+ LoadBalancerClass : & lbClass ,
290
+ Ports : []v1.ServicePort {
291
+ {
292
+ Name : randString (),
293
+ Protocol : "TCP" ,
294
+ Port : int32 (80 ),
295
+ NodePort : int32 (30000 ),
296
+ },
297
+ {
298
+ Name : randString (),
299
+ Protocol : "TCP" ,
300
+ Port : int32 (8080 ),
301
+ NodePort : int32 (30001 ),
302
+ },
303
+ },
304
+ },
305
+ }
306
+ lb := & loadbalancers {client , "us-west" , nil }
307
+ nodes := []* v1.Node {
308
+ {ObjectMeta : metav1.ObjectMeta {Name : "node-1" }},
309
+ }
310
+ nb , err := lb .EnsureLoadBalancer (context .TODO (), "linodelb" , svc , nodes )
311
+ if err != nil {
312
+ t .Fatalf ("expected a nil error, got %v" , err )
313
+ }
314
+ if nb != nil {
315
+ t .Fatalf ("expected a nil nb, got %v" , nb )
316
+ }
317
+ }
318
+
273
319
func testCreateNodeBalancer (t * testing.T , client * linodego.Client , _ * fakeAPI , annMap map [string ]string ) error {
274
320
svc := & v1.Service {
275
321
ObjectMeta : metav1.ObjectMeta {
0 commit comments