Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-37552

edit nncp to update dns nameserver failed

XMLWordPrintable

    • Moderate
    • Yes
    • False
    • Hide

      None

      Show
      None
    • Release Note Not Required
    • In Progress

      This is a clone of issue OCPBUGS-37551. The following is the description of the original issue:

      This is a clone of issue OCPBUGS-37550. The following is the description of the original issue:

      This is a clone of issue OCPBUGS-30955. The following is the description of the original issue:

      Description of problem:

      apply nncp to configure DNS, then edit nncp to update nameserver, but /etc/resolv.conf is not updated.

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

      OCP version: 4.16.0-0.nightly-2024-03-13-061822
      knmstate operator version: kubernetes-nmstate-operator.4.16.0-202403111814

      How reproducible:

      always

      Steps to Reproduce:

      1. install knmstate operator
      2. apply below nncp to configure dns on one of the node
      ---
      apiVersion: nmstate.io/v1
      kind: NodeNetworkConfigurationPolicy
      metadata:
        name: dns-staticip-4
      spec:
        nodeSelector:
          kubernetes.io/hostname: qiowang-031510-k4cjs-worker-0-rw4nt
        desiredState:
          dns-resolver:
            config:
              search:
              - example.org
              server:
              - 192.168.221.146
              - 8.8.9.9
          interfaces:
          - name: dummy44
            type: dummy
            state: up
            ipv4:
              address:
              - ip: 192.0.2.251
                prefix-length: 24
              dhcp: false
              enabled: true
              auto-dns: false
      % oc apply -f dns-staticip-noroute.yaml 
      nodenetworkconfigurationpolicy.nmstate.io/dns-staticip-4 created
      % oc get nncp
      NAME             STATUS      REASON
      dns-staticip-4   Available   SuccessfullyConfigured
      % oc get nnce
      NAME                                                 STATUS      STATUS AGE   REASON
      qiowang-031510-k4cjs-worker-0-rw4nt.dns-staticip-4   Available   5s           SuccessfullyConfigured
      
      
      3. check dns on the node, dns configured correctly
      sh-5.1# cat /etc/resolv.conf 
      # Generated by KNI resolv prepender NM dispatcher script
      search qiowang-031510.qe.devcluster.openshift.com example.org
      nameserver 192.168.221.146
      nameserver 192.168.221.146
      nameserver 8.8.9.9
      # nameserver 192.168.221.1
      sh-5.1# 
      sh-5.1# cat /var/run/NetworkManager/resolv.conf 
      # Generated by NetworkManager
      search example.org
      nameserver 192.168.221.146
      nameserver 8.8.9.9
      nameserver 192.168.221.1
      sh-5.1# 
      sh-5.1# nmcli | grep 'DNS configuration' -A 10
      DNS configuration:
      	servers: 192.168.221.146 8.8.9.9
      	domains: example.org
      	interface: dummy44
      ... ...
      
      
      4. edit nncp, update nameserver, save the modification
      ---
      spec:
        desiredState:
          dns-resolver:
            config:
              search:
              - example.org
              server:
              - 192.168.221.146
              - 8.8.8.8       <---- update from 8.8.9.9 to 8.8.8.8
          interfaces:
          - ipv4:
              address:
              - ip: 192.0.2.251
                prefix-length: 24
              auto-dns: false
              dhcp: false
              enabled: true
            name: dummy44
            state: up
            type: dummy
        nodeSelector:
          kubernetes.io/hostname: qiowang-031510-k4cjs-worker-0-rw4nt
      % oc edit nncp dns-staticip-4
      nodenetworkconfigurationpolicy.nmstate.io/dns-staticip-4 edited
      % oc get nncp
      NAME             STATUS      REASON
      dns-staticip-4   Available   SuccessfullyConfigured
      % oc get nnce
      NAME                                                 STATUS      STATUS AGE   REASON
      qiowang-031510-k4cjs-worker-0-rw4nt.dns-staticip-4   Available   8s           SuccessfullyConfigured
      
      
      5. check dns on the node again

      Actual results:

      the dns nameserver in file /etc/resolv.conf is not updated after nncp updated, file /var/run/NetworkManager/resolv.conf updated correctly: 
      
      sh-5.1# cat /etc/resolv.conf 
      # Generated by KNI resolv prepender NM dispatcher script
      search qiowang-031510.qe.devcluster.openshift.com example.org
      nameserver 192.168.221.146
      nameserver 192.168.221.146
      nameserver 8.8.9.9        <---- it is not updated
      # nameserver 192.168.221.1
      sh-5.1# 
      sh-5.1# cat /var/run/NetworkManager/resolv.conf 
      # Generated by NetworkManager
      search example.org
      nameserver 192.168.221.146
      nameserver 8.8.8.8        <---- updated correctly
      nameserver 192.168.221.1
      sh-5.1# 
      sh-5.1# nmcli | grep 'DNS configuration' -A 10
      DNS configuration:
      	servers: 192.168.221.146 8.8.8.8
      	domains: example.org
      	interface: dummy44
      ... ...

      Expected results:

      the dns nameserver in file /etc/resolv.conf can be updated accordingly

      Additional info:

       

            mkowalsk@redhat.com Mat Kowalski
            openshift-crt-jira-prow OpenShift Prow Bot
            Qiong Wang Qiong Wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: