CNTRLPLANE-2939: Coordinate CRD lifecycle with Cluster CAPI Operator#8442
Conversation
When the ClusterAPI CRD (clusterapis.operator.openshift.io) is registered on the management cluster, the install command now: 1. Detects CCAPIO presence by checking for the ClusterAPI CRD 2. Gets-or-creates the ClusterAPI config singleton and populates unmanagedCustomResourceDefinitions with HyperShift's CAPI CRD names (those with groups ending in .cluster.x-k8s.io) 3. Validates all CRDs via server-side dry-run before applying, regardless of CCAPIO presence, to catch webhook rejections and schema conflicts early This prevents conflicts between HyperShift and CCAPIO when both attempt to manage the same CAPI CRDs on the management cluster. Ref: CNTRLPLANE-2939 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use JSON map for SSA patch payload instead of YamlSerializer to avoid zero-value serialization issues (ApplyConfiguration types for operator/v1alpha1 are not yet available in openshift/client-go) - Return metadata.generation from ensureUnmanagedCRDs and pass it to waitForCAPIOperatorSync to prevent false positives from stale reads - Add test case for stale object scenario Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@muraee: This pull request references CNTRLPLANE-2939 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: muraee The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-4.22 #8442 +/- ##
================================================
+ Coverage 34.76% 34.78% +0.02%
================================================
Files 767 767
Lines 93314 93434 +120
================================================
+ Hits 32442 32505 +63
- Misses 58196 58250 +54
- Partials 2676 2679 +3
🚀 New features to boost your workflow:
|
The vendored operatorv1alpha1.ClusterAPIStatus type on release-4.22 does not include the ObservedRevisionGeneration field. Switch waitForCAPIOperatorSync to read the ClusterAPI object as unstructured and extract status.observedRevisionGeneration, status.currentRevision, and status.desiredRevision from the raw map. This allows the backport to work without bumping the openshift/api dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1077b11 to
c2b52a7
Compare
|
/lgtm |
|
/verified bypass |
|
@muraee: The DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/uncc |
|
@muraee: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
7c6d1fb
into
openshift:release-4.22
Summary
hypershift installby setting unmanaged CRDs in the ClusterAPI singleton config and waiting for the operator to reconcilestatus.observedRevisionGenerationbecause the field is not present in the vendoredoperatorv1alpha1.ClusterAPIStatustype on release-4.22Changes from main
The
waitForCAPIOperatorSyncfunction reads the ClusterAPI object asunstructured.Unstructuredinstead of the typed struct, extractingobservedRevisionGeneration,currentRevision, anddesiredRevisionviaunstructured.NestedInt64/NestedString. Tests useinterceptor.Funcsto return unstructured objects directly, bypassing the fake client's typed round-trip.Test plan
go test ./cmd/install/ -v)go build ./cmd/install/)hypershift installon a cluster with Cluster CAPI Operator deployed