Skip to content

CORS-4403: Add enhancement for GCP customer-managed KMS encryption#1975

Open
barbacbd wants to merge 1 commit into
openshift:masterfrom
barbacbd:gcp-kms-encryption
Open

CORS-4403: Add enhancement for GCP customer-managed KMS encryption#1975
barbacbd wants to merge 1 commit into
openshift:masterfrom
barbacbd:gcp-kms-encryption

Conversation

@barbacbd
Copy link
Copy Markdown
Contributor

Proposes adding support for customer-managed Cloud KMS keys
to encrypt GCS buckets used by the OpenShift installer on GCP.
Covers bootstrap ignition bucket and image registry bucket
encryption for compliance and regulatory requirements.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
Reviewed by: @barbacbd

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 16, 2026

@barbacbd: This pull request references CORS-4403 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Proposes adding support for customer-managed Cloud KMS keys
to encrypt GCS buckets used by the OpenShift installer on GCP.
Covers bootstrap ignition bucket and image registry bucket
encryption for compliance and regulatory requirements.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
Reviewed by: @barbacbd

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign deads2k 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 requested review from dustymabe and jcantrill April 16, 2026 11:21
Comment thread enhancements/installer/gcp-kms-key-encryption.md
Comment thread enhancements/installer/gcp-kms-key-encryption.md
// used to store bootstrap ignition configs. When omitted, the bucket uses
// Google-managed encryption.
// +optional
IgnitionStorageEncryptionKey *StorageEncryptionKeyReference `json:"ignitionStorageEncryptionKey,omitempty"`
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.

ignitionStorageEncryptionKey.kmsKey has key twice in quick succession, maybe drop the first key?

// the image registry GCS bucket. This is consumed by the cluster-image-registry-operator
// when creating the registry storage bucket.
// +optional
RegistryStorageKMSKey *GCPKMSKeyReference `json:"registryStorageKMSKey,omitempty"`
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.

NIt: Recommendation now is to avoid the pointer and use omitzero instead of omitempty

// the image registry GCS bucket. This is consumed by the cluster-image-registry-operator
// when creating the registry storage bucket.
// +optional
RegistryStorageKMSKey *GCPKMSKeyReference `json:"registryStorageKMSKey,omitempty"`
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.

Might want to make this more structured in case we have additional stuff to add later

registry:
  storage:
    kmsKey:
      name: ...


#### Standalone Clusters

This enhancement is fully applicable to standalone IPI (Installer Provisioned Infrastructure) clusters on GCP. It does not apply to UPI (User Provisioned Infrastructure) as users manage their own storage infrastructure.
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.

For a UPI cluster, how does the platform status get populated so that the image registry operator can create the bucket?

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.

Or now, what is the expectation for the image registry, do users configure that when they generate the manifests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. The manifest should be generated by the installer still. Even if this is run as upi, the installer is still executed and those manifests would be generated based on your input in the install-config.

2. **Validation Logic**: The `validatePlatformKMSKeys` function in `pkg/asset/installconfig/gcp/validation.go`
3. **Default Handling**: The pattern in `pkg/types/gcp/defaults/machinepool.go` for defaulting ProjectID

This provides consistency across the API and reduces implementation complexity.
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.

What happens if a new field is added to KMSKeyReference, you'd expect that to be supported in all three usage locations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not necessarily. The fields are validated individually so if a new value is added they don't have to support it but ideally any new field should apply to all of them.

Comment on lines +516 to +519
1. **Should we support cross-project KMS keys in the initial implementation?**
- This would allow using keys from a central "security" project
- Requires additional IAM configuration and validation complexity
- Can be deferred to a future enhancement
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.

How would you expect the API to evolve to support this in the future?

4. **How should we handle the cluster-image-registry-operator changes?**
- Option A: Hold this enhancement until operator PR is merged
- Option B: Merge installer changes first, operator support comes in a follow-up release
- Proposed: Coordinate with operator team, merge in the same release cycle
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.

Can the installer team propose the changes to the operator as part of their work? You'd need commitment from the registry team to review

Is anyone from registry reviewing this EP?


**Downgrading TO a release without this feature:**
- Cluster continues to function normally
- Buckets remain encrypted with customer-managed keys
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.

You don't need to know anything about the encryption to read from the bucket right? So registry is not impacted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that should be true. The service account only needs permission to read so that is more than likely a documentation update (if it doesn't already exist) to ensure the user has this permission when using this feature.

@barbacbd
Copy link
Copy Markdown
Contributor Author

Response to Review Comments

Thank you @JoelSpeed for the thorough review! I've addressed your feedback and made some important discoveries during analysis. Here's the status of each comment:

✅ Addressed in Commit b96e1e99

Comments 1, 3, 4, 5: API structure, naming, and omitzero

  • Changed from flat structure to nested: ignition.storage.encryptionKey.kmsKey
  • Applied omitzero instead of pointers with omitempty
  • Added structured namespaces for future extensibility

New structure:

platform:
  gcp:
    ignition:
      storage:
        encryptionKey:
          kmsKey:
            name: ignition-key
            keyRing: openshift-keyring
            location: us-east1
    registry:
      storage:
        encryptionKey:
          kmsKey:
            name: registry-key

✅ Resolved by Technical Analysis

