kubernetes-sigs / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
299 stars 65 forks source link

🐛 Fix cancelFunc on cluster init and fix node Patch #309

Closed m-messiah closed 1 year ago

m-messiah commented 1 year ago

What this PR does / why we need it: The PR fixes two bugs found in syncer:

  1. cancelFunc is not initialised in the cluster before runCluster method, which sometimes leads to nil-pointer panic when we want to remove virtualcluster with the broken control-plane. I initialize it to a noop func to avoid panic. (I found the same broken cluster, removed it and there are no panic in syncer then)
  2. Node Patch for Status and Spec leads to conflicts as patch status implicitly updates ObjectMeta too (labels and ResourceVersion), and spec update then fails with "object is modified". The PR ensures Status patch is for Status only and the Spec + Label patch is for Spec and Labels only.
k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christopherhein, m-messiah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[virtualcluster/OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/OWNERS)~~ [christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment