chore: replace machine filter with placement constraint in service spec

This commit is contained in:
Pavel Sviderski
2025-04-16 22:04:37 +10:00
parent 4532b985d4
commit f3cb6657ae
15 changed files with 238 additions and 294 deletions
+13 -1
View File
@@ -16,10 +16,22 @@ type Constraint interface {
}
func constraintsFromSpec(spec api.ServiceSpec) []Constraint {
return []Constraint{}
var constraints []Constraint
if len(spec.Placement.Machines) > 0 {
constraints = append(constraints, &PlacementConstraint{
Machines: spec.Placement.Machines,
})
}
// TODO: inspect and add VolumeConstraint.
return constraints
}
type PlacementConstraint struct {
// Machines is a list of machine names or IDs where service containers are allowed to be deployed.
// If empty, containers can be deployed to any available machine in the cluster.
Machines []string
}