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

[CAPI]Labels specified in a capi machineset couldn't propagate to nodes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • 4.17
    • None
    • Moderate
    • None
    • False
    • Hide

      None

      Show
      None

      Description of problem:

      Labels specified in a capi machineset couldn't propagate to nodes

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

      4.17

      How reproducible:

      100%    

      Steps to Reproduce:

      1. Install a cluster on GCP with TechPreviewNoUpgrade
      2. Create a new machineset and specify the node label to add  
      $ cat gcp-capi.yaml        
      ---
      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
      kind: GCPMachineTemplate
      metadata:
        name: capi-gcp-machine-template1
        namespace: openshift-cluster-api
      spec:
        template:
          metadata:
            labels:
              label3: label3
          spec:
            metadata:
              labels:
                label4: label4
            instanceType: n2-standard-4
            onHostMaintenance: Terminate
            restartPolicy: Never
            rootDeviceType: pd-ssd
            rootDeviceSize: 128
            image: projects/rhcos-cloud/global/images/rhcos-417-94-202407010929-0-gcp-x86-64
            subnet: zhsun-gcp18-gg6br-worker-subnet
            serviceAccount:
              email: zhsun-gcp18-gg6br-w@openshift-qe.iam.gserviceaccount.com
              scopes: https://www.googleapis.com/auth/cloud-platform
            additionalNetworkTags:
            - zhsun-gcp18-gg6br-worker
            additionalLabels:
              "kubernetes-io-cluster-zhsun-gcp18-gg6br": "owned"
            ipForwarding: Disabled
      ---
      apiVersion: cluster.x-k8s.io/v1beta1
      kind: MachineSet
      metadata:
        name: capi-ms1
        namespace: openshift-cluster-api
      spec:
        clusterName: zhsun-gcp18-gg6br
        replicas: 1
        selector:
          matchLabels:
            machine.openshift.io/cluster-api-cluster: zhsun-gcp18-gg6br
        template:
          metadata:
            labels:
              label5: label5
              machine.openshift.io/cluster-api-cluster: zhsun-gcp18-gg6br
          spec:
            metadata:
              labels:
                label6: label6
            deletePolicy: Newest
            bootstrap:
               dataSecretName: worker-user-data
            clusterName: zhsun-gcp18-gg6br
            failureDomain: us-central1-a
            infrastructureRef:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
              kind: GCPMachineTemplate
              name: capi-gcp-machine-template1  
      3. Check machine and node labels
           

      Actual results:

      cluster-reader couldn't view capi machine resources
      $ oc get gcpmachinetemplate capi-gcp-machine-template1 -o yaml
      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
      kind: GCPMachineTemplate
      metadata:
        name: capi-gcp-machine-template1
        namespace: openshift-cluster-api
      spec:
        template:
          metadata:
            labels:
              label3: label3
          spec:
            additionalLabels:
              kubernetes-io-cluster-zhsun-gcp18-gg6br: owned
            additionalNetworkTags:
            - zhsun-gcp18-gg6br-worker
            image: projects/rhcos-cloud/global/images/rhcos-417-94-202407010929-0-gcp-x86-64
            instanceType: n2-standard-4
            ipForwarding: Disabled
            onHostMaintenance: Terminate
            rootDeviceSize: 128
            rootDeviceType: pd-ssd
            subnet: zhsun-gcp18-gg6br-worker-subnet
      
      $ oc get machineset capi-ms1 -o yaml    
      apiVersion: cluster.x-k8s.io/v1beta1
      kind: MachineSet
      metadata:
        creationTimestamp: "2024-07-18T07:31:30Z"
        generation: 2
        labels:
          cluster.x-k8s.io/cluster-name: zhsun-gcp18-gg6br
        name: capi-ms1
        namespace: openshift-cluster-api
      spec:
        clusterName: zhsun-gcp18-gg6br
        deletePolicy: Random
        replicas: 1
        selector:
          matchLabels:
            cluster.x-k8s.io/cluster-name: zhsun-gcp18-gg6br
            machine.openshift.io/cluster-api-cluster: zhsun-gcp18-gg6br
        template:
          metadata:
            labels:
              cluster.x-k8s.io/cluster-name: zhsun-gcp18-gg6br
              label5: label5
              machine.openshift.io/cluster-api-cluster: zhsun-gcp18-gg6br
          spec:
            bootstrap:
              dataSecretName: worker-user-data
            clusterName: zhsun-gcp18-gg6br
            failureDomain: us-central1-a
            infrastructureRef:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
              kind: GCPMachineTemplate
              name: capi-gcp-machine-template1
      ...
      $ oc get machine capi-ms1-bsb56 -o yaml                                                                   
      apiVersion: cluster.x-k8s.io/v1beta1
      kind: Machine
      metadata:
        creationTimestamp: "2024-07-18T07:31:30Z"
        finalizers:
        - machine.cluster.x-k8s.io
        generation: 2
        labels:
          cluster.x-k8s.io/cluster-name: zhsun-gcp18-gg6br
          cluster.x-k8s.io/set-name: capi-ms1
          label5: label5
          machine.openshift.io/cluster-api-cluster: zhsun-gcp18-gg6br
        name: capi-ms1-bsb56
        namespace: openshift-cluster-api
      spec:
        bootstrap:
          dataSecretName: worker-user-data
        clusterName: zhsun-gcp18-gg6br
        failureDomain: us-central1-a
        infrastructureRef:
          apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: GCPMachine
          name: capi-ms1-bsb56
          namespace: openshift-cluster-api
          uid: 4ee94c72-b699-4267-a903-d8cff129d327
        nodeDeletionTimeout: 10s
        providerID: gce://openshift-qe/us-central1-a/capi-ms1-bsb56
      ...
        
        $ oc get node --show-labels         
      NAME                                                   STATUS   ROLES                  AGE     VERSION   LABELS
      capi-ms1-bsb56.us-central1-a.c.openshift-qe.internal   Ready    worker                 8m49s   v1.30.2   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=n2-standard-4,beta.kubernetes.io/os=linux,failure-domain.beta.kubernetes.io/region=us-central1,failure-domain.beta.kubernetes.io/zone=us-central1-a,kubernetes.io/arch=amd64,kubernetes.io/hostname=capi-ms1-bsb56.us-central1-a.c.openshift-qe.internal,kubernetes.io/os=linux,node-role.kubernetes.io/worker=,node.kubernetes.io/instance-type=n2-standard-4,node.openshift.io/os_id=rhcos,topology.gke.io/zone=us-central1-a,topology.kubernetes.io/region=us-central1,topology.kubernetes.io/zone=us-central1-a

      Expected results:

      Labels specified in a capi machineset could propagate to nodes

              joelspeed Joel Speed
              rhn-support-zhsun Zhaohua Sun
              Zhaohua Sun Zhaohua Sun
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: