File tree Expand file tree Collapse file tree
DockerComposeBuilder.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -634,7 +634,8 @@ public void SerializeJaegerServiceTest()
634634 max_attempts: 10
635635 window: "120s"
636636 placement:
637- constraints: ["node.role == worker"]
637+ constraints:
638+ - "node.role == worker"
638639 preferences:
639640 - spread: "node.labels.zone"
640641 resources:
@@ -776,7 +777,8 @@ public void TypedSerializeJaegerServiceTest()
776777 max_attempts: 10
777778 window: "120s"
778779 placement:
779- constraints: ["node.role == worker"]
780+ constraints:
781+ - "node.role == worker"
780782 preferences:
781783 - spread: "node.labels.zone"
782784 resources:
@@ -1561,7 +1563,9 @@ public void ServiceWithTypedDeployPlacementTest()
15611563 image: "myapp:latest"
15621564 deploy:
15631565 placement:
1564- constraints: ["node.role == worker", "node.labels.zone == us-east"]
1566+ constraints:
1567+ - "node.role == worker"
1568+ - "node.labels.zone == us-east"
15651569 preferences:
15661570 - spread: "node.labels.zone"
15671571 max_replicas_per_node: 2
@@ -1712,7 +1716,8 @@ public void ServiceWithFullTypedDeployConfigTest()
17121716 delay: "5s"
17131717 max_attempts: 3
17141718 placement:
1715- constraints: ["node.role == worker"]
1719+ constraints:
1720+ - "node.role == worker"
17161721 resources:
17171722 limits:
17181723 cpus: "1"
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ private static Placement MapToPlacement(Map map)
212212
213213 if ( map . TryGetValue ( "constraints" , out var c ) && c is IEnumerable < object > constraints )
214214 {
215- placement . Constraints = constraints . Select ( x => x . ToString ( ) ! ) . ToArray ( ) ;
215+ placement . Constraints = constraints . Select ( x => x . ToString ( ) ! ) . ToList ( ) ;
216216 }
217217
218218 if ( map . TryGetValue ( "preferences" , out var p ) && p is IEnumerable < object > prefs )
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ internal PlacementBuilder()
1111 {
1212 }
1313
14- public PlacementBuilder WithConstraints ( params IReadOnlyList < string > constraints )
14+ public PlacementBuilder WithConstraints ( params IReadOnlyCollection < string > constraints )
1515 {
1616 if ( WorkingObject . Constraints == null )
1717 {
18- WorkingObject . Constraints = constraints ;
18+ WorkingObject . Constraints = [ .. constraints ] ;
1919 }
2020 else
2121 {
22- WorkingObject . Constraints = WorkingObject . Constraints . Concat ( constraints ) . ToArray ( ) ;
22+ WorkingObject . Constraints = WorkingObject . Constraints . Concat ( constraints ) . ToList ( ) ;
2323 }
2424
2525 return this ;
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ namespace DockerComposeBuilder.Model.Services;
88public class Placement
99{
1010 [ YamlMember ( Alias = "constraints" ) ]
11- public IReadOnlyList < string > ? Constraints { get ; set ; }
11+ public List < string > ? Constraints { get ; set ; }
1212
1313 [ YamlMember ( Alias = "preferences" ) ]
14- public ICollection < PlacementPreference > ? Preferences { get ; set ; }
14+ public List < PlacementPreference > ? Preferences { get ; set ; }
1515
1616 [ YamlMember ( Alias = "max_replicas_per_node" ) ]
1717 public int ? MaxReplicasPerNode { get ; set ; }
You can’t perform that action at this time.
0 commit comments