Bug 1733471

Summary: [autoscaler] Update machineautoscaler targetting an invalid machineset should have the original machineset annotation been cleared
Product: OpenShift Container Platform Reporter: sunzhaohua <zhsun>
Component: Cloud ComputeAssignee: Brad Ison <brad.ison>
Status: CLOSED ERRATA QA Contact: sunzhaohua <zhsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: agarcial
Target Milestone: ---   
Target Release: 4.2.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: 2019-10-16 06:33:49 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:

Description sunzhaohua 2019-07-26 08:19:12 UTC
Description of problem:
If we allow to update machineautoscaler targetting an invalid machineset , then delete the machineautoscaler, the origin machineset annotations still exist.

Version-Release number of selected component (if applicable):
4.2.0-0.nightly-2019-07-25-053632

How reproducible:
Always

Steps to Reproduce:
1. Create a machineautoscaler targetting a valid machineset
apiVersion: autoscaling.openshift.io/v1beta1
kind: MachineAutoscaler
metadata:
  finalizers:
  - machinetarget.autoscaling.openshift.io
  name: machineautoscaler-c
  namespace: openshift-machine-api
spec:
  maxReplicas: 5
  minReplicas: 1
  scaleTargetRef:
    apiVersion: machine.openshift.io/v1beta1
    kind: MachineSet
    name: zhsun1-lpwf6-worker-us-east-2c
    
2. Edit machineautoscaler machineautoscaler-c targetting an invalid machineset
$ oc edit machineautoscaler machineautoscaler-c
apiVersion: autoscaling.openshift.io/v1beta1
kind: MachineAutoscaler
metadata:
  name: machineautoscaler-c
  namespace: openshift-machine-api
spec:
  maxReplicas: 5
  minReplicas: 1
  scaleTargetRef:
    apiVersion: machine.openshift.io/v1beta1
    kind: MachineSet
    name: zhsun1-lpwf6-worker-us-east-2c-invalid

3. Check machineset annotations 

Actual results:
Machineautoscaler targets an invalid group, but the original machineset annotations still exist, the cluster could scale up normally.


$ oc get machineset zhsun1-lpwf6-worker-us-east-2c -o yaml
metadata:
  annotations:
    autoscaling.openshift.io/machineautoscaler: openshift-machine-api/machineautoscaler-c
    machine.openshift.io/cluster-api-autoscaler-node-group-max-size: "5"
    machine.openshift.io/cluster-api-autoscaler-node-group-min-size: "1"


Expected results:
Updatting machineautoscaler targetting an invalid machineset should have the original machineset annotation been cleared.

Additional info:

Comment 2 sunzhaohua 2019-08-06 01:28:01 UTC
Verified

clusterversion: 4.2.0-0.nightly-2019-08-05-223032

1. Create a machineautoscaler targetting a valid machineset    
2. Edit machineautoscaler machineautoscaler-c targetting an invalid machineset
3. Check machineset annotations 

The annotations have been cleared.

Comment 3 errata-xmlrpc 2019-10-16 06:33:49 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, 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/RHBA-2019:2922