Skip to content

Commit 9eb4363

Browse files
krancourKent Rancourt
authored andcommitted
feat(platform): support placement options for each plane and router mesh
This updates deisctl code that creates and loads system units such that platform components belonging to each of the control plane, data plane, and router mesh can OPTIONALLY be scheduled only where fleet machine metadata indicates. The means of achieving this are that a "decorator" is applied to any system unit just before scheduling if and only if this option is enabled by means of the etcd key /deis/platform/enablePlacementOptions having been set to the value true. The decorator adds the correct metadata. Nodes in existing clusters will lack the machine metadata referenced by the system unit decorators. That would make this a breaking change except for the fact that this is entirely OPT-IN. Users should be encouraged to begin adopting metadata that will permit them to isolate their planes more easily in the future. As such, user-data.example is modified such that machines configured from that cloud-config are eligible to host both planes and the router mesh. This permits NEW small clusters without any isolation to be constructed as easily as ever before and permits the platform to be installed to such a cluster without complication. The main benefit of this change is that advanced users can use custom cloud config to isolate their planes using ONLY metadata and without also needing to also manually customize their system units, as would have been required in the past.
1 parent 099eb21 commit 9eb4363

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

scheduler/fleet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def _create_container(self, name, image, command, unit, **kwargs):
150150
f['value'] = f['value'].format(**l)
151151
# prepare tags only if one was provided
152152
tags = kwargs.get('tags', {})
153-
if tags:
154-
tagset = ' '.join(['"{}={}"'.format(k, v) for k, v in tags.viewitems()])
153+
tagset = ' '.join(['"{}={}"'.format(k, v) for k, v in tags.viewitems()])
154+
if settings.ENABLE_PLACEMENT_OPTIONS in ['true', 'True', 'TRUE', '1']:
155155
unit.append({"section": "X-Fleet", "name": "MachineMetadata",
156-
"value": tagset})
156+
"value": tagset + ' "dataPlane=true"'})
157157
# post unit to fleet
158158
self._put_unit(name, {"desiredState": "loaded", "options": unit})
159159

templates/confd_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
# platform domain must be provided
2525
DEIS_DOMAIN = '{{ getv "/deis/platform/domain" }}'
2626

27+
ENABLE_PLACEMENT_OPTIONS = """{{ if exists "/deis/platform/enablePlacementOptions" }}{{ getv "/deis/platform/enablePlacementOptions" }}{{ else }}false{{end}}"""
28+
2729
# use the private registry module
2830
REGISTRY_MODULE = 'registry.private'
2931
REGISTRY_URL = '{{ getv "/deis/registry/protocol" }}://{{ getv "/deis/registry/host" }}:{{ getv "/deis/registry/port" }}' # noqa

0 commit comments

Comments
 (0)