Skip to content

[WIP] Create new Deny Assignment backend controller - #4046

Open
rogbas wants to merge 1 commit into
mainfrom
rogbas-deny-assignment-controller
Open

[WIP] Create new Deny Assignment backend controller#4046
rogbas wants to merge 1 commit into
mainfrom
rogbas-deny-assignment-controller

Conversation

@rogbas

@rogbas rogbas commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@openshift-ci
openshift-ci Bot requested review from janboll and mbarnes February 9, 2026 22:49
@rogbas
rogbas requested review from SudoBrendan and removed request for SudoBrendan, janboll and mbarnes February 9, 2026 22:50
@rogbas
rogbas force-pushed the rogbas-deny-assignment-controller branch from 084b007 to 0aa9bbf Compare February 10, 2026 17:20

// isClusterReadyForDenyAssignments checks if a cluster is in a state where
// deny assignments should be managed
func isClusterReadyForDenyAssignments(cluster *api.HCPOpenShiftCluster) bool {

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.

Same comment as the one I left in #3970 (comment)

i.e not relying on the state to perform the deny assignment creation but the presence of the MRG in azure

return nil
}
if err != nil {
return fmt.Errorf("failed to get HCP cluster: %w", err)

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.

Let's use TrackEror(...) throughout; same as #3970 (comment)

}

// SyncOnce reconciles deny assignments for a single cluster
func (s *denyAssignmentSyncer) SyncOnce(ctx context.Context, key controllerutils.HCPClusterKey) error {

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.

The controller should only be run in envrionments where we can create deny assignments;
Stage + Prod. We can 't create deny assignments in lower environments.

Same as #3970 (comment)

The approach taken by cs is a binary flag / env var that drives whether deny assignment creation feature is enabled or disabled

logger := utils.LoggerFromContext(ctx)
principalIDs := make(map[string]string)

msiClient, err := armmsi.NewUserAssignedIdentitiesClient(subscriptionID, c.credential, 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.

What credential will be used to create this client? is it the FPA or the SMI (service managed identity)?

If it is the former, I do not think if we can retrieve the client id directly via ARM - there could be permissions issues.

CS uses the FPA to retrieve control plane MIs info from MSI RP directly and the SMI credential to retrieve the principal id of the data plane clients directly from ARM.

The way I see this flow is;
(1) FPA is used to retrieve credential of the SMI
(2) From which a credential retrieve in step(1) a client is created similar to what's done here
(3) The client is used to fetch the principal id of those CP + DP.

@rogbas
rogbas force-pushed the rogbas-deny-assignment-controller branch from 0aa9bbf to 456c77e Compare February 10, 2026 19:37
@openshift-ci

openshift-ci Bot commented Feb 10, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rogbas
Once this PR has been reviewed and has the lgtm label, please assign mmazur for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@openshift-ci

openshift-ci Bot commented Mar 22, 2026

Copy link
Copy Markdown

PR needs rebase.

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.

@openshift-ci

openshift-ci Bot commented Apr 16, 2026

Copy link
Copy Markdown

@rogbas: 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/integration 456c77e link true /test integration
ci/prow/mega-linter 456c77e link true /test mega-linter
ci/prow/image-updater-images 456c77e link true /test image-updater-images
ci/prow/periodic-images 456c77e link true /test periodic-images
ci/prow/test-unit 456c77e link true /test test-unit
ci/prow/images 456c77e link true /test images
ci/prow/lint 456c77e link true /test lint
ci/prow/config-change-detection 456c77e link true /test config-change-detection
ci/prow/verify 456c77e link true /test verify
ci/prow/e2e-parallel 456c77e link true /test e2e-parallel
ci/prow/e2e-images 456c77e link true /test e2e-images
ci/prow/baseimage-generator-images 456c77e link true /test baseimage-generator-images
ci/prow/cspr 456c77e link true /test cspr
ci/prow/images-push 456c77e 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.

// isClusterReadyForDenyAssignments checks if a cluster is in a state where
// deny assignments should be managed
func isClusterReadyForDenyAssignments(cluster *api.HCPOpenShiftCluster) bool {
// Only process clusters that are Succeeded or Updating

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.

This doesn't seem correct. We shouldn't depend on the provisioning state. We should create it as long as it's not there and the cluster hasn't been marked as deleted

@machi1990

Copy link
Copy Markdown
Collaborator

Superseded by #6269

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.

3 participants