Bug 1968382 - [master] Creating BareMetalHost without the "inspect.metal3.io" does not automatically add it
Summary: [master] Creating BareMetalHost without the "inspect.metal3.io" does not auto...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: assisted-installer
Version: 4.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Flavio Percoco
QA Contact: Trey West
URL:
Whiteboard: AI-Team-Platform KNI-EDGE-JUKE-4.8
Depends On:
Blocks: 1969352
TreeView+ depends on / blocked
 
Reported: 2021-06-07 08:50 UTC by Mat Kowalski
Modified: 2022-08-28 08:45 UTC (History)
3 users (show)

Fixed In Version: OCP-Metal-v1.0.22.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-28 08:45:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift assisted-service pull 1948 0 None open OCPBUGSM-30084 Always disable inspection and cleaning for BMH 2021-06-08 09:45:41 UTC

Description Mat Kowalski 2021-06-07 08:50:01 UTC
+++ 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.

Comment 1 Flavio Percoco 2021-06-08 08:10:50 UTC
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)

Comment 2 Trey West 2021-06-11 14:18:48 UTC
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


Note You need to log in before you can comment on or make changes to this bug.