Add support for placement preferences docker-compose v3.3+ (#1425)

This commit is contained in:
ichx
2021-11-04 08:28:45 +08:00
committed by GitHub
parent c921643705
commit 8cb1b0599e
12 changed files with 220 additions and 37 deletions
@@ -1,4 +1,4 @@
version: "3"
version: "3.3"
services:
redis:
image: redis
@@ -10,4 +10,8 @@ services:
- node.hostname == machine
- engine.labels.operatingsystem == ubuntu 14.04
- node.labels.foo != bar
- baz != qux
- baz != qux
preferences:
- spread: node.labels.zone
- spread: foo
- spread: node.labels.ssd
@@ -76,24 +76,52 @@
{
"key": "kubernetes.io/hostname",
"operator": "In",
"values": ["machine"]
"values": [
"machine"
]
},
{
"key": "beta.kubernetes.io/os",
"key": "kubernetes.io/os",
"operator": "In",
"values": ["ubuntu 14.04"]
"values": [
"ubuntu 14.04"
]
},
{
"key": "foo",
"operator": "NotIn",
"values": ["bar"]
"values": [
"bar"
]
}
]
}
]
}
}
}
},
"topologySpreadConstraints": [
{
"maxSkew": 2,
"topologyKey": "zone",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"io.kompose.service": "redis"
}
}
},
{
"maxSkew": 1,
"topologyKey": "ssd",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"io.kompose.service": "redis"
}
}
}
]
}
},
"strategy": {}
@@ -96,24 +96,52 @@
{
"key": "kubernetes.io/hostname",
"operator": "In",
"values": ["machine"]
"values": [
"machine"
]
},
{
"key": "beta.kubernetes.io/os",
"key": "kubernetes.io/os",
"operator": "In",
"values": ["ubuntu 14.04"]
"values": [
"ubuntu 14.04"
]
},
{
"key": "foo",
"operator": "NotIn",
"values": ["bar"]
"values": [
"bar"
]
}
]
}
]
}
}
}
},
"topologySpreadConstraints": [
{
"maxSkew": 2,
"topologyKey": "zone",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"io.kompose.service": "redis"
}
}
},
{
"maxSkew": 1,
"topologyKey": "ssd",
"whenUnsatisfiable": "ScheduleAnyway",
"labelSelector": {
"matchLabels": {
"io.kompose.service": "redis"
}
}
}
]
}
}
},