Skip to content

Commit 90c4712

Browse files
authored
Merge pull request #11153 from sbueringer/pr-clarify-kcp-pre-terminate
📖 Add more documentation about the KCP pre-terminate hook
2 parents eebff7b + 589cbe0 commit 90c4712

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

api/v1beta1/machine_types.go

+9
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ const (
6161
// search each annotation for during the pre-terminate.delete lifecycle hook
6262
// to pause reconciliation of deletion. These hooks will prevent removal of
6363
// an instance from an infrastructure provider until all are removed.
64+
//
65+
// Notes for Machines managed by KCP (starting with Cluster API v1.8.2):
66+
// * KCP adds its own pre-terminate hook on all Machines it controls. This is done to ensure it can later remove
67+
// the etcd member right before Machine termination (i.e. before InfraMachine deletion).
68+
// * Starting with Kubernetes v1.31 the KCP pre-terminate hook will wait for all other pre-terminate hooks to finish to
69+
// ensure it runs last (thus ensuring that kubelet is still working while other pre-terminate hooks run). This is only done
70+
// for v1.31 or above because the kubeadm ControlPlaneKubeletLocalMode was introduced with kubeadm 1.31. This feature configures
71+
// the kubelet to communicate with the local apiserver. Only because of that the kubelet immediately starts failing after the etcd
72+
// member is removed. We need the ControlPlaneKubeletLocalMode feature with 1.31 to adhere to the kubelet skew policy.
6473
PreTerminateDeleteHookAnnotationPrefix = "pre-terminate.delete.hook.machine.cluster.x-k8s.io"
6574

6675
// MachineCertificatesExpiryDateAnnotation annotation specifies the expiry date of the machine certificates in RFC3339 format.

docs/book/src/developer/providers/migrations/v1.8-to-v1.9.md

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ maintainers of providers and consumers of our Go API.
1717

1818
### Other
1919

20+
- Notes for Machines managed by KCP (starting with Cluster API v1.8.2):
21+
- KCP adds its own pre-terminate hook on all Machines it controls. This is done to ensure it can later remove
22+
the etcd member right before Machine termination (i.e. before InfraMachine deletion).
23+
- Starting with Kubernetes v1.31 the KCP pre-terminate hook will wait for all other pre-terminate hooks to finish to
24+
ensure it runs last (thus ensuring that kubelet is still working while other pre-terminate hooks run). This is only done
25+
for v1.31 or above because the kubeadm ControlPlaneKubeletLocalMode was introduced with kubeadm 1.31. This feature configures
26+
the kubelet to communicate with the local apiserver. Only because of that the kubelet immediately starts failing after the etcd
27+
member is removed. We need the ControlPlaneKubeletLocalMode feature with 1.31 to adhere to the kubelet skew policy.
28+
2029
### Suggested changes for providers
2130

2231
- The Errors package was created when capi provider implementation was running as machineActuators that needed to vendor core capi to function. There is no usage recommendations today and its value is questionable since we moved to CRDs that inter-operate mostly via conditions. Instead we plan to drop the dedicated semantic for terminal failure and keep improving Machine lifecycle signal through conditions. Therefore the Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommented to remove any usage of the currently exported variables.

0 commit comments

Comments
 (0)