+++ Description of problem: When creating a BMH resource without `inspect.metal3.io` annotation, the value is not being automatically set. +++ Steps to Reproduce: 1. Create BMH without `inspect.metal3.io: disabled` +++ Actual results: ``` # oc -n assisted-installer-bughunter-1 describe baremetalhost.metal3.io/ostest-worker-0 [...] Name: ostest-worker-0 Namespace: assisted-installer-bughunter-1 Labels: infraenvs.agent-install.openshift.io=myinfraenv-bughunter-1 Annotations: <none> API Version: metal3.io/v1alpha1 Kind: BareMetalHost [...] Provisioning: ID: 0fada510-dd4d-40b8-ada6-07aad06d41c8 Boot Mode: UEFI Image: URL: State: inspecting [...] Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Registered 3m23s metal3-baremetal-controller Registered new host Normal BMCAccessValidated 3m12s metal3-baremetal-controller Verified access to BMC Normal InspectionStarted 3m12s metal3-baremetal-controller Hardware inspection started [...] ``` In the UI machine goes into "inspecting" state. In the serial console it can be seen that the IPA is booted. +++ Expected results: ``` Name: ostest-worker-0 Namespace: assisted-installer-bughunter-1 Labels: infraenvs.agent-install.openshift.io=myinfraenv-bughunter-1 Annotations: inspect.metal3.io: disabled API Version: metal3.io/v1alpha1 Kind: BareMetalHost [...] Provisioning: ID: c808b2f8-b6f3-4d36-8826-d0416a407d1a Boot Mode: UEFI Image: Format: live-iso URL: https://assisted-service-assisted-installer-bughunter-1.apps.ostest.test.metalkube.org/api/assisted-install/v1/clusters/9856945c-eb2d-4758-b50f-ac478bc6d16d/downloads/image?api_key=e[...]w Root Device Hints: Device Name: /dev/sda State: provisioned [...] Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Registered 8m27s metal3-baremetal-controller Registered new host Normal InspectionSkipped 8m16s metal3-baremetal-controller disabled by annotation [...] ``` Machine should go directly into "provisioned" state.
For reference, this should happen when the `Image.URL` field is set in the BMH: https://github.com/openshift/assisted-service/blob/aed2da2b4a1608cf0b87520ce9a44ee9e49a57f1/internal/controller/controllers/bmh_agent_controller.go#L527 Wonder if the BMO may be overwriting this (and automatedCleaningMode) for some reason (considering that the annotation and the URL are set during the same step and only the former seems to be missing)
Verified with ocpmetal/assisted-service:d35ba1c854f4c4d43655ae2d3ee7778629501b08 Original annotation section: annotations: bmac.agent-install.openshift.io/hostname: "sno-0-0" bmac.agent-install.openshift.io/role: "master" BMH state transition: NAME STATE CONSUMER ONLINE ERROR sno-0-0 registering true sno-0-0 inspecting true sno-0-0 match profile true sno-0-0 preparing true sno-0-0 ready true sno-0-0 ready true sno-0-0 provisioning true sno-0-0 provisioned true sno-0-0 provisioned true Annotations after BMH was created: # oc get bmh/sno-0-0 -o json | jq -r '.metadata.annotations' { "baremetalhost.metal3.io/detached": "true", "bmac.agent-install.openshift.io/hostname": "sno-0-0", "bmac.agent-install.openshift.io/role": "master", "inspect.metal3.io": "disabled" } Events showing inspection disabled due to annotation: Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Registered 73s metal3-baremetal-controller Registered new host Normal BMCAccessValidated 63s metal3-baremetal-controller Verified access to BMC Normal InspectionSkipped 63s metal3-baremetal-controller disabled by annotation