Bug 1931217

Summary: [RFE] Installer should create RHV Affinity group for OCP cluster VMS
Product: OpenShift Container Platform Reporter: Gal Zaidman <gzaidman>
Component: InstallerAssignee: Gal Zaidman <gzaidman>
Installer sub component: OpenShift on RHV QA Contact: michal <mgold>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: mburman
Version: 4.8   
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:45:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1931215, 1959981, 1962274    
Bug Blocks:    

Description Gal Zaidman 2021-02-21 17:19:32 UTC
We want the installer to have the following behavior:

1.Default:
Create 2 unique affinity groups with a soft negative affinity rule:
- ovirt11-l6hq2-controlplane - contain the masters only and have a higher priority(5).
- ovirt11-l6hq2-cluster - contain all the machines the installer will create, priority(3).

2. No Affinity groups:
To not create any AffinityGroups the user needs to have an empty field on the install config for the control plain and compute nodes Like:
```yaml
compute:
- architecture: amd64
  name: worker
  platform:
    ovirt:
...
      memoryMB: 16000
      affinityGroups: []
...
controlPlane:
...
  platform:
    ovirt:
...
      memoryMB: 16000
      affinityGroups: []
...
```

3. Customize created affinity Groups:
The user can change the affinity groups names/priority or add more/less by editing the affinityGroups field, for example:
```yaml
compute:
- architecture: amd64
  name: worker
  platform:
    ovirt:
...
      memoryMB: 16000
      affinityGroups:
      - name: bla1
        priority: 1.0
      - name: bla2
        priority: 2.0
...
controlPlane:
...
  platform:
    ovirt:
...
      memoryMB: 16000
      affinityGroups:
      - name: bla3
        priority: 3.0
      - name: bla4
        priority: 4.0
...
```

** NOTE: All affinity groups that are created by the installer will have soft negative affinity rules

How to reproduce/test:

1. regular flow:
1.1
Install an OCP cluster with questions or with customizations but *dont* add any affinityGroupsNames field to the install config
expected outcome:

2 affinity groups are created with soft negative affinity rule with the names {cluster-name}-cluster and {cluster-name}-ocp-controlplane
only masters are on {cluster-name}-ocp-masters and all the machines are on {cluster-name}-ocp
{cluster-name}
-ocp-masters have higher priority then {cluster-name}-ocp

1.2 destroy the cluster
expected outcome:
affinity group should be removed

2. no affinity groups flow:
2.1
Install an OCP cluster with customizations and leave the affinityGroupsNames empty on compute and controlPlane
expected outcome:
cluster is installed and no affinity groups are created
2.2 destroy the cluster
expected outcome:
cluster is removed with no errors

3. create custom affinity groups:
3.1
Install an OCP cluster  with customizations and add affinity groups that you created in advance to the affinityGroupsNames field
expected outcome:
cluster is installed and the machines should be added to the corresponding affinity groups
3.2 destroy the cluster
expected outcome:
affinity group should not be removed

Comment 2 michal 2021-05-20 20:54:27 UTC
need to check also this scenario: based on the state of the cluster.  i.e., a three node cluster, but one of the nodes is in maintenance mode?  Probably a few other edge cases like, a host goes into maintenance mode whilst the cluster is being created.  Is that something we can handle.

Comment 3 michal 2021-05-24 16:11:23 UTC
check 3 scenarios 
maintenance host doesn't support in Affinity Group

Comment 6 errata-xmlrpc 2021-07-27 22:45:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438