@@ -272,10 +272,12 @@ def get_server_types(labels: set[str], default: ServerType, label_prefix: str =
272
272
for label in labels :
273
273
label = label .lower ()
274
274
if label .startswith (label_prefix ):
275
- server_type_names = label .split (label_prefix , 1 )[- 1 ].lower ().split ("-" )
276
- for server_type_name in server_type_names :
277
- server_type = ServerType (name = server_type_name )
278
- server_types .append (server_type )
275
+ server_type_name = label .split (label_prefix , 1 )[- 1 ].lower ()
276
+ if "-" in server_type_name :
277
+ # skip composite label
278
+ continue
279
+ server_type = ServerType (name = server_type_name )
280
+ server_types .append (server_type )
279
281
280
282
if not server_types :
281
283
server_types = [default ]
@@ -301,10 +303,12 @@ def get_server_locations(
301
303
for label in labels :
302
304
label = label .lower ()
303
305
if label .startswith (label_prefix ):
304
- server_location_names = label .split (label_prefix , 1 )[- 1 ].lower ().split ("-" )
305
- for server_location_name in server_location_names :
306
- server_location = Location (name = server_location_name )
307
- server_locations .append (server_location )
306
+ server_location_name = label .split (label_prefix , 1 )[- 1 ].lower ()
307
+ if "-" in server_location_name :
308
+ # skip composite label
309
+ continue
310
+ server_location = Location (name = server_location_name )
311
+ server_locations .append (server_location )
308
312
309
313
if not server_locations :
310
314
server_locations = [default ]
@@ -499,6 +503,10 @@ def expand_meta_label(
499
503
"""Expand any meta labels."""
500
504
expanded_labels = []
501
505
label_prefix = label_prefix .lower ()
506
+ composite_labels = ["type-" , "in-" ]
507
+
508
+ if label_prefix and not label_prefix .endswith ("-" ):
509
+ label_prefix += "-"
502
510
503
511
for label in labels :
504
512
label = label .lower ()
@@ -507,6 +515,15 @@ def expand_meta_label(
507
515
raw_label = label .split (label_prefix , 1 )[- 1 ] if label_prefix else label
508
516
if raw_label in meta_label :
509
517
expanded_labels += list (meta_label [label ])
518
+ for composite_label in composite_labels :
519
+ if raw_label .startswith (composite_label ):
520
+ composite_values = (
521
+ raw_label .split (composite_label , 1 )[- 1 ].lower ().split ("-" )
522
+ )
523
+ for composite_value in composite_values :
524
+ expanded_labels .append (
525
+ f"{ label_prefix } { composite_label } { composite_value } "
526
+ )
510
527
511
528
return set (expanded_labels )
512
529
0 commit comments