Skip to content

allow missing cluster service cluster ID - #4752

Merged
openshift-merge-bot[bot] merged 8 commits into
mainfrom
cs-152-allow-missing-cluster-service-id
Apr 22, 2026
Merged

openshift-merge-bot[bot] merged 8 commits into
mainfrom
cs-152-allow-missing-cluster-service-id

Conversation

@deads2k

@deads2k David Eads (deads2k) commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Necessary for moving creation to the backend.

Critically, we never serialize a nil, we keep it as an empty. This allows the n-1 level (if we need to revert) to read data created by the new version. This version reads and tolerates nil, so the n+1 version can write the nil.

@openshift-ci

openshift-ci Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Comment thread frontend/pkg/frontend/cluster.go Outdated
database.OperationRequestCreate,
newInternalCluster.ID,
newInternalCluster.ServiceProviderProperties.ClusterServiceID,
*newInternalCluster.ServiceProviderProperties.ClusterServiceID,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

need to track down operation clsuter-service-id usage to handle empty.

@machi1990

Copy link
Copy Markdown
Collaborator

Jakob Gray (@JakobGray) PTAL, this is relevant for the work around moving cluster creation to the backend.

/assign Jakob Gray (@JakobGray)

@deads2k
David Eads (deads2k) force-pushed the cs-152-allow-missing-cluster-service-id branch from dd66af0 to 9728a5a Compare April 6, 2026 19:17
@deads2k
David Eads (deads2k) force-pushed the cs-152-allow-missing-cluster-service-id branch from 9728a5a to 1f0df3d Compare April 6, 2026 19:29
@deads2k

Copy link
Copy Markdown
Collaborator Author

/retest

Comment on lines +70 to +72
// we do this to keep serialization the same so that we can go to n-1 where this field isn't a pointer.
// on the reading side, we handle the pointer as expected.
cosmosObj.InternalState.InternalAPI.ServiceProviderProperties.ClusterServiceID = &api.InternalID{}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

critical part of the PR

Comment thread internal/api/types_cluster.go Outdated
// TODO should we take into account that at some point in the future we will implement migration between management
// clusters, where a cluster could have bundles allocated to different provision shards at the same time?
clusterCSShard, err := c.clusterServiceClient.GetClusterProvisionShard(ctx, cluster.ServiceProviderProperties.ClusterServiceID)
clusterCSShard, err := c.clusterServiceClient.GetClusterProvisionShard(ctx, *cluster.ServiceProviderProperties.ClusterServiceID)

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.

@deads2k
David Eads (deads2k) force-pushed the cs-152-allow-missing-cluster-service-id branch from 1f0df3d to e93d6fc Compare April 7, 2026 20:59
Comment thread frontend/pkg/frontend/external_auth.go
Comment thread internal/api/types_cluster.go Outdated
}
clustersByClusterServiceID := make(map[string]*api.HCPOpenShiftCluster)
for _, internalCluster := range internalClusterIterator.Items(ctx) {
if internalCluster.ServiceProviderProperties.ClusterServiceID == nil {

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.

Does this mean ArmResourceListClusters will omit clusters that still don't have the CS ID set? it could be confusing to consumers of the API endpoint, just to be aware

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Does this mean ArmResourceListClusters will omit clusters that still don't have the CS ID set? it could be confusing to consumers of the API endpoint, just to be aware

It goes away in #4610

Comment thread frontend/pkg/frontend/cluster.go Outdated
Comment thread frontend/pkg/frontend/cluster.go
logger.Info("clusterService cluster missing, trying to clean up", "err", err)
} else if err != nil {
return utils.TrackError(err)
if cluster.ServiceProviderProperties.ClusterServiceID != nil {

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Similar answer

Comment thread frontend/pkg/frontend/cluster.go
// TODO this overwrite will transformed into a "set" function as we transition fields to ownership in cosmos
// TODO remove the azure location once we have migrated every record to store the location
func mergeToInternalCluster(csCluster *arohcpv1alpha1.Cluster, internalCluster *api.HCPOpenShiftCluster, azureLocation string) (*api.HCPOpenShiftCluster, error) {
if csCluster == nil {

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.

Have we analyzed the implications of this nil check and error in mergeToInternalCluster and readInternalClusterFromClusterService from consumer code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Function goes away in #4610, which has to merge before actually write the nil, so it will self-solve

@deads2k
David Eads (deads2k) force-pushed the cs-152-allow-missing-cluster-service-id branch from 780f1e0 to a288ef3 Compare April 21, 2026 19:18
@openshift-ci

openshift-ci Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

David Eads (@deads2k): The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/cspr cefc148 link true /test cspr
ci/prow/images-push cefc148 link true /test images-push

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@miguelsorianod

Copy link
Copy Markdown
Collaborator

/lgtm

@openshift-ci

openshift-ci Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, miguelsorianod

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:

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

@miguelsorianod

Copy link
Copy Markdown
Collaborator

/retest

@openshift-merge-bot
openshift-merge-bot Bot merged commit c0a79f7 into main Apr 22, 2026
15 of 21 checks passed
@openshift-merge-bot
openshift-merge-bot Bot deleted the cs-152-allow-missing-cluster-service-id branch April 22, 2026 16:04
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