Comment 2: Day-2 cluster access to these values

  • Answer: Not needed. GCS stores the KMS key in bucket metadata at creation time. All subsequent encryption/decryption is automatic if the service account has cloudkms.cryptoKeyDecrypter IAM permission. No cluster component needs to reference the install-config values after install.

Comment 8: Operator changes and registry team coordination

  • Great news: No operator changes needed! The cluster-image-registry-operator has had full KMS support since 2019 (commit 8c08cc6805).
  • The ImageRegistry CR field spec.storage.gcs.keyID already exists in openshift/api since 2019.
  • This is now an installer-only change - we just populate the existing field.
  • Updated the enhancement (commit eca22306) to remove Infrastructure CR API changes and document existing operator support.

Comment 9: Encryption knowledge for reading

  • Correct - you don't need to know the encryption key to read. GCS handles encryption/decryption transparently once the key is attached to bucket metadata. The service account just needs cloudkms.cryptoKeyDecrypter IAM permission.
  • Registry operator is not impacted by encryption.

💬 Discussion Needed

Comment 6: Type reuse concerns with KMSKeyReference

  • Currently reused across disk encryption, ignition storage, and registry storage
  • My position: Type reuse is correct because GCP KMS keys have uniform structure regardless of use case
  • Any new fields Google adds (versions, aliases, HSM level) would likely apply universally
  • Alternative: Split into use-case-specific types for more flexibility
  • Question: Do you prefer keeping the shared type or splitting?

Comment 7: Cross-project KMS keys - API evolution

  • Good news: Current API already supports it! The ProjectID field enables cross-project keys.
  • Evolution path:
    • Phase 1 (initial): Same-project only, validate ProjectID matches cluster
    • Phase 2 (future): Support cross-project with updated validation and documentation
    • No breaking changes needed
  • When ProjectID differs from cluster project, we'd validate cross-project IAM permissions are set up
  • Question: Does this evolution path work for you?

I've documented detailed responses in my analysis files. Happy to discuss Comments 6 and 7 further or adjust the approach based on your feedback.

@barbacbd barbacbd force-pushed the gcp-kms-encryption branch from 4c6818c to 98ee7ba Compare May 13, 2026 15:43
reviewers:
- "@rochacbruno"
- "@patrickdillon"
approvers:
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.

Missing api-approvers metadata, should be a linter flagging that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. Thanks!


2. **No New Kubernetes API Changes Needed**: The ImageRegistry CR (`configs.imageregistry.operator.openshift.io/cluster`) already has the necessary field. We do not need to add fields to the Infrastructure CR or create new CRDs.

3. **No Feature Gates Required**: This is install-time configuration (not runtime cluster features), so feature gates are not appropriate. Install-config fields are naturally opt-in (omit = default behavior).
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.

What does your flow look like for testing this feature and making sure that it is GA ready before merge?

We have plenty of install time features that are tested first in tech preview before being promoted to GA, so I'd challenge "feature gates are not appropriate"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We will have to create a new step in the CI that will test this feature. This should ensure it is "green" or good to go before merging.


#### Standalone Clusters

This enhancement is fully applicable to standalone IPI (Installer Provisioned Infrastructure) clusters on GCP. It does not apply to UPI (User Provisioned Infrastructure) as users manage their own storage infrastructure.
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.

Or now, what is the expectation for the image registry, do users configure that when they generate the manifests?

@barbacbd barbacbd force-pushed the gcp-kms-encryption branch from 98ee7ba to 0723409 Compare May 14, 2026 10:59
  Proposes adding support for customer-managed Cloud KMS keys
  to encrypt GCS buckets used by the OpenShift installer on GCP.
  Covers bootstrap ignition bucket and image registry bucket
  encryption for compliance and regulatory requirements.

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  Reviewed by: @barbacbd

Update GCP KMS enhancement based on analysis findings

Key updates:
- Remove Infrastructure CR API changes (use existing ImageRegistry CR)
- Remove feature gate references (not needed for install-time config)
- Document that registry operator already supports KMS since 2019
- Update IAM permissions to scope to specific service accounts only
- Simplify to installer-only changes (no cross-repo coordination)
- Update graduation criteria to ship as GA (no Tech Preview needed)
- Add Key Findings section summarizing discoveries

Analysis documented in CORS-4391 revealed:
- ImageRegistry CR already has spec.storage.gcs.keyID field (2019)
- cluster-image-registry-operator has full KMS support (commit 8c08cc6805)
- No new Kubernetes APIs needed
- Feature is naturally opt-in via install-config
- Similar to AWS/Azure encryption features (all shipped as GA)

Scope reduced by ~50%: no openshift/api changes, no operator changes,
no feature gates, no cross-repository coordination overhead.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Use nested API structure for KMS configuration

Addresses PR review feedback from @JoelSpeed:
- Use nested structure: ignition.storage.encryptionKey instead of flat
- Use nested structure: registry.storage.encryptionKey instead of flat
- Apply omitzero instead of pointers with omitempty
- Provides better extensibility for future fields
- Clear separation of ignition vs registry configuration

This resolves comments about:
- API structure (line 98, line 251)
- Naming (line 200 - 'key' duplication removed)
- Pointer usage (line 251 - now using omitzero)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@barbacbd barbacbd force-pushed the gcp-kms-encryption branch from 0723409 to e5f818c Compare May 14, 2026 14:51
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@barbacbd: all tests passed!

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants