Bug 1669081

Summary: [Cloud-CA] Failed to delete machineautoscaler if related machineset doesn't exist
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.1.0CC: brad.ison, jhou
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 10:42:08 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-01-24 09:44:59 UTC
Description of problem:
Failed to delete machineautoscaler if related machineset doesn't exist.

Version-Release number of selected component (if applicable):
clusterversion: 4.0.0-0.alpha-2019-01-24-003716

How reproducible:
Always

Steps to Reproduce:
1. Create a machineautoscaler which targets a node group zhsun-worker-us-east-2c
apiVersion: autoscaling.openshift.io/v1alpha1
kind: MachineAutoscaler
metadata:
  finalizers:
  - machinetarget.autoscaling.openshift.io
  name: autoscale-us-east-2c
  namespace: openshift-cluster-api
spec:
  maxReplicas: 3
  minReplicas: 1
  scaleTargetRef:
    apiVersion: cluster.k8s.io/v1alpha1
    kind: MachineSet
    name: worker-us-east-2a
status: {}
2. Delete machineset zhsun-worker-us-east-2c
3. Delete machineautoscaler
4. Check logs

Actual results:
Machineautoscaler couldn't be deleted.

$ oc get machineautoscaler
NAME                     REF KIND     REF NAME                  MIN       MAX       AGE
autoscale-us-east-2a     MachineSet   zhsun-worker-us-east-2a   1         2         1h
autoscale-us-east-2b     MachineSet   zhsun-worker-us-east-2b   1         2         1h
autoscale-us-east-2c     MachineSet   zhsun-worker-us-east-2c   1         2         3h

$ oc get machineset
NAME                      DESIRED   CURRENT   READY     AVAILABLE   AGE
zhsun-worker-us-east-2a   1         1         1         1           6h
zhsun-worker-us-east-2b   1         1         1         1           6h
zhsun-worker-us-east-2c   1         1         1         1           6h

$ oc delete machineset zhsun-worker-us-east-2c
machineset.cluster.k8s.io "zhsun-worker-us-east-2c" deleted

$ oc delete machineautoscaler autoscale-us-east-2c
machineautoscaler.autoscaling.openshift.io "autoscale-us-east-2c" deleted
^C

$ oc logs -f cluster-autoscaler-operator-8684bc9f5c-xnb57
I0123 10:00:30.193001       1 machineautoscaler_controller.go:102] Reconciling MachineAutoscaler openshift-cluster-api/autoscale-us-east-2c
E0123 10:00:30.197162       1 machineautoscaler_controller.go:123] Error getting target: machinesets.cluster.k8s.io "zhsun-worker-us-east-2c" not found

Expected results:
Machineautoscaler could be deleted.

Additional info:

Comment 1 Brad Ison 2019-01-30 09:38:27 UTC
This should be fixed by: https://github.com/openshift/cluster-autoscaler-operator/pull/33

Not-found errors no longer cause the finalizer to fail.

Comment 2 sunzhaohua 2019-02-02 05:49:07 UTC
Verified

$ oc delete machineset zhsun-worker-us-east-2a-a
machineset.cluster.k8s.io "zhsun-worker-us-east-2a-a" deleted

$ oc get machineautoscaler
NAME                   REF KIND     REF NAME                    MIN       MAX       AGE
autoscale-us-east-2a   MachineSet   zhsun-worker-us-east-2a-a   1         5         35s

$ oc delete machineautoscaler autoscale-us-east-2a
machineautoscaler.autoscaling.openshift.io "autoscale-us-east-2a" deleted

Comment 5 errata-xmlrpc 2019-06-04 10:42:08 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:0758