Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic validation of "EncryptionAtHost" feature subscription level registration at the RP. [DO NOT MERGE] #3065

Closed

Conversation

schiruma
Copy link
Contributor

Which issue this PR addresses:

ARO-3211

What this PR does / why we need it:

When customers are attempting to set EncryptionAtHost, but that feature is not enabled for their Subscriptions, an error message describing about the issue and its resolution is displayed to them. This is achieved by dynamically validating their Subscription documents.

Test plan for issue:

E2E

Is there any documentation that needs to be updated for this PR?

N/A

@@ -46,3 +53,20 @@ func (dv *dynamic) validateEncryptionAtHostSupport(VMSize api.VMSize, path strin

return nil
}

func (dv *dynamic) IsRegisteredForFeature(sub *api.SubscriptionProperties) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor nit:

The function name here doesn't make it clear which feature we are checking for registration for. Given that it's a method on the generic dynamic validator, I would expect it to either be named specifically for the EncryptionAtHost feature (e.g. IsSubRegisteredForEncryptionAtHostFeature), or take in the feature name as a parameter if there are places to reuse it.

}
}

EncryptionAtHostEnabledOrDisabled := func(MasterEncryptionAtHost api.EncryptionAtHost, WorkerEncryptionAtHost api.EncryptionAtHost) *api.OpenShiftCluster {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the refactor here to keep the actual test cases focused on their intent, but I think the function name and syntax here is a little confusing and ends up obscuring some important information when looking at the test cases themselves, e.g. it's unclear from just reading EncryptionAtHostEnabledOrDisabled(api.EncryptionAtHostEnabled, api.EncryptionAtHostDisabled) what that test case is trying to set up.

I wonder if it might be cleaner to establish static master/workerprofile definitions, and have each test case assemble the cluster definition by composing those static members (e.g. func(masterProfile api.MasterProfile, workerProfile api.WorkerProfile)), or to just make a single, four-arg function that handles both cases.

@github-actions github-actions bot added the needs-rebase branch needs a rebase label Jul 26, 2023
@github-actions
Copy link

Please rebase pull request.

Copy link
Collaborator

@bennerv bennerv left a comment

Choose a reason for hiding this comment

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

This won't actually work.

The subscription document only holds features registered under the RP's namespace (Microsoft.RedHatOpenShift) and the Microsoft.Resources namespaces.

All AFEC features that the subscriptions has been registered under RP namespace and platform namespace (Microsoft.Resources).

Copy link
Collaborator

@bennerv bennerv left a comment

Choose a reason for hiding this comment

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

Quick summary of actions needed to be taken:

  1. Update our FPSP Built-In Service Role to include Microsoft.Features/features/read and Microsoft.Features/providers/features/read
  2. The above follows SDP
  3. Update our local custom role in our dev environment to include the above permissions as well
  4. Update this PR to use the features client instead of reading from the subscription document
  5. Roll it out :shipit:

@schiruma schiruma added the loki label Jul 28, 2023
@schiruma schiruma force-pushed the dynamic-validation-encryptionathost branch from 32ad18d to f12b002 Compare July 28, 2023 19:04
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Jul 28, 2023
@schiruma schiruma force-pushed the dynamic-validation-encryptionathost branch from f12b002 to eaa6175 Compare August 5, 2023 03:36
@schiruma schiruma force-pushed the dynamic-validation-encryptionathost branch 3 times, most recently from dc0e80c to 230be57 Compare August 29, 2023 20:36
@schiruma schiruma force-pushed the dynamic-validation-encryptionathost branch from e5fb13a to ac075cb Compare August 30, 2023 03:56
@github-actions github-actions bot added the needs-rebase branch needs a rebase label Aug 31, 2023
@github-actions
Copy link

Please rebase pull request.

@schiruma schiruma changed the title Dynamic validation of "EncryptionAtHost" feature subscription level registration at the RP. Dynamic validation of "EncryptionAtHost" feature subscription level registration at the RP. [DO NOT MERGE] Aug 31, 2023
@bennerv bennerv closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
loki needs-rebase branch needs a rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants