Skip to content

CNTRLPLANE-3237: kms preflight: introduce kmsConfigHasherResourceProvider interface - #2394

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
p0lyn0mial:kms-preflight-hasher-interface
Aug 3, 2026
Merged

CNTRLPLANE-3237: kms preflight: introduce kmsConfigHasherResourceProvider interface#2394
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
p0lyn0mial:kms-preflight-hasher-interface

Conversation

@p0lyn0mial

@p0lyn0mial p0lyn0mial commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

splitting #2392

Summary by CodeRabbit

  • Refactor

    • Improved KMS configuration handling for referenced Secrets and ConfigMaps.
    • Preserved existing configuration hashing behavior and error handling.
    • Improved separation of resource retrieval from KMS configuration processing.
  • Tests

    • Updated coverage to verify resource retrieval during KMS configuration processing.

@openshift-ci
openshift-ci Bot requested review from ardaguclu and dgrisonnet August 3, 2026 09:31
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Walkthrough

KMS config hashing now uses an injected resource-provider interface for Secret and ConfigMap retrieval. The Kubernetes CoreV1 client provides the implementation, and controller and test call sites pass the wrapper.

Changes

KMS resource-provider wiring

Layer / File(s) Summary
Provider abstraction and hasher wiring
pkg/operator/encryption/controllers/kms_preflight_controller.go, pkg/operator/encryption/controllers/kms_preflight_controller_test.go
The hasher accepts and validates a resource provider, uses it for Secret and ConfigMap retrieval, and receives a CoreV1-backed provider from the controller and test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • openshift/library-go#2392: Directly refactors the KMS config hasher resource-provider implementation, constructor, and test wiring.

Suggested reviewers: dgrisonnet

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The commit changes no test titles; both t.Run calls use scenario.name, and all scenario names are fixed descriptive literals with no runtime values.
Test Structure And Quality ✅ Passed The changed test uses Go testing.T and fake clientsets, not Ginkgo; it adds no cluster waits or unmanaged resources, and the new constructor failure includes context.
Microshift Test Compatibility ✅ Passed The pull request adds no Ginkgo e2e tests. Its only test changes are in standard Go TestKMSConfigHasher, with no MicroShift-incompatible API or feature references.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request adds no new Ginkgo e2e tests. It only updates the existing Go unit test TestKMSConfigHasher, so SNO multi-node compatibility rules do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed The diff changes only KMS Secret/ConfigMap hashing and tests; it adds no affinity, topology spread, replicas, node selectors, tolerations, or PDB scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The PR changes only library/controller hashing code and a unit test; no main, init, TestMain, suite setup, or process-level stdout write was added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The pull request changes only controller code and a standard Go TestKMSConfigHasher unit test; it adds no Ginkgo e2e tests, IPv4 assumptions, or external connectivity.
No-Weak-Crypto ✅ Passed The PR adds only resource-provider plumbing. The diff adds no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, custom crypto, or secret/token comparisons; existing FNV hashing is unchanged.
Container-Privileges ✅ Passed The patch changes only Go files. It adds no flagged privilege settings or manifests; the existing conditional hostNetwork setting is unchanged.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no logging and does not emit Secret or ConfigMap values; it only injects resource fetching. Existing error text and hash logging remain unchanged.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the introduction of the kmsConfigHasherResourceProvider interface, which is the main change in the pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@p0lyn0mial
p0lyn0mial force-pushed the kms-preflight-hasher-interface branch from e8bfca0 to 88e40ba Compare August 3, 2026 10:09
func newKMSConfigHasher(provider kmsProviderConfig, coreClient corev1client.CoreV1Interface, namespace string) *kmsConfigHasher {
return &kmsConfigHasher{provider: provider, coreClient: coreClient, namespace: namespace}
func newKMSConfigHasher(provider kmsProviderConfig, kmsConfigHasherResourceProvider kmsConfigHasherResourceProvider, namespace string) *kmsConfigHasher {
return &kmsConfigHasher{provider: provider, kmsConfigHasherResourceProvider: kmsConfigHasherResourceProvider, namespace: namespace}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need nil check?

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.

added


// coreClientKMSConfigHasherResourceProvider fetches resources from the Kubernetes API.
type coreClientKMSConfigHasherResourceProvider struct {
coreClient corev1client.CoreV1Interface

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't we need a newCoreClientKMSConfigHashResourceProvider function that accepts coreClient?

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.

added

@p0lyn0mial
p0lyn0mial force-pushed the kms-preflight-hasher-interface branch from 88e40ba to 65d4a9f Compare August 3, 2026 10:52
@ardaguclu

Copy link
Copy Markdown
Member

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2026
@p0lyn0mial
p0lyn0mial force-pushed the kms-preflight-hasher-interface branch from 65d4a9f to b424f1f Compare August 3, 2026 10:55
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2026
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@p0lyn0mial

Copy link
Copy Markdown
Contributor Author

the latest push replaced panic with returning an err.

@p0lyn0mial p0lyn0mial added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2026
@p0lyn0mial p0lyn0mial changed the title kms preflight: introduce kmsConfigHasherResourceProvider interface CNTRLPLANE-3237: kms preflight: introduce kmsConfigHasherResourceProvider interface Aug 3, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 3, 2026

Copy link
Copy Markdown

@p0lyn0mial: This pull request references CNTRLPLANE-3237 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:

splitting #2392

Summary by CodeRabbit

  • Refactor

  • Improved KMS configuration handling for referenced Secrets and ConfigMaps.

  • Preserved existing configuration hashing behavior and error handling.

  • Improved separation of resource retrieval from KMS configuration processing.

  • Tests

  • Updated coverage to verify resource retrieval during KMS configuration processing.

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-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 3, 2026
@ardaguclu

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, p0lyn0mial

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

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@p0lyn0mial: 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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit f6ef4e8 into openshift:master Aug 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants