Skip to content

feat(byok): pass diskEncryptionSet ID to CS if AFEC is registered - #6662

Open
Caden Marchese (cadenmarchese) wants to merge 2 commits into
Azure:mainfrom
cadenmarchese:cadenmarchese/afec-pass-des-to-cluster-service
Open

feat(byok): pass diskEncryptionSet ID to CS if AFEC is registered#6662
Caden Marchese (cadenmarchese) wants to merge 2 commits into
Azure:mainfrom
cadenmarchese:cadenmarchese/afec-pass-des-to-cluster-service

Conversation

@cadenmarchese

Copy link
Copy Markdown
Member

https://redhat.atlassian.net/browse/ARO-27738

What

  • This is the same as feat(byok): enable customer-managed key for nodePool OS disk encryption #6647 but without the e2e test, and behind the experimental features AFEC flag which is only registered in CI subscriptions.
  • This change allows BYOK for nodePool OS disk encryption. Currently, since we don't pass the diskEncryptionSet ID to cluster service, all nodePool OS disks fall back to platform-managed keys, even if the intent was to configure it with a diskEncryptionSet. This also unblocks mHSM support for nodePool OS Disk encryption, which functions in the same way.
  • The goal is to merge this PR and release it to stage and prod, change feat(byok): enable customer-managed key for nodePool OS disk encryption #6647 to only be the e2e test + AFEC flag check removal, and then run /test stage-e2e-parallel prod-e2e-parallel in that PR to confirm that e2e works in prod and stage environments (we already know it works in lower environments). Merging this feature this way is required because workload identities in dev, CI, and INT are mocked with a custom role, such that the role assignment scopes in the e2e test are not fully testable (workload identities are over-privileged). This is the cleanest way to ensure that e2e functions everywhere before release.

Why

This is required to get BYOK for nodePool OS Disk encryption working, both for regular keyvaults, and mHSM keyvaults. Today the HCP API will accept a disk encryption set but won't use it for the actual encryption, which is unexpected behavior.

Testing

Special notes for your reviewer

PR Checklist

  • PR is scoped to a single task (no mixed concerns)
  • Title follows Conventional Commits format
  • Summary explains the "Why" behind the change
  • Linked to relevant ticket/issue
  • Screenshots included (if graph/UI/metrics changes)
  • Self-reviewed the diff
  • CI/CD checks are passing (ignore Tide)
  • Draft PR used for WIP (if applicable)
  • Commit history is clean (rebased/squashed)
  • Tricky code blocks are commented
  • Specific reviewers tagged
  • All comment threads resolved before merge

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables BYOK for nodePool OS disk encryption by conditionally passing the OS disk diskEncryptionSet resource ID through the OCM-to-Cluster-Service conversion path when the subscription has the ExperimentalReleaseFeatures (AFEC) feature registered at node pool creation time. It does this by persisting an internal “experimental features enabled” flag on the node pool and using it to gate emitting the experimental CS field.

Changes:

  • Add ExperimentalFeaturesEnabled to node pool ServiceProviderProperties and set it during admission on CREATE based on AFEC registration.
  • Gate setting SseEncryptionSetResourceId in Cluster Service node pool OS disk builder behind ExperimentalFeaturesEnabled.
  • Add unit test coverage for the conversion gating and admission mutation, and update fuzz round-trip setup to include the new field.

Reviewed changes

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

Show a summary per file
File Description
internal/ocm/convert.go Adds gated OS disk conversion that sets SseEncryptionSetResourceId only when AFEC was registered at node pool creation time.
internal/ocm/convert_test.go Adds conversion test cases covering “AFEC enabled → DES passed” and “AFEC disabled → DES not passed”.
internal/apitesting/coreapitesting/fuzz.go Zeros the new ServiceProviderProperties flag in round-trip fuzz funcs to keep internal-only fields deterministic.
internal/api/coreapi/types_nodepool.go Introduces ExperimentalFeaturesEnabled on node pool ServiceProviderProperties with writer annotation and rationale comment.
internal/admission/admit_nodepool.go / internal/admission/admit_nodepool_test.go Sets the flag on CREATE based on subscription AFEC registration and adds unit tests for the mutation behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/ocm/convert.go
SizeGibibytes(int(*osDisk.SizeGiB)).
StorageAccountType(storageAccountType).
Persistence(persistence)
if experimentalFeaturesEnabled && osDisk.EncryptionSetID != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

n.b. the field is ignored today, which is why it's correct to do this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@stevekuznetsov

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Aug 24, 2026
@openshift-ci

openshift-ci Bot commented Aug 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cadenmarchese, stevekuznetsov

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

@cadenmarchese

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 0eba6aa and 2 for PR HEAD 87c9d3c in total

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD a500a9d and 1 for PR HEAD 87c9d3c in total

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD cb92a98 and 0 for PR HEAD 87c9d3c in total

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/hold

Revision 87c9d3c was retested 3 times: holding

@cadenmarchese

Copy link
Copy Markdown
Member Author

/retest-required

This is required for BYOK on nodePool OS Disks. CS will validate
the DES, and then CAPZ will create the nodePool with that DES' key
Since the change needs to be released to stage (at minumum) to be
fully tested, release behind a feature flag such that we can
verify full functionality of the e2e test before merging it
Copilot AI review requested due to automatic review settings August 25, 2026 18:10
@cadenmarchese
Caden Marchese (cadenmarchese) force-pushed the cadenmarchese/afec-pass-des-to-cluster-service branch from 87c9d3c to 5b6c113 Compare August 25, 2026 18:10
@openshift-ci openshift-ci Bot removed the lgtm label Aug 25, 2026
@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread internal/ocm/convert.go
return arohcpv1alpha1.NewAzureNodePoolEncryptionAtHost().State(state)
}

func buildCSOsDisk(osDisk coreapi.OSDiskProfile, storageAccountType, persistence string, experimentalFeaturesEnabled bool) *arohcpv1alpha1.AzureNodePoolOsDiskBuilder {
Comment on lines +128 to +133
// ExperimentalFeaturesEnabled records whether the FeatureExperimentalReleaseFeatures AFEC was
// registered on the subscription at node pool creation time. Used by internal/ocm/convert.go
// to gate experimental CS fields (e.g. SseEncryptionSetResourceId on the OS disk) that are
// only sent to Cluster Service when the AFEC is registered.
// Written by: Frontend PUT NodePool (Create)
ExperimentalFeaturesEnabled bool `json:"experimentalFeaturesEnabled,omitempty"`
@cadenmarchese

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

Caden Marchese (@cadenmarchese): The following test 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/e2e-parallel 5b6c113 link true /test e2e-parallel

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.

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