Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class ServicePlacement implements Serializable {
@JsonProperty("Platforms")
private List<SwarmNodePlatform> platforms;

/**
* @since 1.40
*/
@JsonProperty("MaxReplicas")
private Integer maxReplicas;

/**
* @see #constraints
*/
Expand All @@ -54,4 +60,31 @@ public List<SwarmNodePlatform> getPlatforms() {
public void setPlatforms(List<SwarmNodePlatform> platforms) {
this.platforms = platforms;
}

/**
* Specifies the maximum amount of replicas / tasks that can run on one node.
* 0 means unlimited replicas per node.
*
* @param maxReplicas Max number of replicas
* @return This instance of ServicePlacement
* @throws IllegalArgumentException if maxReplicas is less than 0
*/
public ServicePlacement withMaxReplicas(int maxReplicas) {
if (maxReplicas < 0) {
throw new IllegalArgumentException("The Value for MaxReplicas must be greater or equal to 0");
}

this.maxReplicas = maxReplicas;
return this;
}

/**
* Getter for maxReplicas
*
* @return The maximum amount of replicas / tasks that can run on one node.
*/
public Integer getMaxReplicas() {
return this.maxReplicas;
}

}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.