Skip to content

ARO-3837 -Add EncryptionAtHost feature flag Validation#4806

Merged
kimorris27 merged 16 commits into
masterfrom
ARO-3837-fix-encryption-at-host-validation
May 28, 2026
Merged

ARO-3837 -Add EncryptionAtHost feature flag Validation#4806
kimorris27 merged 16 commits into
masterfrom
ARO-3837-fix-encryption-at-host-validation

Conversation

@sravyanimmala
Copy link
Copy Markdown
Collaborator

@sravyanimmala sravyanimmala commented Apr 29, 2026

Summary

Fixes ARO-3837 - Adds upfront validation of Microsoft.Compute/EncryptionAtHost feature flag on the customer subscription before provisioning ARO clusters.

Problem

Currently, clusters with master encryption fail with a cryptic 500: InternalServerError after a long wait, giving customers no actionable feedback.

Changes

  • pkg/frontend/features_validation.go — created FeaturesValidator with FeaturesClient interface.check if Microsoft.Compute/EncryptionAtHost is registered on the customer subscription before cluster provisioning. If not registered, returns a 400 BadRequest with a clear error message

  • pkg/frontend/sku_validation.go - Removed EncryptionAtHost check, now handled by featuresValidator.
    -pkg/frontend/frontend.go — Added featuresValidator field and initialization.

  • pkg/frontend/openshiftcluster_putorpatch.go — Added featuresValidator call in ValidateNewCluster.
    -pkg/frontend/generate.go — Added go:generate directive for mock generation.
    -pkg/frontend/features_validation_test.go — Added unit tests.
    -pkg/util/azureclient/azuresdk/armfeatures/ -added armfeatures client wrapper following existing patterns
    -pkg/util/mocks/frontend/features_validation.go — Generated mock.
    -pkg/util/mocks/azureclient/azuresdk/armfeatures/armfeatures.go -New generated mock for FeaturesClient wrapper

Testing

Added unit tests covering all scenarios -feature registered, feature not registered, nil properties and nil state . All tests pass

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an upfront validation to detect whether the subscription has the Microsoft.Compute/EncryptionAtHost feature enabled before attempting cluster provisioning, aiming to replace late-stage internal failures with a clear customer-facing error.

Changes:

  • Calls a new validateEncryptionAtHostFeature() check during VM SKU validation when EncryptionAtHost is enabled.
  • Introduces pkg/frontend/encryptionathost_validation.go to query feature registration state via ARM and return a 400 on missing registration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
pkg/frontend/sku_validation.go Adds a pre-check invocation for the EncryptionAtHost feature before continuing SKU validation.
pkg/frontend/encryptionathost_validation.go Implements feature registration lookup via ResourcesClient.GetByID and returns a customer-facing error when not registered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/sku_validation.go Outdated
Comment thread pkg/frontend/sku_validation.go Outdated
Comment thread pkg/frontend/sku_validation.go Outdated
@sravyanimmala sravyanimmala added hold Hold chainsaw Pull requests or issues owned by Team Chainsaw labels Apr 29, 2026
Copilot AI review requested due to automatic review settings April 29, 2026 23:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Copilot AI review requested due to automatic review settings May 1, 2026 00:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings May 6, 2026 15:15
@sravyanimmala sravyanimmala removed the hold Hold label May 15, 2026
Copy link
Copy Markdown
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

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

Looks good broadly speaking! I made a few recommendations, with the most important among them being that we can validate this for workers as well as for masters.

One other general recommendation is that it would be good to add unit tests for validateEncryptionAtHostFeature.

Comment thread hack/encryptionathost-poc/main.go Outdated
Comment thread pkg/frontend/features_validation.go
Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/sku_validation.go Outdated
Comment thread pkg/frontend/sku_validation.go Outdated
Copy link
Copy Markdown
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

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

The changes look good - just a few more small points of feedback.

Comment thread pkg/frontend/encryptionathost_validation.go Outdated
Comment thread pkg/frontend/features_validation.go
Copy link
Copy Markdown
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for responding quickly to my comments!

Comment thread pkg/frontend/features_validation.go Outdated
Comment thread pkg/frontend/features_validation.go Outdated
@github-actions github-actions Bot added the needs-rebase branch needs a rebase label May 27, 2026
@github-actions
Copy link
Copy Markdown

Please rebase pull request.

@sravyanimmala sravyanimmala force-pushed the ARO-3837-fix-encryption-at-host-validation branch from a1bdbd7 to e676746 Compare May 27, 2026 19:29
@github-actions github-actions Bot removed the needs-rebase branch needs a rebase label May 27, 2026
@sravyanimmala sravyanimmala force-pushed the ARO-3837-fix-encryption-at-host-validation branch from e676746 to 7b7b566 Compare May 28, 2026 01:07
@kimorris27 kimorris27 merged commit 5731ef9 into master May 28, 2026
31 checks passed
@kimorris27 kimorris27 deleted the ARO-3837-fix-encryption-at-host-validation branch May 28, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chainsaw Pull requests or issues owned by Team Chainsaw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants