← Back to Pull requests

ARO-29491 | feat: add key_vault_type field to AzureKmsEncryption for Managed HSM support #1193

Closed
unknown closed this pull request without merging on Sep 14, 2026 07:40 UTC
View on GitHub
unknown unknown commented on Sep 08, 2026 23:45 UTC
Author

What

Adds a key_vault_type attribute to AzureKmsEncryption in model/aro_hcp/v1alpha1, backed by a new AzureKmsEncryptionKeyVaultType enum (key_vault / managed_hsm).

This unblocks Managed HSM support for customer-managed keys on ARO HCP: the RP currently has no way to tell Cluster Service which Azure service hosts a customer's key, because arohcpv1alpha1.NewAzureKmsEncryption() only exposes what is declared here.

Jira: ARO-29491 · epic ARO-27215

Semantics

The field is optional and defaults to key_vault when unset, which preserves behaviour for existing clusters. It applies to the whole KMS configuration rather than to an individual key, and is immutable after cluster creation.

The model DSL enforces none of that — validation lands in Cluster Service (ARO-29425).

Why an enum rather than a full key URL

Two shapes were considered. The alternative was a single key_encryption_key_url string, which was the initially preferred option on the ticket.

The enum won on two grounds:

1. It matches what the consumer actually accepts. HyperShift's AzureKMSKey remains fully decomposed (keyVaultName / keyName / keyVersion, all required); openshift/hypershift#9199 added AzureKMSSpec.keyVaultType alongside it rather than moving to a URL. HyperShift treats the URL as an output, composing it from vault name plus a cloud-specific suffix. Azure/ARO-HCP main is likewise still decomposed.
2. It avoids permanent overlap. A key URL would name the same key that ActiveKey already names, a second way. The coherent version of that design replaces the decomposed fields — which this repo cannot do, since attributes here are effectively unretractable. We would carry both representations forever with no way to express "exactly one of these" and no defined precedence when they disagree. KeyVaultType is orthogonal to ActiveKey: one says which key, the other says which service hosts it.

Full rationale, including the evidence gathered and the trade-off accepted, is recorded on ARO-29491.

Known trade-off: a URL is self-validating where an enum is not — managedhsm.azure.net in a host proves the key store, whereas key_vault_type: managed_hsm can be set against a vault that is not one. HyperShift exports azureutil.GetAzureEncryptionKeyInfo(url) for exactly this, so CS need not maintain its own suffix table.

Naming

Wire values are key_vault / managed_hsm, following the generator's existing snake_case behaviour (Public → "public"). These differ in case from HyperShift's KeyVault / ManagedHSM, so Cluster Service maps between them.

The DSL spells the enum value ManagedHsm rather than ManagedHSM to avoid trailing-acronym mangling; the generated wire value was confirmed to be managed_hsm.

Generated output

Follows PR #1149 (ARO-24796, the visibility field) — same struct, same 8-file shape. 31 hand-written lines, the rest generated by make update.

| File | |
|---|---|
| model/aro_hcp/v1alpha1/azure_kms_encryption_type.model | hand-written |
| model/aro_hcp/v1alpha1/azure_kms_encryption_key_vault_type.model | hand-written, new |
| clientapi/arohcp/v1alpha1/azure_kms_encryption_type.go | generated |
| clientapi/arohcp/v1alpha1/azure_kms_encryption_builder.go | generated |
| clientapi/arohcp/v1alpha1/azure_kms_encryption_type_json.go | generated |
| clientapi/arohcp/v1alpha1/azure_kms_encryption_key_vault_type_type.go | generated, new |
| clientapi/arohcp/v1alpha1/azure_kms_encryption_key_vault_type_list_type_json.go | generated, new |
| openapi/aro_hcp/v1alpha1/openapi.json | generated |

CHANGES.md is intentionally untouched: auto-tag.yaml regenerates it at release time from commit subjects, so a manual entry would be clobbered. PR #1149 likewise did not add one.

Compatibility

Adding this attribute shifts the generated fieldSet_ index of visibility from 1 to 2, because the generator assigns bitmap indices alphabetically by attribute name rather than by declaration order.

This is safe. The bitmap is never serialised — the JSON codec is name-keyed (case \"visibility\":), allocates fieldSet_ fresh on unmarshal, and skips unknown fields via default: iterator.ReadAny(). Indices are internal to a single binary, where they are self-consistent by construction:

  • old producer → new consumer: key_vault_type absent, KeyVaultType() reports unset, treated as key_vault.

  • new producer → old consumer: key_vault_type ignored by the default branch; visibility still matched by name.
  • Testing

  • make check — passes

  • make verify — passes (the CI gate)

  • go build ./arohcp/... and go vet — clean

  • make lint — fails identically on unmodified main; pre-existing and unrelated. Both changed .model files were checked directly against the lint regex and are clean.
  • Follow-ups

    Releasing is automatic, not a manual step: auto-tag.yaml fires on merge to main, bumps the patch version, tags all four module paths and publishes a release, and sync-sdk.yaml then dispatches to ocm-sdk-go. Downstream consumption is tracked separately in Cluster Service (ARO-29425) and the RP (ARO-27779).

    Draft pending ARO approver sign-off on the field shape — flagging @miguelsorianod @machi1990, since this reverses the preference originally recorded on the ticket.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: ahitacat Review duration: 7674m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.75) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #1193"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 32.5% · Safe to merge
    32.5%