add genericdocument compatible serialization of nodepools#5206
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates NodePool Cosmos DB persistence to support a migration from the current custom Cosmos document shape to a GenericDocument[api.HCPOpenShiftClusterNodePool]-compatible shape by inlining the internal API NodePool object into the stored document, while retaining legacy fields for backward compatibility.
Changes:
- Inline
api.HCPOpenShiftClusterNodePoolinto the stored NodePool document properties to make the document shape compatible withGenericDocument. - Update NodePool conversion logic to populate the new inlined field and adjust ETag propagation to avoid selector ambiguity introduced by embedding.
- Refresh integration-test Cosmos fixture JSON to include the newly persisted fields (id/name/type/systemData/provisioningState/serviceProviderProperties/etc).
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/09-cosmosCompare-confirm-update/nodepool-basic-node-pool.json | Updates expected Cosmos NodePool document to include inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/09-cosmosCompare-confirm-update/nodepool-02.json | Updates expected Cosmos NodePool document to include inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-node-pool-02.json | Updates “old data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-basic-node-pool.json | Updates “old data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-node-pool-02.json | Updates “create current” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-basic-node-pool.json | Updates “create current” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-node-pool-02.json | Updates migration “read new data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-basic-node-pool.json | Updates migration “read new data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-node-pool-02.json | Updates migration fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-basic-node-pool.json | Updates migration fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-node-pool-02.json | Updates migration “confirm migration” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-basic-node-pool.json | Updates migration “confirm migration” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-node-pool-02.json | Updates migration “load old data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-basic-node-pool.json | Updates migration “load old data” fixture to include new inlined NodePool fields. |
| test-integration/frontend/artifacts/FrontendCRUD/Cluster/delete-with-pending-nodepool-operation/05-cosmosCompare-final-state/nodepool-test-nodepool.json | Updates expected Cosmos NodePool document for delete scenario to include inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/remove_orphaned_nodepool_descendents/00-load-initial-state/nodepool-basic.json | Updates backend mismatch fixture to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/99-cosmosCompare-end-state/nodepool-basic.json | Updates backend mismatch fixture end-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/00-load-initial-state/nodepool-basic.json | Updates backend mismatch fixture initial-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/99-cosmosCompare-end-state/nodepool-basic.json | Updates backend mismatch fixture end-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/00-load-initial-state/nodepool-basic.json | Updates backend mismatch fixture initial-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/99-cosmosCompare-end-state/nodepool-basic.json | Updates backend mismatch fixture end-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/00-load-initial-state/nodepool-basic.json | Updates backend mismatch fixture initial-state to include new inlined NodePool fields. |
| test-integration/backend/controllers/mismatches/artifacts/cluster/remove_orphaned_cluster_descendents/00-load-initial-state/nodepool-basic.json | Updates backend mismatch fixture to include new inlined NodePool fields. |
| internal/database/types_nodepool.go | Embeds api.HCPOpenShiftClusterNodePool into NodePool document properties for GenericDocument compatibility. |
| internal/database/convert_nodepool.go | Populates the new embedded field and updates ETag mapping to avoid ambiguity from embedding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
We're not fiddling with unverifed fields in a serialization we're three commits from removing. |
|
/retest |
|
/lgtm |
|
|
||
| // some pieces of data in the internalNodePool conflict with ResourceDocument fields. We may evolve over time, but for | ||
| // now avoid persisting those. | ||
| cosmosObj.InternalState.InternalAPI.TrackedResource = arm.TrackedResource{ |
There was a problem hiding this comment.
Why are we removing this?
| // which is where we want to end up. | ||
| // * to be compatible with prior versions, we must continue writing all previous fields and this new field | ||
| // * to be compatible with prior versions, we must continue reading only from previous fields | ||
| api.HCPOpenShiftClusterNodePool `json:",inline"` |
There was a problem hiding this comment.
Is there some reason it's a value and not a pointer?
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
b1fbee1 to
4fdd053
Compare
|
simple rebase. reapplying lgtm |
|
/retest |
|
/label lgtm |
|
@deads2k: The label(s) 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 kubernetes-sigs/prow repository. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, stevekuznetsov 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 |
This stores all the data necessary to switch from custom cluster storage to the generic document storage for nodepools.
Part of a multi-step plan