Skip to content

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

Merged
openshift-merge-bot[bot] merged 3 commits into
mainfrom
cs-131-basic-controllers
Feb 25, 2026
Merged

Create controller to pull serviceprovider data into cosmos from clust…#4167
openshift-merge-bot[bot] merged 3 commits into
mainfrom
cs-131-basic-controllers

Conversation

@deads2k

Copy link
Copy Markdown
Collaborator

…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 David Eads (deads2k) left a comment

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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator Author

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

@mbarnes

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator Author

/hold cancel

@deads2k

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
Collaborator

/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.
@openshift-ci openshift-ci Bot removed the lgtm label Feb 24, 2026
@openshift-ci

openshift-ci Bot commented Feb 24, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@openshift-ci

openshift-ci Bot commented Feb 24, 2026

Copy link
Copy Markdown

[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

Copy link
Copy Markdown
Collaborator Author

/test all

@openshift-merge-bot
openshift-merge-bot Bot merged commit 8213a0c into main Feb 25, 2026
13 of 14 checks passed
@openshift-merge-bot
openshift-merge-bot Bot deleted the cs-131-basic-controllers branch February 25, 2026 17:54
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.

3 participants