1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00

openstack: Expose worker server group policy

With this change, Compute nodes within each MachineSet are automatically
created in a Server group, with a default policy of
"soft-anti-affinity".

With this change, a "serverGroupPolicy" can be set in install-config, on
the worker MachinePool and/or in the platform default.

Implements OSASINFRA-2570

Co-Authored-By: Matthew Booth <mbooth@redhat.com>
This commit is contained in:
Pierre Prinetti
2021-07-12 16:53:16 +02:00
parent 292329d3ef
commit f6dbeccc70
15 changed files with 239 additions and 183 deletions

View File

@@ -0,0 +1,41 @@
apiVersion: v1
baseDomain: shiftstack.example.com
clusterID: manifests1
controlPlane:
hyperthreading: Enabled
architecture: amd64
name: master
platform:
openstack:
type: ${COMPUTE_FLAVOR}
serverGroupPolicy: anti-affinity
zones:
- zoneone
replicas: 3
compute:
- name: worker
platform:
openstack:
type: ${COMPUTE_FLAVOR}
serverGroupPolicy: affinity
zones:
- zonetwo
- zonethree
replicas: 3
metadata:
name: manifests1
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
machineNetwork:
- cidr: 10.0.128.0/17
networkType: OpenShiftSDN
serviceNetwork:
- 172.30.0.0/16
platform:
openstack:
cloud: ${OS_CLOUD}
externalNetwork: ${EXTERNAL_NETWORK}
apiFloatingIP: ${API_FIP}
pullSecret: ${PULL_SECRET}

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import glob
import yaml
ASSETS_DIR = ""
class TestMachinesServerGroup(unittest.TestCase):
def setUp(self):
"""Parse the Machines into a Python data structure."""
self.machines = []
for machine_path in glob.glob(
f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_master-machines-*.yaml'
):
with open(machine_path) as f:
self.machines.append(yaml.load(f, Loader=yaml.FullLoader))
def test_consistent_group_name(self):
"""Assert that all machines bear the same server group name."""
group_name = None
for machine in self.machines:
name = machine["spec"]["providerSpec"]["value"]["serverGroupName"]
if group_name is None:
group_name = name
self.assertEqual(name, group_name)
if __name__ == '__main__':
ASSETS_DIR = sys.argv.pop()
unittest.main(verbosity=2)

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import glob
import yaml
ASSETS_DIR = ""
class TestMachinesetsServerGroup(unittest.TestCase):
def setUp(self):
"""Parse the MachineSets into a Python data structure."""
self.machinesets = []
for machineset_path in glob.glob(
f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_worker-machineset-*.yaml'
):
with open(machineset_path) as f:
self.machinesets.append(yaml.load(f, Loader=yaml.FullLoader))
def test_consistent_group_names(self):
"""Assert that server group names are unique across machinesets."""
found = []
for machineset in self.machinesets:
name = machineset["spec"]["template"]["spec"]["providerSpec"][
"value"]["serverGroupName"]
self.assertNotIn(name, found)
found.append(name)
if __name__ == '__main__':
ASSETS_DIR = sys.argv.pop()
unittest.main(verbosity=2)