Skip to content

Comments

Create controller to pull serviceprovider data into cosmos from clust…#4167

Open
deads2k wants to merge 3 commits intomainfrom
cs-131-basic-controllers
Open

Create controller to pull serviceprovider data into cosmos from clust…#4167
deads2k wants to merge 3 commits intomainfrom
cs-131-basic-controllers

Conversation

@deads2k
Copy link
Collaborator

@deads2k deads2k commented Feb 20, 2026

…er-service

We will use this for the read path of frontend since the information is already asynchronous, so some delay is ok. We must get the backend change to prod first though, becuase otherwise we can have a frontend updated and backend not updated and be unable to ever get these values.

I have not yet reviewed this, but I think it's useful to illustrate a direction we're going to take for removing cluster-service from the read path so that we can move cluster-service creation to the backend.

/hold until I've reviewed (or if someone wants to review an AI created PR before me, but I wouldn't ask it)

opening this now so I don't lose it over the weekend.

@deads2k deads2k added the ai-assisted AI/LLM tool was used to help create this MR label Feb 20, 2026
@openshift-ci openshift-ci bot requested review from geoberle and janboll February 20, 2026 15:47
Copy link
Collaborator Author

@deads2k deads2k left a comment

Choose a reason for hiding this comment

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

huh, I can't request changes on my own PR. interesting.

needsBaseDomainPrefix := existingCluster.CustomerProperties.DNS.BaseDomainPrefix == ""

if !needsConsoleURL && !needsBaseDomain && !needsBaseDomainPrefix {
logger.Info("all properties already set, nothing to sync")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't log in the normal case

}

// Check if any of the properties need to be synced
needsConsoleURL := existingCluster.ServiceProviderProperties.Console.URL == ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

len(foo) == 0 is project standard

}
}

if !updated {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

use a deepequal of the entire thing rather than one by one


if needsBaseDomain {
baseDomain := csCluster.DNS().BaseDomain()
if baseDomain != "" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

len check is project standard.

return utils.TrackError(fmt.Errorf("failed to replace Cluster: %w", err))
}

logger.Info("successfully synced cluster properties from Cluster Service")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't love it, but it's rare at least.

}
}

func TestClusterPropertiesSyncer_SyncOnce_ClusterNotFound(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not a very useful test.

@deads2k
Copy link
Collaborator Author

deads2k commented Feb 20, 2026

lol. AI forgot to add it to main to actually run.

@deads2k deads2k force-pushed the cs-131-basic-controllers branch from 552c256 to 81a3555 Compare February 24, 2026 15:38
@mbarnes
Copy link
Collaborator

mbarnes commented Feb 24, 2026

What's here looks good.

I wonder if this controller could be extended to also populate the Cluster.Identity.UserAssignedIdentities map with client and principal IDs that Cluster Service currently fetches and supplies to the RP. Currently this happens on the fly in ocm.ConvertCStoHCPOpenShiftCluster.

@deads2k
Copy link
Collaborator Author

deads2k commented Feb 24, 2026

/hold cancel

@deads2k
Copy link
Collaborator Author

deads2k commented Feb 24, 2026

I wonder if this controller could be extended to also populate the Cluster.Identity.UserAssignedIdentities map with client and principal IDs that Cluster Service currently fetches and supplies to the RP. Currently this happens on the fly in ocm.ConvertCStoHCPOpenShiftCluster.

Good thought. We've actually got PRs stacked up that allow us to determine this directly from azure in the backend. I think it's #4193.

@mbarnes
Copy link
Collaborator

mbarnes commented Feb 24, 2026

/lgtm

…er-service

We will use this for the read path of frontend since the information is
already asynchronous, so some delay is ok.  We must get the backend
change to prod first though, becuase otherwise we can have a frontend
updated and backend not updated and be unable to ever get these values.
@deads2k deads2k force-pushed the cs-131-basic-controllers branch from 81a3555 to 5702af3 Compare February 24, 2026 20:23
@openshift-ci openshift-ci bot removed the lgtm label Feb 24, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 24, 2026

New changes are detected. LGTM label has been removed.

@openshift-ci
Copy link

openshift-ci bot commented Feb 24, 2026

[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

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

@deads2k deads2k added the lgtm label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted AI/LLM tool was used to help create this MR approved lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants