[wip] Add InstanceVersion for our persisted types#5398
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Every Create now sets InstanceVersion to 1 and every Replace increments it; Replace also refuses unconditional updates so callers must read an etag and pass it back. Behavior is centralized in PrepareForCreate / PrepareForReplace and called by every create/replace path in internal/database and the databasetesting mock. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces an InstanceVersion field for Cosmos-persisted resources and refactors several persisted resource document shapes to use database.GenericDocument[T]. It also tightens update semantics by requiring conditional replaces (ETag) and bumping InstanceVersion on writes, with corresponding updates to mocks/tests and many integration “cosmosCompare” artifacts.
Changes:
- Add
CosmosMetadata.InstanceVersionand enforce write-time invariants viaPrepareForCreate/PrepareForReplace(versioning + conditional Replace). - Migrate cluster/nodepool/externalauth persistence + listing/transaction read paths to
GenericDocument[T], removing older type-specific Cosmos wrappers/converters. - Update mocks/tests and integration artifacts to reflect the new stored JSON shape (notably removing legacy
intermediateResourceDoc/internalStatefields).
Reviewed changes
Copilot reviewed 131 out of 131 changed files in this pull request and generated 5 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 | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/09-cosmosCompare-confirm-update/nodepool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/read-old-data/01-load-old-data/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/create-current/06-cosmosCompare-confirm-content/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/cluster-deleting/02-loadCosmos-cluster/cosmos-01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/NodePool/cluster-creating/02-loadCosmos-cluster/cosmos-01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/18-cosmosCompare-confirm/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/read-new-data/01-load-old-data/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/99-cosmosCompare-confirm-migration/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-node-pool-02.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/nodepool-basic-node-pool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Migration/migrate-old-data/01-load-old-data/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/read-old-data/09-cosmosCompare-confirm-update/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/read-old-data/09-cosmosCompare-confirm-update/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/read-old-data/01-load-old-data/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/read-old-data/01-load-old-data/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/create-current/06-cosmosCompare-ending-content/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/create-current/06-cosmosCompare-ending-content/cluster-create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/cluster-deleting/02-loadCosmos-cluster/cosmos-01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/ExternalAuth/cluster-creating/02-loadCosmos-cluster/cosmos-01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/Cluster/read-old-data/01-load-old-data/create-with-tags.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Cluster/delete-with-pending-nodepool-operation/05-cosmosCompare-final-state/nodepool-test-nodepool.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Cluster/delete-with-pending-nodepool-operation/05-cosmosCompare-final-state/cluster-test-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/Cluster/delete-with-pending-cluster-operation/03-cosmosCompare-final-state/cluster-test-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/revoke/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/revoke-provisioning-conflict/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/revoke-forbidden-afec-pending/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/revoke-forbidden-afec-missing/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/request/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/FrontendCRUD/AdminCredentials/request-provisioning-conflict/01-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/12-untypedList-resourcegroup/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/10-untypedList-resourcegroup/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/09-untypedList-immutability-cluster/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/08-untypedListRecursive-immutability-cluster/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/07-untypedListRecursive-resourcegroup-via-child/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/07-untypedListRecursive-resourcegroup-via-child/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/07-untypedListRecursive-resourcegroup-via-child/basic-external-auth-auth.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/05-untypedListRecursive-subscription/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/05-untypedListRecursive-subscription/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/05-untypedListRecursive-subscription/basic-external-auth-auth.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/04-untypedListRecursive-resourcegroup/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/04-untypedListRecursive-resourcegroup/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/04-untypedListRecursive-resourcegroup/basic-external-auth-auth.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/02-untypedListRecursive-immutability/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/01-load-initial/immutability-np.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/01-load-initial/create-with-tags-cluster.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/frontend/artifacts/DatabaseCRUD/UntypedCRUD/basic/01-load-initial/basic-external-auth-auth.json | Update Cosmos snapshot (remove legacy internalState). |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/remove_orphaned_nodepool_descendents/99-cosmosCompare-end-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/remove_orphaned_nodepool_descendents/00-load-initial-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/remove_orphaned_nodepool_descendents/00-load-initial-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/99-cosmosCompare-end-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/nodepool/present_nodepool/00-load-initial-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/99-cosmosCompare-end-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/00-load-initial-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/remove_orphaned_externalauth_descendents/00-load-initial-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/present_externalauth/99-cosmosCompare-end-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/externalauth/present_externalauth/00-load-initial-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/controller_under_missing_nodepool_deleted/99-cosmosCompare-end-state/cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/controller_under_missing_nodepool_deleted/00-load-initial-state/cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/99-cosmosCompare-end-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/99-cosmosCompare-end-state/cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/00-load-initial-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/delete_orphaned_cosmos/all_parents_exist/00-load-initial-state/cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/cluster/remove_orphaned_cluster_descendents/00-load-initial-state/nodepool-basic.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/backend/controllers/mismatches/artifacts/cluster/remove_orphaned_cluster_descendents/00-load-initial-state/externalauth-default.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/admin/artifacts/AdminCRUD/HCP/lowercase-middleware/00-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/admin/artifacts/AdminCRUD/HCP/hello-world/00-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/admin/artifacts/AdminCRUD/HCP/cosmosdump/00-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| test-integration/admin/artifacts/AdminCRUD/HCP/breakglass/00-load-initial-cosmos-state/01-cluster.json | Update Cosmos snapshot (remove legacy intermediateResourceDoc / internalState). |
| internal/databasetesting/mock_resources_global_lister.go | Switch mock global listers to GenericDocument[T]-backed listers. |
| internal/databasetesting/mock_resources_db_client.go | Unmarshal stored docs as GenericDocument[T] and use generic conversion to internal types. |
| internal/databasetesting/mock_dbclient_test.go | Fix tests to use etag-bearing objects for conditional Replace. |
| internal/database/types_nodepool.go | Remove legacy NodePool Cosmos wrapper type. |
| internal/database/types_hcpcluster.go | Remove legacy cluster Cosmos wrapper type. |
| internal/database/types_externalauth.go | Remove legacy externalauth Cosmos wrapper type. |
| internal/database/transaction.go | Read transactional batch items via GenericDocument[T] casting. |
| internal/database/global_lister.go | Use GenericDocument[T] for cluster/nodepool/externalauth global listing. |
| internal/database/crud_nested_resource.go | Update nested CRUD type assertions to use GenericDocument[T]. |
| internal/database/crud_kube_applier_helpers.go | Enforce PrepareForCreate/Replace and unconditional If-Match for Replace operations. |
| internal/database/crud_helpers_test.go | Add unit tests for PrepareForCreate/PrepareForReplace versioning + etag invariants. |
| internal/database/crud_hcpcluster.go | Migrate cluster/nodepool/externalauth CRUD to use GenericDocument[T]. |
| internal/database/crud_fleet_helpers.go | Enforce PrepareForCreate/Replace and unconditional If-Match for fleet Replace operations. |
| internal/database/convert_nodepool.go | Remove legacy nodepool-specific converters. |
| internal/database/convert_externalauth.go | Remove legacy externalauth-specific converters. |
| internal/database/convert_cluster.go | Remove legacy cluster-specific converters. |
| internal/database/convert_any.go | Route Cosmos conversions through GenericDocument[T] for generic persisted types. |
| internal/database/convert_generic.go | Ensure defaults on readback and centralize generic conversion utilities. |
| internal/api/v20251223preview/conversion_fuzz_test.go | Exclude InstanceVersion from external round-trip fuzz expectations. |
| internal/api/v20240610preview/conversion_fuzz_test.go | Exclude InstanceVersion from external round-trip fuzz expectations. |
| internal/api/arm/types_cosmosdata.go | Add InstanceVersion field to persisted Cosmos metadata. |
| frontend/pkg/frontend/frontend.go | Carry stored ETag into Replace path (conditional updates). |
| backend/pkg/informers/informers_test.go | Update tests to perform conditional Replace by carrying ETags. |
| backend/pkg/controllers/managementclustercontrollers/management_cluster_migration_test.go | Update tests to use stored (etag-bearing) objects for Replace scenarios. |
| // Carry the etag of the just-read document forward so Replace | ||
| // is conditional on it; the DB layer refuses unconditional updates. | ||
| requestSubscription.CosmosETag = existingSubscription.CosmosETag |
| // Update sub-1. Carry the existing etag so Replace is conditional. | ||
| existing, err := mockResourcesDBClient.Subscriptions().Get(ctx, "sub-1") | ||
| require.NoError(t, err) | ||
| sub1Updated := &arm.Subscription{ | ||
| CosmosMetadata: arm.CosmosMetadata{ | ||
| ResourceID: mustParseResourceID(t, "/subscriptions/sub-1"), | ||
| CosmosETag: existing.CosmosETag, | ||
| }, | ||
| ResourceID: mustParseResourceID(t, "/subscriptions/sub-1"), | ||
| State: arm.SubscriptionStateWarned, | ||
| } | ||
| _, err := mockResourcesDBClient.Subscriptions().Replace(ctx, sub1Updated, nil) | ||
| _, err = mockResourcesDBClient.Subscriptions().Replace(ctx, sub1Updated, nil) |
| // Update cluster-1 state. Carry the existing etag so Replace is conditional. | ||
| existing, err := clusterCRUD.Get(ctx, "cluster-1") | ||
| require.NoError(t, err) | ||
| updated := newCluster(t, "cluster-1", arm.ProvisioningStateDeleting) | ||
| updated.CosmosETag = existing.CosmosETag |
| // Update np-1 replica count. Carry the existing etag so Replace is conditional. | ||
| existing, err := npCRUD.Get(ctx, "np-1") | ||
| require.NoError(t, err) | ||
| updated := newNodePool(t, "np-1", 10) | ||
| updated.CosmosETag = existing.CosmosETag |
| // non-terminal operations. Carry the existing etag so Replace is | ||
| // conditional. | ||
| existing, err := opCRUD.Get(ctx, "op-1") | ||
| require.NoError(t, err) | ||
| updated := newOperation(t, "op-1", arm.ProvisioningStateSucceeded) | ||
| updated.CosmosETag = existing.CosmosETag |
|
@deads2k: The following tests failed, say
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. |
|
this looks pretty good. |
There was a problem hiding this comment.
For the last commit:
/lgtm
I don't know of a compelling reason to go this route at this time, but I'll mention it FYI.
This looks like it could be a good fit for Cosmos DB pre-triggers, which is a snippet of JavaScript code that you can register through the Cosmos SDK to execute before specific operations like create or replace. (There's also post-triggers which run after.)
I know ARO Classic uses Cosmos DB triggers for things like lease management and setting bililng timestamps. Since all Cosmos DB access in ARO-HCP is going through the database Go module, I'm not sure the advantage would be significant enough to bother with... other than saving a bit of logic in present and future CRUD helpers.
Just a Cosmos DB feature to be aware of.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, mbarnes 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 |
|
PR needs rebase. 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. |
This version is incremented every time we mutate the value. This allows us to compare two instances from storage and know which one is more recent. This will allow us to use and a changefeed and a relist to determine whether an item is newer and should be placed into the cache.