Merge pull request #2827 from Megumiso/fix-placement-constraints
fix placement constraints were ignored
This commit is contained in:
commit
a815240f4e
@ -1624,12 +1624,15 @@ private function generate_compose_file()
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
if (data_get($this->application, 'swarm_placement_constraints')) {
|
||||||
|
$swarm_placement_constraints = Yaml::parse(base64_decode(data_get($this->application, 'swarm_placement_constraints')));
|
||||||
|
$docker_compose['services'][$this->container_name]['deploy'] = array_merge(
|
||||||
|
$docker_compose['services'][$this->container_name]['deploy'],
|
||||||
|
$swarm_placement_constraints
|
||||||
|
);
|
||||||
|
}
|
||||||
if (data_get($this->application, 'settings.is_swarm_only_worker_nodes')) {
|
if (data_get($this->application, 'settings.is_swarm_only_worker_nodes')) {
|
||||||
$docker_compose['services'][$this->container_name]['deploy']['placement'] = [
|
$docker_compose['services'][$this->container_name]['deploy']['placement']['constraints'][] = 'node.role == worker';
|
||||||
'constraints' => [
|
|
||||||
'node.role == worker',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->pull_request_id !== 0) {
|
||||||
$docker_compose['services'][$this->container_name]['deploy']['replicas'] = 1;
|
$docker_compose['services'][$this->container_name]['deploy']['replicas'] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user