Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1800423

Summary: Remediation annotation should be applied to the Machine
Product: OpenShift Container Platform Reporter: Andrew Beekhof <abeekhof>
Component: Cloud ComputeAssignee: Alberto <agarcial>
Cloud Compute sub component: Other Providers QA Contact: Jianwei Hou <jhou>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: vlaad
Version: 4.4   
Target Milestone: ---   
Target Release: 4.4.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: 2020-05-15 16:03: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:
Bug Depends On: 1802956    
Bug Blocks:    

Description Andrew Beekhof 2020-02-07 02:54:15 UTC
Description of problem:

Currently the MHC uses a Node annotation to indicate that it requires external remediation.  

It is desirable for the controller that implements the remediation that it be applied to the Machine instead.  This is also consistent with the M in MHC.

See: https://github.com/openshift/machine-api-operator/pull/475

Version-Release number of selected component (if applicable): 4.4

Comment 2 Milind Yadav 2020-02-14 10:52:37 UTC
Description : MHC uses a Node annotation to indicate that it requires external remediation , desirable was to have the  controller that implements the remediation that should be applied to the Machine instead

Cluster Version Tested on :NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.4.0-0.nightly-2020-02-13-212616   True        False         7h19m   Cluster version is 4.4.0-0.nightly-2020-02-13-212616

Test Steps :

1.Create a machine health check using below yml 

apiVersion: machine.openshift.io/v1beta1
kind: MachineHealthCheck
metadata:
  creationTimestamp: '2020-02-14T09:47:08Z'
  generation: 1
  name: <User defined Name>
  namespace: openshift-machine-api
  resourceVersion: '71059'
  selfLink: >-
    /apis/machine.openshift.io/v1beta1/namespaces/openshift-machine-api/machinehealthchecks/mhc-miyadav-1402-drlvf-worker-us-east-2c
  uid: ef74b735-e58e-4c24-aa69-015d90998b77
spec:
  maxUnhealthy: 3
  selector:
    matchLabels:
      machine.openshift.io/cluster-api-cluster: <Your Cluster Name>
      machine.openshift.io/cluster-api-machine-role: worker
      machine.openshift.io/cluster-api-machine-type: worker
      machine.openshift.io/cluster-api-machineset: <Your Machine Set>
  unhealthyConditions:
    - status: 'False'
      timeout: 300s
      type: Ready
    - status: Unknown
      timeout: 300s
      type: Ready

Result : MHC created successfully

2.Annotate 'reboot' remediation strategy to the mhc
oc annotate mhc NAME healthchecking.openshift.io/strategy=reboot

Result : Annotation successful 

3.Go to cloud provider console, stop the machine instance of the machineset

Result : Machine should shutdown/stop.

4.Monitor machine-healthcheck-controller

Result :Remediation should trigger, but should not trigger delete. 
Instead, should add an annotation to the machine

5.oc get machine <Machine name of the machineset added to healthcheck> -o=jsonpath="{.metadata.annotations}"

Result : Annotation added successfully to machine
healthchecking.openshift.io/machine-remediation-reboot: ""