From 32a9943b84b62bde491b135bd6889c2bba58296c Mon Sep 17 00:00:00 2001 From: Alexandr Demicev Date: Tue, 21 May 2024 13:35:21 +0200 Subject: [PATCH] Add ADR explaining removal of kubebuilder defaults Signed-off-by: Alexandr Demicev --- .../0001-separate-CP-and-worker-versions.md | 2 +- .../0002-deprecate-kubebuilder-defaults.md | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 docs/adr/0002-deprecate-kubebuilder-defaults.md diff --git a/docs/adr/0001-separate-CP-and-worker-versions.md b/docs/adr/0001-separate-CP-and-worker-versions.md index f37db34..3d85e30 100644 --- a/docs/adr/0001-separate-CP-and-worker-versions.md +++ b/docs/adr/0001-separate-CP-and-worker-versions.md @@ -6,7 +6,7 @@ # 1. Separate Control Plane and Worker Versions -- Status: proposed +- Status: accepted - Date: 2024-05-20 - Authors: @Danil-Grigorev - Deciders: @alexander-demicev @furkatgofurov7 @salasberryfin @mjura @yiannistri diff --git a/docs/adr/0002-deprecate-kubebuilder-defaults.md b/docs/adr/0002-deprecate-kubebuilder-defaults.md new file mode 100644 index 0000000..6ff5245 --- /dev/null +++ b/docs/adr/0002-deprecate-kubebuilder-defaults.md @@ -0,0 +1,52 @@ + + + +- [Deprecate kubebuilder defaults](#deprecate-kubebuilder-defaults) + - [Context](#context) + - [Decision](#decision) + - [Consequences](#consequences) + + + +# Deprecate kubebuilder defaults + + + + +- Status: accepted +- Date: 2024-05-21 +- Authors: @alexander-demicev +- Deciders: @Danil-Grigorev @furkatgofurov7 @salasberryfin @mjura @yiannistri + +## Context + + +Enforcing default values for fields in CRD definitions can cause problem with the GitOps approach. It can lead to a situation where defined resources in Git repository differs from the actual state of applied resources in the cluster. This can lead to unexpected behavior like state drift, unless is manually handled. + +## Decision + + +Kubebuilder defaulting annotations were [deprecated in CAPRKE2 API](https://github.com/rancher-sandbox/cluster-api-provider-rke2/commit/86025754c0993e6e0d549110cc7f38687ac420e3). As a result of this deprecation +CRD definitions don't include default values for some fields. + +## Consequences + + +Users have to specify the following fields manually when creating RKE2ControlPlane resources: + +- `spec.rolloutStrategy`: + +```yaml + rolloutStrategy: + type: "RollingUpdate" + rollingUpdate: + maxSurge: 1 # can be 0 +``` + +- `spec.registrationMethod`: + +```yaml + registrationMethod: + type: "control-plane-endpoint" # other supported values are "internal-only-ips", "external-only-ips", "address", "internal-first" +``` +`"control-plane-endpoint"` is the recommended value for `registrationMethod` field as other can cause issue with scaling the cluster and should be used with caution. \ No newline at end of file