placement constraints is now working

This commit is contained in:
Megumiso 2024-07-13 13:15:17 +09:00
parent 0f55e83591
commit 4ffea311e8

View File

@ -1624,12 +1624,15 @@ private function generate_compose_file()
], ],
], ],
]; ];
if (data_get($this->application, 'swarm_placement_constraints')) {
$yaml_parsed_data = 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'],
$yaml_parsed_data
);
}
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;