Skip to content

read new fields for nodepool storage#5207

Merged
openshift-merge-bot[bot] merged 1 commit into
mainfrom
cs-173-read-new
May 19, 2026
Merged

read new fields for nodepool storage#5207
openshift-merge-bot[bot] merged 1 commit into
mainfrom
cs-173-read-new

Conversation

@deads2k
Copy link
Copy Markdown
Collaborator

@deads2k deads2k commented May 11, 2026

part of #5206, must merge after #5206 makes it prod

@deads2k
Copy link
Copy Markdown
Collaborator Author

deads2k commented May 11, 2026

/hold for #5206 to get to prod

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is part of the multi-step migration (following #5206) to store NodePool resources in the generic document–compatible “inline” shape (mirroring GenericDocument[api.HCPOpenShiftClusterNodePool]), and to treat CosmosMetadata.ResourceID as the canonical Cosmos identifier for nodepool persistence and reads.

Changes:

  • Inline-serialize api.HCPOpenShiftClusterNodePool into the NodePool Cosmos document properties and update nodepool DB conversions to read/write using that inline shape.
  • Plumb CosmosMetadata.ResourceID through nodepool creation/conversion paths (OCM conversion, frontend decode, tests) and update deep-copy/read-only copy behavior accordingly.
  • Refresh integration/unit test fixtures and comparers to reflect the new stored document shape (adds id, name, type, systemData, etc. in expected JSON).

Reviewed changes

Copilot reviewed 53 out of 53 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test-integration/utils/databasemutationhelpers/per_resource_comparer.go Ignore redundant internalState.internalAPI.cosmosMetadata during comparisons.
test-integration/frontend/informer_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/09-cosmosCompare-confirm-update/nodepool-basic-node-pool.json Update expected Cosmos nodepool document shape with inline fields (id, name, type, etc.).
test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/09-cosmosCompare-confirm-update/nodepool-02.json Update expected Cosmos nodepool document shape with inline fields (id, name, type, etc.).
test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-node-pool-02.json Update stored “old data” fixture to include inline nodepool fields.
test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-basic-node-pool.json Update stored “old data” fixture to include inline nodepool fields.
test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-node-pool-02.json Update expected Cosmos nodepool document shape for current create flow.
test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-basic-node-pool.json Update expected Cosmos nodepool document shape for current create flow.
test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-node-pool-02.json Update expected Cosmos shape for migration “read new data” verification.
test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-basic-node-pool.json Update expected Cosmos shape for migration “read new data” verification.
test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-node-pool-02.json Update migration fixture to include inline nodepool fields.
test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-basic-node-pool.json Update migration fixture to include inline nodepool fields.
test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-node-pool-02.json Update expected Cosmos shape for “confirm migration” step.
test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-basic-node-pool.json Update expected Cosmos shape for “confirm migration” step.
test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-node-pool-02.json Update “migrate old data” fixture to include inline fields.
test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-basic-node-pool.json Update “migrate old data” fixture to include inline fields.
test-integration/frontend/artifacts/FrontendCRUD/Cluster/delete-with-pending-nodepool-operation/05-cosmosCompare-final-state/nodepool-test-nodepool.json Update expected Cosmos nodepool doc shape during delete-with-pending-operation flow.
test-integration/backend/controllers/mismatches/artifacts/nodepool/remove_orphaned_nodepool_descendents/00-load-initial-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/99-cosmosCompare-end-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/00-load-initial-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/99-cosmosCompare-end-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/00-load-initial-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/99-cosmosCompare-end-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/00-load-initial-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
test-integration/backend/controllers/mismatches/artifacts/cluster/remove_orphaned_cluster_descendents/00-load-initial-state/nodepool-basic.json Update backend mismatch fixtures to new inline nodepool storage shape.
internal/ocm/convert.go Populate nodepool CosmosMetadata.ResourceID during CS→internal conversion.
internal/databasetesting/mock_dbclient_test.go Update mock nodepool construction to include CosmosMetadata.ResourceID.
internal/database/types_nodepool.go Inline api.HCPOpenShiftClusterNodePool into Cosmos NodePoolProperties for generic-doc compatibility.
internal/database/convert_nodepool.go Use CosmosMetadata.ResourceID as canonical for Cosmos partitioning/indexing; read from inline shape.
internal/database/convert_nodepool_test.go Adjust fuzzing/tests for new CosmosMetadata + ETag preservation path.
internal/database/convert_cluster_test.go Update generic round-trip helper to clear nodepool ExistingCosmosUID from CosmosMetadata.
internal/conversion/readonly_nodepool.go Preserve CosmosMetadata (resourceID/etag) across replace round-trips; remove old CosmosETag copying.
internal/api/zz_generated.deepcopy.go Deep-copy CosmosMetadata for nodepools.
internal/api/v20251223preview/zero_value_roundtrip_test.go Baseline nodepool now includes CosmosMetadata.ResourceID.
internal/api/v20251223preview/nodepools_methods.go Convert-to-external uses ResourceID for id; ConvertToInternal also sets ResourceID.
internal/api/v20251223preview/nodepools_methods_test.go Ensure nodepool tests include CosmosMetadata.ResourceID.
internal/api/v20251223preview/conversion_fuzz_test.go Add fuzzer customization for api.CosmosMetadata and adjust ExistingCosmosUID handling.
internal/api/v20240610preview/nodepools_methods.go Convert-to-external uses ResourceID for id; ConvertToInternal also sets ResourceID.
internal/api/v20240610preview/nodepools_methods_test.go Ensure nodepool tests include CosmosMetadata.ResourceID.
internal/api/v20240610preview/conversion_fuzz_test.go Add fuzzer customization for api.CosmosMetadata and adjust ExistingCosmosUID handling.
internal/api/types_nodepool.go Embed CosmosMetadata into nodepool internal type; remove legacy CosmosETag shim.
internal/admission/admit_cluster_test.go Ensure nodepool test objects include CosmosMetadata.ResourceID.
frontend/pkg/frontend/node_pool.go Set ResourceID on create; validate stored nodepool has CosmosMetadata.ResourceID on read.
backend/pkg/listertesting/slice_listers_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/informers/informers_test.go Ensure informer test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/upgradecontrollers/nodepool_version_controller_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/upgradecontrollers/control_plane_desired_version_controller_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/read_and_persist_nodepool_scoped_maestro_readonly_bundles_content_controller_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/operationcontrollers/test_helpers_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/nodepoolpropertiescontroller/node_pool_properties_sync_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/metricscontrollers/resource_metrics_controller_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/datadumpcontrollers/cs_state_dump_test.go Ensure test nodepools include CosmosMetadata.ResourceID.
backend/pkg/controllers/create_nodepool_scoped_maestro_readonly_bundles_controller_test.go Ensure test nodepools include CosmosMetadata.ResourceID.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +785 to 792
if internalNodePool.ResourceID == nil {
return nil, fmt.Errorf("stored nodepool document is missing cosmosMetadata.resourceID")
}
if !strings.EqualFold(internalNodePool.ResourceID.String(), resourceID.String()) {
return nil, fmt.Errorf("unexpected resourceID: %s", internalNodePool.ResourceID.String())
}
internalNodePool.ID = resourceID

Comment on lines 312 to 315
idString := ""
if from.ID != nil {
idString = from.ID.String()
if from.ResourceID != nil {
idString = from.ResourceID.String()
}
Comment on lines 304 to 307
idString := ""
if from.ID != nil {
idString = from.ID.String()
if from.ResourceID != nil {
idString = from.ResourceID.String()
}
},
}

cosmosObj.InternalState.InternalAPI.CosmosMetadata = api.CosmosMetadata{}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we now unsetting the cosmos obj CosmosMetadata top-level attribute as well as the one in InternalState.InternalAPI?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it because at some point we will stop having both the CosmosMetadata top-level attribute as well as InternalState.InternalAPI?

},
Location: cosmosObj.InternalState.InternalAPI.Location,
Tags: resourceDoc.Tags,
internalObj := cosmosObj.DeepCopy()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct/desired that calling DeepCopy of cosmosObj returns the internal api type? I understand this occurs because we now inline the internal api type on the cosmos type and because of that the DeepCopy method is promoted to the cosmos type, but it surprised me as usually when using the DeepCopy method on a type you expect the type itself being deepcopied and not just an inlined attribute of it.

Location: cosmosObj.InternalState.InternalAPI.Location,
Tags: resourceDoc.Tags,
internalObj := cosmosObj.DeepCopy()
internalObj.ExistingCosmosUID = cosmosObj.ID
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we do this because the one the inlined object that we retrieve from cosmos doesn't have that information? the same question applies to ETag and ResourceID

@deads2k deads2k changed the title switch to using generic storage for nodepools read new fields for nodepool storage May 18, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@deads2k
Copy link
Copy Markdown
Collaborator Author

deads2k commented May 18, 2026

/hold cancel

@deads2k
Copy link
Copy Markdown
Collaborator Author

deads2k commented May 18, 2026

query confirms all data is ready for this

@stevekuznetsov
Copy link
Copy Markdown
Contributor

/lgtm
/hold cancel

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 18, 2026

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [deads2k,stevekuznetsov]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD f64835f and 2 for PR HEAD f69ba4a in total

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD eb44277 and 1 for PR HEAD f69ba4a in total

@openshift-merge-bot openshift-merge-bot Bot merged commit d73e23c into main May 19, 2026
15 checks passed
@openshift-merge-bot openshift-merge-bot Bot deleted the cs-173-read-new branch May 19, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants