Skip to content
Snippets Groups Projects
Commit 9663d5f9 authored by ale's avatar ale
Browse files

Add a disabled: true attribute to services

All the attribute does right now is, it will skip host allocation for
the service.
parent caf29091
No related branches found
No related tags found
1 merge request!232Draft: Implement a simple service turndown workflow
Pipeline #21500 passed
...@@ -522,7 +522,9 @@ class Assignments(object): ...@@ -522,7 +522,9 @@ class Assignments(object):
service = services[service_name] service = services[service_name]
available_hosts = cls._available_hosts(service, group_map) available_hosts = cls._available_hosts(service, group_map)
num_instances = service.get('num_instances', 'all') num_instances = service.get('num_instances', 'all')
if num_instances == 'all': if service.get('disabled'):
service_hosts = []
elif num_instances == 'all':
service_hosts = sorted(available_hosts) service_hosts = sorted(available_hosts)
else: else:
service_hosts = sorted(_binpack( service_hosts = sorted(_binpack(
...@@ -530,7 +532,7 @@ class Assignments(object): ...@@ -530,7 +532,7 @@ class Assignments(object):
service_hosts_map[service_name] = service_hosts service_hosts_map[service_name] = service_hosts
for h in service_hosts: for h in service_hosts:
host_occupation[h] += 1 host_occupation[h] += 1
if service.get('master_election'): if service.get('master_election') and not service.get('disabled'):
if 'master_scheduling_group' in service: if 'master_scheduling_group' in service:
available_hosts = set(available_hosts).intersection( available_hosts = set(available_hosts).intersection(
set(group_map[service['master_scheduling_group']])) set(group_map[service['master_scheduling_group']]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment