Bug 2041183 - Metal Day-1 When No Hostname is Provided by Either rDNS or DHCP, All Hosts are Named "localhost".
Summary: Metal Day-1 When No Hostname is Provided by Either rDNS or DHCP, All Hosts ar...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Bare Metal Hardware Provisioning
Version: 4.10
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.10.z
Assignee: sdasu
QA Contact: Yoav Porag
URL:
Whiteboard:
: 1859578 (view as bug list)
Depends On:
Blocks: 2048609
TreeView+ depends on / blocked
 
Reported: 2022-01-16 10:33 UTC by Yoav Porag
Modified: 2023-03-09 01:10 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-03-09 01:10:58 UTC
Target Upstream Version:
Embargoed:
yporagpa: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift image-customization-controller pull 35 0 None Merged Bug 2041183: Configure hostnames via ignition 2022-02-07 11:32:22 UTC
Github openshift image-customization-controller pull 48 0 None open Bug 2041183: Copy hostname into /sysroot/etc/NetworkManager/dispatcher.d also 2022-05-13 20:47:35 UTC

Description Yoav Porag 2022-01-16 10:33:40 UTC
Platform:

IPI on Baremetal

What happened?

In cases where no hostname is provided, host are automatically assigned the name "localhost" or "localhost.localdomain".

[kni@provisionhost-0-0 ~]$ oc get nodes
NAME                    STATUS   ROLES    AGE   VERSION
localhost.localdomain   Ready    master   31m   v1.22.1+6859754
master-0-1              Ready    master   39m   v1.22.1+6859754
master-0-2              Ready    master   39m   v1.22.1+6859754
worker-0-0              Ready    worker   12m   v1.22.1+6859754
worker-0-1              Ready    worker   12m   v1.22.1+6859754


What did you expect to happen?

Having all hosts come up as localhost is the worst possible user experience, because they'll fail to form a cluster but you won't know why.

However, we know the BMH name in the image-customization-controller, it would be possible to configure the ignition to set a default hostname if we don't have one from DHCP/DNS.

If not, we should at least fail the installation with a  specific error message to this situation.

----------
30/01/22 - adding how to reproduce
----------

How to Reproduce:

1)prepare and installation with day-1 static ip.

add to install-config uner one of the nodes:
        networkConfig:
          routes:
            config:
            - destination: 0.0.0.0/0
              next-hop-address: 192.168.123.1
              next-hop-interface: enp0s4
          dns-resolver:
            config:
              server:
              - 192.168.123.1
          interfaces:
          - name: enp0s4
            type: ethernet
            state: up
            ipv4:
              address:
              - ip: 192.168.123.110
                prefix-length: 24
              enabled: true


2)Ensure a DNS PTR for the address IS NOT configured.

3)create manifests and cluster from install-config.yaml

installation should either:
1)fail as early as possible, and provide some sort of feed back as to the fact that no hostname was provided.
2)derive the Hostname from the bmh or the ignition files

Comment 1 Zane Bitter 2022-01-17 16:03:36 UTC
The image provider receives the metadata of the PreprovisioningImage object, including its name (which is necessarily the same name as the BaremetalHost), which would be an appropriate default hostname:
https://github.com/openshift/image-customization-controller/blob/main/vendor/github.com/metal3-io/baremetal-operator/pkg/imageprovider/imageprovider.go#L14

We should be able to add something to the Ignition to write this name to /etc/hostname relatively easily. We only want to do this if the hostname is not already set by DHCP or DNS - setting it in a NetworkManger dispatcher script would certainly ensure it happens after DHCP; it's less clear to me whether this will also trigger at the right time if there is a hostname obtainable by DNS, or if we need to explicitly check that. Some experimentation would be required.

Comment 2 Zane Bitter 2022-01-17 16:06:12 UTC
When running from the entrypoint used by the installer, the name of the static input file is the name of the corresponding control plane BaremetalHost (with .yaml appended), so we can do it from there also.

Comment 4 Yoav Porag 2022-02-01 07:49:38 UTC
I have edited the install-config.yaml, without configuring the  DNS-PTR for the address.
while the installation fails this time (instead of completing successfully as it had before),
There is no explicit error message or indication for the problem, and the node is still created with the name "localhost".
I don't think that is sufficient to set the bug to verified.

moving back to assigned

Comment 5 Yoav Porag 2022-02-01 07:51:06 UTC
ERROR Bootstrap failed to complete: timed out waiting for the condition 
ERROR Failed to wait for bootstrapping to complete. This error usually happens when there is a problem with control plane hosts that prevents the control plane operators from creating the control plane. 
FATAL Bootstrap failed to complete  

[kni@provisionhost-0-0 ~]$ oc get nodes
NAME         STATUS     ROLES    AGE   VERSION
localhost    Ready      master   27m   v1.23.3+b63be7f
master-0-1   NotReady   master   29m   v1.23.3+b63be7f
master-0-2   NotReady   master   29m   v1.23.3+b63be7f

[core@localhost ~]$ sudo podman logs 9ef6bc8e46c0
{"level":"info","ts":1643630007.8435817,"logger":"static-server","msg":"Go Version: go1.17.2"}
{"level":"info","ts":1643630007.8436332,"logger":"static-server","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1643630007.8436408,"logger":"static-server","msg":"Git commit: unknown"}
{"level":"info","ts":1643630007.8436496,"logger":"static-server","msg":"Build time: unknown"}
{"level":"info","ts":1643630007.8436558,"logger":"static-server","msg":"Component: openshift/image-customization-controller was not built with version info"}
{"level":"info","ts":1643630008.355488,"logger":"static-server","msg":"serving","image":"openshift-master-0-0.iso","url":"http://0.0.0.0:8084/openshift-master-0-0.iso"}
{"level":"info","ts":1643630008.3556366,"logger":"static-server","msg":"serving","image":"openshift-master-0-0.initramfs","url":"http://0.0.0.0:8084/openshift-master-0-0.initramfs"}
{"level":"info","ts":1643630008.3561387,"logger":"static-server","msg":"serving","image":"openshift-master-0-1.iso","url":"http://0.0.0.0:8084/openshift-master-0-1.iso"}
{"level":"info","ts":1643630008.3561807,"logger":"static-server","msg":"serving","image":"openshift-master-0-1.initramfs","url":"http://0.0.0.0:8084/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630008.356444,"logger":"static-server","msg":"serving","image":"openshift-master-0-2.iso","url":"http://0.0.0.0:8084/openshift-master-0-2.iso"}
{"level":"info","ts":1643630008.3564823,"logger":"static-server","msg":"serving","image":"openshift-master-0-2.initramfs","url":"http://0.0.0.0:8084/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630008.3567357,"logger":"static-server","msg":"serving","image":"openshift-worker-0-0.iso","url":"http://0.0.0.0:8084/openshift-worker-0-0.iso"}
{"level":"info","ts":1643630008.3567905,"logger":"static-server","msg":"serving","image":"openshift-worker-0-0.initramfs","url":"http://0.0.0.0:8084/openshift-worker-0-0.initramfs"}
{"level":"info","ts":1643630008.3571296,"logger":"static-server","msg":"serving","image":"openshift-worker-0-1.iso","url":"http://0.0.0.0:8084/openshift-worker-0-1.iso"}
{"level":"info","ts":1643630008.3571677,"logger":"static-server","msg":"serving","image":"openshift-worker-0-1.initramfs","url":"http://0.0.0.0:8084/openshift-worker-0-1.initramfs"}
{"level":"info","ts":1643630030.5585206,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630030.7225447,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630030.7463865,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-0.initramfs"}
{"level":"info","ts":1643630030.7696705,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-0.initramfs"}
{"level":"info","ts":1643630030.7697961,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630030.7961042,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630197.1033564,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630197.1231475,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630197.1340601,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-2.initramfs"}
{"level":"info","ts":1643630197.2827077,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630197.290072,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630197.2976463,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-1.initramfs"}
{"level":"info","ts":1643630197.445514,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-0.initramfs"}
{"level":"info","ts":1643630197.455529,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-0.initramfs"}
{"level":"info","ts":1643630197.4720442,"logger":"ImageHandler","msg":"Open","path":"/openshift-master-0-0.initramfs"}

Comment 8 Zane Bitter 2022-02-07 14:21:31 UTC
The patch was not available in any nightly build at the time of comment #5, so this just needs retesting.

If a bug fails QA, please include the version tested so that we can determine which relevant patches are included.

Comment 10 Yoav Porag 2022-02-08 09:08:15 UTC
@sdasu @

Comment 11 Yoav Porag 2022-02-08 09:39:09 UTC
Setup installation without pre-configuring dns-ptr.

added to master-0-0 in install-config.yaml:
        networkConfig:
          routes:
            config:
            - destination: 0.0.0.0/0
              next-hop-address: 192.168.123.1
              next-hop-interface: enp0s4
          dns-resolver:
            config:
              server:
              - 192.168.123.1
          interfaces:
          - name: enp0s4
            type: ethernet
            state: up
            ipv4:
              address:
              - ip: 192.168.123.160
                prefix-length: 24
              enabled: true
              dhcp: false


Installation has completed successfully, behavior remains unchanged.

[kni@provisionhost-0-0 ~]$ oc get nodes
NAME         STATUS   ROLES    AGE   VERSION
localhost    Ready    master   25m   v1.23.3+d99c04f
master-0-1   Ready    master   34m   v1.23.3+d99c04f
master-0-2   Ready    master   34m   v1.23.3+d99c04f
worker-0-0   Ready    worker   14m   v1.23.3+d99c04f
worker-0-1   Ready    worker   14m   v1.23.3+d99c04f

[kni@provisionhost-0-0 ~]$ oc get clusterversion
NAME      VERSION                              AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.11.0-0.nightly-2022-02-07-154612   True        False         2m49s   Cluster version is 4.11.0-0.nightly-2022-02-07-154612


setting the bug back to ASSIGNED

Comment 12 Ben Nemec 2022-02-24 19:53:58 UTC
*** Bug 1859578 has been marked as a duplicate of this bug. ***

Comment 15 Shiftzilla 2023-03-09 01:10:58 UTC
OpenShift has moved to Jira for its defect tracking! This bug can now be found in the OCPBUGS project in Jira.

https://issues.redhat.com/browse/OCPBUGS-9072


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