Commit 62d68e1
authored
feat: Implement CAPI v1beta1 compliant status handling and initial v1beta2 support for K0smotronControlPlane (#1090)
* feat: Set default empty string for K0smotronControlPlane status.version to comply with CAPI
Set default value for status.version to empty string to comply with CAPI
requirements. CAPI specification mandates that status.version must be an
empty string (not null) until ControlPlane creation is complete.
- Add kubebuilder:default annotation to Status field
- Ensures CAPI compliance for status.version initialization
Signed-off-by: kahirokunn <[email protected]>
* feat: implement CAPI v1beta1 compliant control plane status handling
- Add proper default values for status.ready and status.initialized
- Implement API server ping-based availability checking
- Set status fields only after successful control plane verification
- Update cluster client naming for consistency
Ensures compliance with Cluster API v1beta1 status contract requirements.
Signed-off-by: kahirokunn <[email protected]>
* feat: Add CAPI v1beta2 initialization.controlPlaneInitialized field
Add initialization.controlPlaneInitialized field to K0sControlPlane and
K0smotronControlPlane status for CAPI v1beta2 compatibility.
- Add Initialization struct with controlPlaneInitialized field
- Update status adapters to handle the new field
- Set controlPlaneInitialized=true when API becomes available
- Update CRD schemas with default values and field definitions
Signed-off-by: kahirokunn <[email protected]>
* feat: add Conditions support to K0smotronControlPlane and unify availability computation
- Add Conditions field to K0smotronControlPlane to support v1beta2 semantics
- Support both v1beta1 and v1beta2 specifications simultaneously
- Update CRD definitions and deepcopy methods accordingly
This change prepares for the 1-year coexistence period of v1beta1 and v1beta2,
ensuring proper status management while maintaining backward compatibility.
Signed-off-by: kahirokunn <[email protected]>
* Fix cluster annotation persistence in K0smotronController to match K0sController
The K0smotronController was creating a new cluster object in computeStatus instead
of using the original one passed from Reconcile, causing annotations added in
computeAvailability (specifically k0sproject.io/cluster-id) to be lost.
This inconsistency with K0sController's correct implementation caused CI tests
to loop indefinitely waiting for the annotation that would never be persisted.
Changes:
- Pass the original cluster object from Reconcile through to computeAvailability
This aligns K0smotronController with the correct pattern already used in K0sController.
Signed-off-by: kahirokunn <[email protected]>
* test: Add e2e test for K0smotronControlPlane conditions
This test verifies the ControlPlaneReadyCondition lifecycle:
- Initially starts as False when cluster is created
- Transitions to True when the control plane API is available
- Validates the condition status and cluster ready state
The test ensures the condition functionality works correctly
in real cluster environments.
Signed-off-by: kahirokunn <[email protected]>
---------
Signed-off-by: kahirokunn <[email protected]>1 parent 96b0846 commit 62d68e1
File tree
12 files changed
+553
-29
lines changed- .github/workflows
- api/controlplane/v1beta1
- config
- clusterapi/controlplane/bases
- crd/bases/controlplane
- docs/resource-reference
- e2e
- internal/controller/controlplane
12 files changed
+553
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
| |||
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
96 | 122 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
365 | 369 | | |
366 | 370 | | |
367 | 371 | | |
| |||
413 | 417 | | |
414 | 418 | | |
415 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
416 | 429 | | |
417 | 430 | | |
418 | 431 | | |
| |||
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4587 | 4587 | | |
4588 | 4588 | | |
4589 | 4589 | | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
| 4601 | + | |
4590 | 4602 | | |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + | |
| 4607 | + | |
| 4608 | + | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
4591 | 4648 | | |
4592 | 4649 | | |
4593 | 4650 | | |
4594 | 4651 | | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
| 4659 | + | |
| 4660 | + | |
4595 | 4661 | | |
4596 | 4662 | | |
4597 | 4663 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
365 | 369 | | |
366 | 370 | | |
367 | 371 | | |
| |||
413 | 417 | | |
414 | 418 | | |
415 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
416 | 429 | | |
417 | 430 | | |
418 | 431 | | |
| |||
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4587 | 4587 | | |
4588 | 4588 | | |
4589 | 4589 | | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
| 4601 | + | |
4590 | 4602 | | |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + | |
| 4607 | + | |
| 4608 | + | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
4591 | 4648 | | |
4592 | 4649 | | |
4593 | 4650 | | |
4594 | 4651 | | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
| 4659 | + | |
| 4660 | + | |
4595 | 4661 | | |
4596 | 4662 | | |
4597 | 4663 | | |
| |||
0 commit comments