Also prevent node providerID reuse on node updates

Also prevent node providerID reuse on node updates

Tests have shown that nodes were re-using a providerID anyway, kubelet is probably setting providerID on a subsequent update after node creation.

It was observed on https://gitlab.com/sylva-projects/sylva-core/-/jobs/7290605914

Blacklist configmap was:

- apiVersion: v1
  data:
    mgmt-1365146692-kubeadm-capm3-virt-cp-484caafff1-7w9qp: ""
    mgmt-1365146692-kubeadm-capm3-virt-cp-484caafff1-gf9rj: ""
    mgmt-1365146692-kubeadm-capm3-virt-cp-484caafff1-khm46: ""
    mgmt-1365146692-kubeadm-capm3-virt-cp-484caafff1-pbv4l: ""
    mgmt-1365146692-kubeadm-capm3-virt-md-md0-4e4a7b1377-krjkc: ""
  kind: ConfigMap
  metadata:
    creationTimestamp: "2024-07-08T20:44:04Z"
    labels:
      kustomize.toolkit.fluxcd.io/name: cluster-node-provider-id-blacklist
      kustomize.toolkit.fluxcd.io/namespace: sylva-system

The new m3m was:

- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
  kind: Metal3Machine
  metadata:
    creationTimestamp: "2024-07-08T21:44:03Z"
    name: mgmt-1365146692-kubeadm-capm3-virt-md-md0-4e4a7b1377-zz9z9

But node was created with an old provideID:

- apiVersion: v1
  kind: Node
  metadata:
    creationTimestamp: "2024-07-08T21:46:39Z"  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    name: mgmt-1365146692-kubeadm-capm3-virt-management-md-0
    resourceVersion: "366894"
    uid: cd5ff722-ae17-4f87-8c8a-dbee1313da50
  spec:
    podCIDR: 100.72.4.0/24
    podCIDRs:
    - 100.72.4.0/24
    providerID: metal3://sylva-system/mgmt-1365146692-kubeadm-capm3-virt-management-md-0/mgmt-1365146692-kubeadm-capm3-virt-md-md0-4e4a7b1377-krjkc

Right before the bmh was provisionned:

    operationHistory:
      deprovision:
        end: "2024-07-08T21:48:15Z"
        start: "2024-07-08T21:48:04Z"
      inspect:
        end: "2024-07-08T20:31:07Z"
        start: "2024-07-08T20:27:56Z"
      provision:
        end: "2024-07-08T21:50:54Z"               <<<<<<<<<<<<<<<<<<<<<<<
        start: "2024-07-08T21:48:16Z"
      register:
        end: "2024-07-08T21:44:06Z"

In order to ease the troubleshooting of such issues in the future, add kyverno resources and reports to the CI artifacts.

Relates to: #1442 (closed)

Merge request reports

Loading