|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * installing/installing_openstack/installing-openstack-installer.adoc |
| 4 | +// * installing/installing_openstack/installing-openstack-installer-custom.adoc |
| 5 | +// * installing/installing_openstack/installing-openstack-installer-kuryr.adoc |
| 6 | +// * installing/installing_openstack/installing-openstack-installer-restricted.adoc |
| 7 | +// * installing/installing_openstack/installing-openstack-user.adoc |
| 8 | +// * installing/installing_openstack/installing-openstack-user-kuryr.adoc |
| 9 | + |
| 10 | + |
| 11 | +[id="installation-osp-setting-worker-affinity_{context}"] |
| 12 | += Setting compute machine affinity |
| 13 | + |
| 14 | +Optionally, you can set the affinity policy for compute machines during installation. The installer does not select an affinity policy for compute machines by default. |
| 15 | + |
| 16 | +You can also create machine sets that use particular {rh-openstack} server groups after installation. |
| 17 | + |
| 18 | +[NOTE] |
| 19 | +==== |
| 20 | +Control plane machines are created with a `soft-anti-affinity` policy. |
| 21 | +==== |
| 22 | + |
| 23 | +[TIP] |
| 24 | +==== |
| 25 | +You can learn more about link:https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/configuring_the_compute_service_for_instance_creation/configuring-instance-scheduling-and-placement[{rh-openstack} instance scheduling and placement] in the {rh-openstack} documentation. |
| 26 | +==== |
| 27 | + |
| 28 | +.Prerequisites |
| 29 | + |
| 30 | +* Create the `install-config.yaml` file and complete any modifications to it. |
| 31 | + |
| 32 | +.Procedure |
| 33 | + |
| 34 | +. Using the {rh-openstack} command-line interface, create a server group for your compute machines. For example: |
| 35 | ++ |
| 36 | +[source,terminal] |
| 37 | +---- |
| 38 | +$ openstack \ |
| 39 | + --os-compute-api-version=2.15 \ |
| 40 | + server group create \ |
| 41 | + --policy anti-affinity \ |
| 42 | + my-openshift-worker-group |
| 43 | +---- |
| 44 | ++ |
| 45 | +For more information, see the link:https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/15/html/command_line_interface_reference/server#server_group_create[`server group create` command documentation]. |
| 46 | + |
| 47 | +. Change to the directory that contains the installation program and create the manifests: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +$ ./openshift-install create manifests --dir=<installation_directory> |
| 52 | +---- |
| 53 | ++ |
| 54 | +where: |
| 55 | ++ |
| 56 | +`installation_directory` :: Specifies the name of the directory that contains the `install-config.yaml` file for your cluster. |
| 57 | + |
| 58 | +. Open `manifests/99_openshift-cluster-api_worker-machineset-0.yaml`, the `MachineSet` definition file. |
| 59 | + |
| 60 | +. Add the property `serverGroupID` to the definition beneath the `spec.template.spec.providerSpec.value` property. For example: |
| 61 | ++ |
| 62 | +[source,yaml] |
| 63 | +---- |
| 64 | +apiVersion: machine.openshift.io/v1beta1 |
| 65 | +kind: MachineSet |
| 66 | +metadata: |
| 67 | + labels: |
| 68 | + machine.openshift.io/cluster-api-cluster: <infrastructure_ID> |
| 69 | + machine.openshift.io/cluster-api-machine-role: <node_role> |
| 70 | + machine.openshift.io/cluster-api-machine-type: <node_role> |
| 71 | + name: <infrastructure_ID>-<node_role> |
| 72 | + namespace: openshift-machine-api |
| 73 | +spec: |
| 74 | + replicas: <number_of_replicas> |
| 75 | + selector: |
| 76 | + matchLabels: |
| 77 | + machine.openshift.io/cluster-api-cluster: <infrastructure_ID> |
| 78 | + machine.openshift.io/cluster-api-machineset: <infrastructure_ID>-<node_role> |
| 79 | + template: |
| 80 | + metadata: |
| 81 | + labels: |
| 82 | + machine.openshift.io/cluster-api-cluster: <infrastructure_ID> |
| 83 | + machine.openshift.io/cluster-api-machine-role: <node_role> |
| 84 | + machine.openshift.io/cluster-api-machine-type: <node_role> |
| 85 | + machine.openshift.io/cluster-api-machineset: <infrastructure_ID>-<node_role> |
| 86 | + spec: |
| 87 | + providerSpec: |
| 88 | + value: |
| 89 | + apiVersion: openstackproviderconfig.openshift.io/v1alpha1 |
| 90 | + cloudName: openstack |
| 91 | + cloudsSecret: |
| 92 | + name: openstack-cloud-credentials |
| 93 | + namespace: openshift-machine-api |
| 94 | + flavor: <nova_flavor> |
| 95 | + image: <glance_image_name_or_location> |
| 96 | + serverGroupID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee <1> |
| 97 | + kind: OpenstackProviderSpec |
| 98 | + networks: |
| 99 | + - filter: {} |
| 100 | + subnets: |
| 101 | + - filter: |
| 102 | + name: <subnet_name> |
| 103 | + tags: openshiftClusterID=<infrastructure_ID> |
| 104 | + securityGroups: |
| 105 | + - filter: {} |
| 106 | + name: <infrastructure_ID>-<node_role> |
| 107 | + serverMetadata: |
| 108 | + Name: <infrastructure_ID>-<node_role> |
| 109 | + openshiftClusterID: <infrastructure_ID> |
| 110 | + tags: |
| 111 | + - openshiftClusterID=<infrastructure_ID> |
| 112 | + trunk: true |
| 113 | + userDataSecret: |
| 114 | + name: <node_role>-user-data |
| 115 | + availabilityZone: <optional_openstack_availability_zone> |
| 116 | +---- |
| 117 | +<1> Add the UUID of your server group here. |
| 118 | + |
| 119 | +. Optional: Back up the `manifests/99_openshift-cluster-api_worker-machineset-0.yaml` file. The installation program deletes the `manifests/` directory when creating the cluster. |
| 120 | + |
| 121 | +When you install the cluster, the installer uses the `MachineSet` definition that you modified to create compute machines within your {rh-openstack} server group. |
0 commit comments