Skip to content

CNTRLPLANE-3237: Carry referenced Secret data from API to plugin lifecycle for KMS#2212

Open
ardaguclu wants to merge 1 commit into
openshift:masterfrom
ardaguclu:carry-kms-credentials
Open

CNTRLPLANE-3237: Carry referenced Secret data from API to plugin lifecycle for KMS#2212
ardaguclu wants to merge 1 commit into
openshift:masterfrom
ardaguclu:carry-kms-credentials

Conversation

@ardaguclu
Copy link
Copy Markdown
Member

@ardaguclu ardaguclu commented May 11, 2026

This PR carries Vault credentials (according to the new format in openshift/api#2836 -- role-id, secret-id instead of roleID, secretID) based on https://github.com/openshift/enhancements/blob/master/enhancements/kube-apiserver/kms-encryption-foundations.md.

This PR mimics from 5221c82 commit.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced KMS encryption support with improved credential and secret management. The system now fetches referenced secrets from the configuration namespace and validates required credential data keys are present for KMS plugins.
  • Bug Fixes

    • Improved validation of KMS plugin configuration to ensure all required credentials are properly available and accessible.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 11, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 11, 2026

@ardaguclu: 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:

This PR carries Vault credentials (according to the new format in openshift/api#2836 -- role-id, secret-id instead of roleID, secretID) based on https://github.com/openshift/enhancements/blob/master/enhancements/kube-apiserver/kms-encryption-foundations.md.

This PR mimics from 5221c82 commit.

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR adds KMS plugin secret data fetching and propagation to the encryption operator. The controller now retrieves referenced secrets from the openshift-config namespace during KMS key creation, validates required credential keys, and persists the secret data through the encryption configuration and state APIs.

Changes

KMS Secret Data State and Configuration

Layer / File(s) Summary
KMS secret data state contract
pkg/operator/encryption/state/types.go, pkg/operator/encryption/secrets/types.go
KMSState adds SecretData map[string][]byte field and KeyState.HasKMSSecretData() method; EncryptionSecretKMSSecretDataPrefix constant defines the secret data key format.
KMS secret data serialization
pkg/operator/encryption/secrets/secrets.go, pkg/operator/encryption/encryptiondata/secret.go
ToKeyState and FromKeyState now preserve KMS secret data when converting between secrets and key state; FromSecret and ToSecret parse and write secret data entries with the kms-plugin-secret- prefix and keyID embedding.
KMS secret data configuration building
pkg/operator/encryption/encryptiondata/config.go
FromEncryptionState collects KMSSecretData from read keys, deduplicates by keyID, validates semantic equivalence across duplicates, and includes it in the returned Config.

KMS Plugin Secret Fetching and Validation

Layer / File(s) Summary
KMS referenced secret resolution
pkg/operator/encryption/controllers/key_controller.go
Added referencedSecretName helper that identifies the secret name and required data keys (role-id, secret-id) for VaultKMS providers; generateKeySecret now accepts context.Context and passes it to secret fetching.
KMS secret data population
pkg/operator/encryption/controllers/key_controller.go
When encryption mode is state.KMS, generateKeySecret fetches the referenced secret from openshift-config, validates required keys exist, and populates ks.KMS.SecretData; TODO added for informer wiring on secret data changes.

Testing and Validation

Layer / File(s) Summary
Unit test support and KMS scenarios
pkg/operator/encryption/testing/helpers.go, pkg/operator/encryption/controllers/key_controller_test.go, pkg/operator/encryption/secrets/secrets_test.go, pkg/operator/encryption/encryptiondata/config_test.go
Added CreateVaultAppRoleSecret helper; KMS test cases now create Vault AppRole secrets in initialObjects, expect get:secrets:openshift-config actions, and validate secret data in generated KMS secrets; roundtrip tests verify KMS secret data preservation.
E2E encryption test integration
test/e2e-encryption/encryption_test.go
Informer now watches openshift-config namespace; test creates vault-approle-secret before KMS enablement; new verifyKMSSecretData helper validates that KMS secret data (role-id, secret-id) propagates through both encryption-config and per-key secrets during transitions and rotations.

Sequence Diagram

sequenceDiagram
    participant Ctrl as Key Controller
    participant API as Kubernetes API<br/>(openshift-config)
    participant KMS as KMS State
    participant Config as Encryption Config
    participant Secret as Encryption Secret

    Ctrl->>Ctrl: checkAndCreateKeys
    Ctrl->>Ctrl: generateKeySecret(ctx, mode=KMS)
    
    Ctrl->>API: GET vault-approle-secret<br/>(from openshift-config)
    API-->>Ctrl: Secret with role-id, secret-id
    
    Ctrl->>Ctrl: Validate required keys present
    Ctrl->>KMS: Populate KMS.SecretData<br/>[role-id, secret-id]
    
    Ctrl->>Secret: FromKeyState(ks)
    Secret->>Secret: Write secret data with<br/>kms-plugin-secret- prefix
    
    Secret->>Config: Config includes KMSSecretData
    Config->>Config: Round-trip validation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR involves coordinated changes across multiple layers (controller fetching, state storage, config serialization) with new validation logic in the controller and helpers. The heterogeneous changes span state definitions, serialization logic, controller operations, and comprehensive test updates, requiring careful verification of the round-tripping behavior and KMS integration points.

Suggested labels

lgtm, approved

Suggested reviewers

  • dgrisonnet
🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.62% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning encryption_test.go lines 338-339 have data key format mismatch: test concatenates with double dash but code produces single dash. Also, many assertions lack meaningful failure messages. Remove explicit dash from encryption_test.go lines 338-339 concatenation to match code. Add assertion messages to help diagnose failures. key_controller_test.go format is correct.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: carrying referenced Secret data from API to plugin lifecycle for KMS encryption.
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 All test names are stable and deterministic. The PR uses Go standard table-driven tests with static string literals. No dynamic values like UUIDs, timestamps, or generated IDs are used in test titles.
Microshift Test Compatibility ✅ Passed The test added is NOT Ginkgo-based, only standard Go testing. The custom check applies only to "new Ginkgo e2e tests" which are not present. No MicroShift-incompatible APIs are used.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests (It/Describe/Context/When) were added. Changes to test/e2e-encryption/encryption_test.go are only modifications to existing standard Go test, not Ginkgo. Check not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only encryption config and KMS credential handling. No deployment manifests, pod specs, affinity rules, nodeSelectors, or topology-dependent constraints are introduced.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes. All fmt.Printf calls are in test code (fmtLogger inside TestEncryptionIntegration), which is excluded per check rules. No main(), init(), or suite functions added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR modifies standard Go tests, not Ginkgo e2e tests. The custom check applies only to Ginkgo test patterns (It(), Describe(), Context(), When()). This PR doesn't add any Ginkgo tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from dgrisonnet and p0lyn0mial May 11, 2026 10:52
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 11, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ardaguclu
Once this PR has been reviewed and has the lgtm label, please assign dgrisonnet 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

@ardaguclu
Copy link
Copy Markdown
Member Author

/uncc @dgrisonnet
/cc @p0lyn0mial @bertinatto

@openshift-ci openshift-ci Bot requested review from bertinatto and removed request for dgrisonnet May 11, 2026 10:53
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/operator/encryption/controllers/key_controller.go (1)

231-237: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the actual create error in warning log

At Line 236, the warning logs err, but the failure being handled is createErr. This can log <nil> or the wrong error, which hurts debugging.

💡 Suggested fix
-		syncContext.Recorder().Warningf("EncryptionKeyCreateFailed", "Secret %q failed to create: %v", keySecret.Name, err)
+		syncContext.Recorder().Warningf("EncryptionKeyCreateFailed", "Secret %q failed to create: %v", keySecret.Name, createErr)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/operator/encryption/controllers/key_controller.go` around lines 231 -
237, The warning log after attempting to create the secret uses the wrong error
variable (`err`) instead of the actual creation error (`createErr`); update the
error passed to syncContext.Recorder().Warningf in the code handling
c.secretClient.Secrets(...).Create (and the surrounding block where createErr is
checked) so it reports createErr (e.g., replace the err argument with createErr)
and ensure the returned error is createErr.
🧹 Nitpick comments (1)
pkg/operator/encryption/controllers/key_controller_test.go (1)

333-406: ⚡ Quick win

Add a KMS credential failure-path scenario

Please add one test case where the referenced AppRole secret is missing or missing required keys, and assert degraded/error behavior. The PR changes now hard-depend on this read path, so guarding that path in unit tests would prevent regressions.

Also applies to: 422-435, 517-530

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/operator/encryption/controllers/key_controller_test.go` around lines 333
- 406, Add a new table-driven test case in key_controller_test.go alongside the
existing KMS-success case that simulates a missing/invalid AppRole secret:
create a test entry whose initialObjects omits
encryptiontesting.CreateVaultAppRoleSecret (or includes a secret missing the
"role-id"/"secret-id" keys), set apiServerObjects to apiServerWithKMS, and set
expectedActions to include any attempted gets but not a successful create of the
managed secret; in the validateFunc for that case assert that the controller
records degraded/error behavior (e.g., no create:secrets action, presence of an
event creation action like "create:events:kms" or a status update indicating
degradation) and that the code path handling credentials (the blocks that read
actualSecret.Data keys and annotations) is not reached or reports the
appropriate error; mirror this pattern for the other referenced ranges (422-435,
517-530).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e-encryption/encryption_test.go`:
- Around line 490-503: The test currently hard-codes "vault-approle-secret"
which can collide across parallel runs; change the secret name to a unique
variable (e.g. secretName := fmt.Sprintf("%s-vault-approle-secret-%s",
component, util.RandomSuffix()) or similar) and use that variable everywhere
instead of the string literal: in the kubeClient.CoreV1().Secrets(...).Create
call, the deferred Delete call, the Patch payload passed to
fakeApiServerClient.Patch (the JSON must reference the variable value for
"name"), and any later assertions that reference the credential name; update the
code around the Create/Deferred Delete and the Patch invocation (and the other
occurrences noted in the review) to interpolate the new secretName variable so
tests are isolated.

---

Outside diff comments:
In `@pkg/operator/encryption/controllers/key_controller.go`:
- Around line 231-237: The warning log after attempting to create the secret
uses the wrong error variable (`err`) instead of the actual creation error
(`createErr`); update the error passed to syncContext.Recorder().Warningf in the
code handling c.secretClient.Secrets(...).Create (and the surrounding block
where createErr is checked) so it reports createErr (e.g., replace the err
argument with createErr) and ensure the returned error is createErr.

---

Nitpick comments:
In `@pkg/operator/encryption/controllers/key_controller_test.go`:
- Around line 333-406: Add a new table-driven test case in
key_controller_test.go alongside the existing KMS-success case that simulates a
missing/invalid AppRole secret: create a test entry whose initialObjects omits
encryptiontesting.CreateVaultAppRoleSecret (or includes a secret missing the
"role-id"/"secret-id" keys), set apiServerObjects to apiServerWithKMS, and set
expectedActions to include any attempted gets but not a successful create of the
managed secret; in the validateFunc for that case assert that the controller
records degraded/error behavior (e.g., no create:secrets action, presence of an
event creation action like "create:events:kms" or a status update indicating
degradation) and that the code path handling credentials (the blocks that read
actualSecret.Data keys and annotations) is not reached or reports the
appropriate error; mirror this pattern for the other referenced ranges (422-435,
517-530).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f17da15d-8491-4079-ad4e-9411ca9a23b9

📥 Commits

Reviewing files that changed from the base of the PR and between c22d3e0 and e8bd3ce.

📒 Files selected for processing (13)
  • pkg/operator/encryption/controllers/key_controller.go
  • pkg/operator/encryption/controllers/key_controller_test.go
  • pkg/operator/encryption/encryptiondata/config.go
  • pkg/operator/encryption/encryptiondata/config_test.go
  • pkg/operator/encryption/encryptiondata/secret.go
  • pkg/operator/encryption/kms/credentials.go
  • pkg/operator/encryption/kms/credentials_test.go
  • pkg/operator/encryption/secrets/secrets.go
  • pkg/operator/encryption/secrets/secrets_test.go
  • pkg/operator/encryption/secrets/types.go
  • pkg/operator/encryption/state/types.go
  • pkg/operator/encryption/testing/helpers.go
  • test/e2e-encryption/encryption_test.go

Comment thread test/e2e-encryption/encryption_test.go Outdated
Comment on lines 490 to 503
t.Logf("Create vault AppRole credential secret")
_, err = kubeClient.CoreV1().Secrets("openshift-config").Create(ctx, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: "vault-approle-secret", Namespace: "openshift-config"},
Data: map[string][]byte{
"role-id": []byte("test-role-id"),
"secret-id": []byte("test-secret-id"),
},
Type: corev1.SecretTypeOpaque,
}, metav1.CreateOptions{})
require.NoError(t, err)
defer kubeClient.CoreV1().Secrets("openshift-config").Delete(ctx, "vault-approle-secret", metav1.DeleteOptions{})

t.Logf("Switch to KMS")
_, err = fakeApiServerClient.Patch(ctx, "cluster", types.MergePatchType, []byte(`{"spec":{"encryption":{"type":"KMS","kms":{"type":"Vault","vault":{"kmsPluginImage":"registry.example.com/kms-plugin@sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890","vaultAddress":"https://vault.example.com","authentication":{"type":"AppRole","appRole":{"secret":{"name":"vault-approle-secret"}}},"transitKey":"test-transit-key"}}}}}`), metav1.PatchOptions{})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid hard-coded AppRole secret name in e2e flow

Using a global static name (vault-approle-secret) risks collisions across parallel runs or leftover state in shared clusters. This can produce flaky failures unrelated to the feature.

Consider deriving a unique name from component, and reusing that variable in:

  • secret creation,
  • APIServer KMS patches,
  • credential key assertions.
💡 Suggested direction
+ vaultSecretName := fmt.Sprintf("vault-approle-secret-%s", component)

- ObjectMeta: metav1.ObjectMeta{Name: "vault-approle-secret", Namespace: "openshift-config"},
+ ObjectMeta: metav1.ObjectMeta{Name: vaultSecretName, Namespace: "openshift-config"},

- defer kubeClient.CoreV1().Secrets("openshift-config").Delete(ctx, "vault-approle-secret", metav1.DeleteOptions{})
+ defer kubeClient.CoreV1().Secrets("openshift-config").Delete(ctx, vaultSecretName, metav1.DeleteOptions{})

- ... "appRole":{"secret":{"name":"vault-approle-secret"}} ...
+ ... fmt.Sprintf(`... "appRole":{"secret":{"name":"%s"}} ...`, vaultSecretName) ...

- secrets.EncryptionSecretKMSCredentialPrefix+"-vault-approle-secret-role-id"
+ secrets.EncryptionSecretKMSCredentialPrefix+"-"+vaultSecretName+"-role-id"

Also applies to: 543-543, 572-572, 338-339

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e-encryption/encryption_test.go` around lines 490 - 503, The test
currently hard-codes "vault-approle-secret" which can collide across parallel
runs; change the secret name to a unique variable (e.g. secretName :=
fmt.Sprintf("%s-vault-approle-secret-%s", component, util.RandomSuffix()) or
similar) and use that variable everywhere instead of the string literal: in the
kubeClient.CoreV1().Secrets(...).Create call, the deferred Delete call, the
Patch payload passed to fakeApiServerClient.Patch (the JSON must reference the
variable value for "name"), and any later assertions that reference the
credential name; update the code around the Create/Deferred Delete and the Patch
invocation (and the other occurrences noted in the review) to interpolate the
new secretName variable so tests are isolated.

@ardaguclu ardaguclu force-pushed the carry-kms-credentials branch 2 times, most recently from 36a0adb to ca04a82 Compare May 11, 2026 11:25
@ardaguclu
Copy link
Copy Markdown
Member Author

/retest

@ardaguclu ardaguclu force-pushed the carry-kms-credentials branch from ca04a82 to 715692d Compare May 11, 2026 14:47
@ardaguclu
Copy link
Copy Markdown
Member Author

ardaguclu commented May 11, 2026

/retitle CNTRLPLANE-3237: Carry KMS credentials from referenced Secret

@openshift-ci openshift-ci Bot changed the title WIP: CNTRLPLANE-3237: Carry KMS credentials from referenced Secret CNTRLPLANE-3237: Carry KMS credentials from referenced Secret May 11, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2026
credSecret, err := secretClient.Secrets("openshift-config").Get(ctx, secretName, metav1.GetOptions{})
if err != nil {
return nil, fmt.Errorf("failed to get credential secret %s in openshift-config: %w", secretName, err)
}
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.

instead of returning an error right away, should we give the user time to create the secret, once they set the KMS fields in the api?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think, it is prerequisite for cluster-admin to create secret beforehand. We should degrade if it is not found. This error blocks the new key creation. So this won't impact on cluster's stability.

value, ok := credSecret.Data[key]
if !ok {
return nil, fmt.Errorf("credential secret %s in openshift-config is missing required key %q", secretName, key)
}
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.

yeah, if the secret is malformed, we should probably error out

if !ok {
return nil, fmt.Errorf("credential secret %s in openshift-config is missing required key %q", secretName, key)
}
credentials[secrets.EncryptionSecretKMSCredentialPrefix+"-"+secretName+"-"+key] = string(value)
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.

the credentials secret is not subject to the validation done at admission time, like the KMS fields in the cluster/apiserver CR. I think we should probably validate that the user is setting valid values for these 2 secret keys, wdyt?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Key controller can not have semantic knowledge about what values should be. Preflight checker will validate this.

Comment thread pkg/operator/encryption/state/types.go Outdated
}

func (k *KeyState) HasKMSCredentials() bool {
return k != nil && k.KMS != nil && len(k.KMS.Credentials) > 0
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.

for vault this would actually need to be 2, but I think it's fine as is because you're currently checking that in fetchVaultCredentials

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, I wanted to keep here generic.

return nil, fmt.Errorf("vault AppRole secret reference name is empty")
}

credSecret, err := secretClient.Secrets("openshift-config").Get(ctx, secretName, metav1.GetOptions{})
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.

this secret shouldn't change a lot, so I wonder if we should use a cached client (lister) instead

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea. Let me update it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

However, this requires adding openshift-config to the key controller's informer watch and store SecretLister in keyController struct. If you are ok with this signature change, I can update.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we agreed that we will use secretClient?

}
return short
}

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.

nit: maybe keep these functions together with their plugin-config counterparts in helpers.go

Comment thread pkg/operator/encryption/encryptiondata/config.go Outdated
Copy link
Copy Markdown
Contributor

@p0lyn0mial p0lyn0mial left a comment

Choose a reason for hiding this comment

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

I did a first pass and left a few comments. Let me know what you think. Thanks.

Comment thread pkg/operator/encryption/state/types.go Outdated
// Credentials stores fetched credential values from the referenced secret
// in openshift-config. Keys use the format
// "encryption.apiserver.operator.openshift.io-kms-secret-{secretName}-{keyName}".
Credentials map[string]string
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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is correct. Credentials store key-value map in KMSState which will be converted to each data field.

Comment thread pkg/operator/encryption/state/types.go Outdated
// Credentials stores fetched credential values from the referenced secret
// in openshift-config. Keys use the format
// "encryption.apiserver.operator.openshift.io-kms-secret-{secretName}-{keyName}".
Credentials map[string]string
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.

why not to make it more generic:

SecretData map[string][]byte

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

Plugin: apiServerEncryption.KMS,
}

credentials, err := kms.FetchCredentials(ctx, c.secretClient, apiServerEncryption.KMS)
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.

by making the data struct more generic e.g. SecretData we make this code more generic too:

if secretName := referencedSecretName(apiServerEncryption.KMS); len(secretName) > 0 {
	refSecret, err := c.secretClient.Secrets("openshift-config").Get(ctx, secretName, metav1.GetOptions{})
	...
	sd := make(map[string][]byte, len(refSecret.Data))
	for k, v := range refSecret.Data {
		sd[k] = v
	}
	ks.KMS.SecretData = sd
}

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.

where referencedSecretName could be private and simple:

func referencedSecretName(plugin configv1.KMSPluginConfig) string {
	switch plugin.Type {
	case configv1.VaultKMSProvider:
		return plugin.Vault.Authentication.AppRole.Secret.Name
	default:
		return ""
	}
}

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.

do we already have a const for "openshift-config" namespace ?

Copy link
Copy Markdown
Member Author

@ardaguclu ardaguclu May 14, 2026

Choose a reason for hiding this comment

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

Updated with one difference. We can not carry all the data fields in the given Secret. We need to carry only the selective set of data keys. So referencedSecretName function will also return an array for this. Please let me know your thoughts.

@@ -0,0 +1,90 @@
package kms
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.

mhm, not sure if we need a new file, seems all methods could be private and close to the source.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated.

// KMSCredentials maps keyID to credential data carried from
// Key Secrets into the encryption-config Secret.
// Inner map keys use the short form (e.g. "app-role-role-id").
KMSCredentials map[string]map[string]string
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.

KMSSecretData map[string]map[string][]byte

// EncryptionSecretKMSCredentialPrefix is the data field key prefix for credential values
// fetched from the referenced secret in openshift-config. The full data key is
// constructed by appending "-{secretName}-{dataKey}" to this prefix.
EncryptionSecretKMSCredentialPrefix = "encryption.apiserver.operator.openshift.io-kms-secret"
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.

maybe this should be .....kms-plugin-secret" to align with "encryption.apiserver.operator.openshift.io-kms-plugin-config"

Plugin: apiServerEncryption.KMS,
}

credentials, err := kms.FetchCredentials(ctx, c.secretClient, apiServerEncryption.KMS)
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.

it seems like we miss some dynamic validation, for example we should go degraded when the src secret is removed but referenced.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tracking the current secret references, keeping their content up-to-date, degrading if they are removed will be handled in another PR. This PR only focuses on carrying this data. If Secret is not present, or one one of the selected set of data fields are missing, we will return error (I assume that means we'll degrade).

Plugin: apiServerEncryption.KMS,
}

credentials, err := kms.FetchCredentials(ctx, c.secretClient, apiServerEncryption.KMS)
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.

seems like we miss an informer that would trigger the sync loop.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a TODO for informer.

return state.KeyState{}, fmt.Errorf("%s can not be empty, when mode is KMS", EncryptionSecretKMSPluginConfig)
}
for dataKey, value := range s.Data {
if strings.HasPrefix(dataKey, EncryptionSecretKMSCredentialPrefix) {
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.

i'd like to experiment a bit with how we store data here, e.g. with our without the prefix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sounds good to me. Thanks for spending time on this and review.

@ardaguclu ardaguclu force-pushed the carry-kms-credentials branch from 715692d to c10b32e Compare May 14, 2026 07:29
@ardaguclu
Copy link
Copy Markdown
Member Author

ardaguclu commented May 14, 2026

/retitle CNTRLPLANE-3237: Carry referenced Secret data from API to plugin lifecycle for KMS

@openshift-ci openshift-ci Bot changed the title CNTRLPLANE-3237: Carry KMS credentials from referenced Secret CNTRLPLANE-3237: Carry referenced Secret data from API to plugin lifecycle for KMS May 14, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
pkg/operator/encryption/secrets/types.go (1)

60-64: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove trailing dash from the constant for consistency.

The constant EncryptionSecretKMSSecretDataPrefix has a trailing dash ("...-kms-plugin-secret-"), but the comment on line 63 states "appending -{secretName}-{dataKey}" (implying a leading dash should be added during concatenation). However, the actual usage in secrets.go line 173 directly concatenates prefix + dataKey without adding an intermediate dash.

This creates confusion:

  • If the prefix keeps its trailing dash and code does direct concatenation, the final key has only one dash after "secret" (e.g., "...-kms-plugin-secret-vault-approle-secret-role-id").
  • But the test on line 338 of encryption_test.go adds an explicit dash (prefix + "-vault-approle-secret-role-id"), expecting a double dash.

For consistency with EncryptionSecretKMSPluginConfig (line 59, no trailing dash) and to match the past review suggestion, remove the trailing dash from the constant and update the concatenation sites to add dashes explicitly as needed.

Proposed fix
-	EncryptionSecretKMSSecretDataPrefix = "encryption.apiserver.operator.openshift.io-kms-plugin-secret-"
+	EncryptionSecretKMSSecretDataPrefix = "encryption.apiserver.operator.openshift.io-kms-plugin-secret"

Then update usage in secrets.go line 173 to:

-		s.Data[EncryptionSecretKMSSecretDataPrefix+dataKey] = value
+		s.Data[EncryptionSecretKMSSecretDataPrefix+"-"+dataKey] = value

And in secrets.go line 92 to:

-		if rawKey, found := strings.CutPrefix(dataKey, EncryptionSecretKMSSecretDataPrefix); found && len(rawKey) > 0 {
+		if rawKey, found := strings.CutPrefix(dataKey, EncryptionSecretKMSSecretDataPrefix+"-"); found && len(rawKey) > 0 {

And fix the comment on line 63 to:

-// constructed by appending "-{secretName}-{dataKey}" to this prefix.
+// constructed by appending "-{secretName}-{dataKey}" after this prefix (with a separator dash).

As per coding guidelines from past review comment: "maybe this should be .....kms-plugin-secret" to align with "encryption.apiserver.operator.openshift.io-kms-plugin-config""

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/operator/encryption/secrets/types.go` around lines 60 - 64, Remove the
trailing dash from the EncryptionSecretKMSSecretDataPrefix constant value (make
it "...-kms-plugin-secret") and update all call sites that currently do direct
concatenation with that prefix (e.g., where code builds keys by using
EncryptionSecretKMSSecretDataPrefix + dataKey in secrets.go) to explicitly
insert the needed dash(s) when concatenating (e.g., prefix + "-" + secretName +
"-" + dataKey or prefix + "-" + dataKey as appropriate). Also update the comment
above EncryptionSecretKMSSecretDataPrefix to describe that callers must append
"-{secretName}-{dataKey}", and ensure tests that build expected keys are changed
to use the new explicit-dash concatenation rather than relying on a trailing
dash in the constant; keep EncryptionSecretKMSPluginConfig unchanged.
🧹 Nitpick comments (2)
pkg/operator/encryption/controllers/key_controller.go (1)

287-291: 💤 Low value

Consider using a constant for the openshift-config namespace.

The code hardcodes the "openshift-config" namespace string. For consistency and maintainability, consider defining a constant (e.g., OpenshiftConfigNamespace) that can be reused across the codebase.

Example pattern
const OpenshiftConfigNamespace = "openshift-config"

// Then use:
refSecret, err := c.secretClient.Secrets(OpenshiftConfigNamespace).Get(ctx, secretName, metav1.GetOptions{})

As per past review comment: "do we already have a const for "openshift-config" namespace ?"

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/operator/encryption/controllers/key_controller.go` around lines 287 -
291, The code currently hardcodes "openshift-config" when calling
c.secretClient.Secrets(...) inside the
referencedSecretName(apiServerEncryption.KMS) handling; define a package-level
constant (e.g., const OpenshiftConfigNamespace = "openshift-config") and replace
the literal with that constant so calls like
c.secretClient.Secrets(OpenshiftConfigNamespace).Get(...) use the new constant;
update any other occurrences in this file to use the same constant for
consistency.
test/e2e-encryption/encryption_test.go (1)

490-500: ⚡ Quick win

Consider using a unique secret name to avoid test collisions.

The test creates a Secret with the hardcoded name "vault-approle-secret" in the openshift-config namespace. If multiple test runs execute in parallel against the same cluster, this could cause collisions or flaky failures due to leftover state.

Consider generating a unique name (e.g., including the component variable or a random suffix) and using that name consistently throughout the test—in the Secret creation, the APIServer KMS patch payload, and the credential key assertions.

Example approach
+	vaultSecretName := fmt.Sprintf("vault-approle-secret-%s", component)
 	t.Logf("Create vault AppRole vault AppRole secret")
 	_, err = kubeClient.CoreV1().Secrets("openshift-config").Create(ctx, &corev1.Secret{
-		ObjectMeta: metav1.ObjectMeta{Name: "vault-approle-secret", Namespace: "openshift-config"},
+		ObjectMeta: metav1.ObjectMeta{Name: vaultSecretName, Namespace: "openshift-config"},
 		Data: map[string][]byte{
 			"role-id":   []byte("test-role-id"),
 			"secret-id": []byte("test-secret-id"),
 		},
 		Type: corev1.SecretTypeOpaque,
 	}, metav1.CreateOptions{})
 	require.NoError(t, err)
-	defer kubeClient.CoreV1().Secrets("openshift-config").Delete(ctx, "vault-approle-secret", metav1.DeleteOptions{})
+	defer kubeClient.CoreV1().Secrets("openshift-config").Delete(ctx, vaultSecretName, metav1.DeleteOptions{})

Then update the Patch payload on line 503 to interpolate vaultSecretName instead of the hardcoded string, and adjust lines 332-333 and 338-339 to use the dynamic name.

As per past review comment: "Using a global static name (vault-approle-secret) risks collisions across parallel runs or leftover state in shared clusters."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e-encryption/encryption_test.go` around lines 490 - 500, The test uses
a hardcoded Secret name "vault-approle-secret" which can collide across parallel
runs; replace that literal with a generated unique name (e.g., vaultSecretName
:= fmt.Sprintf("vault-approle-%s-%d", component, rand.Intn(100000))) and use
vaultSecretName when calling kubeClient.CoreV1().Secrets(...).Create and
.Delete, update the APIServer KMS patch payload to interpolate vaultSecretName
instead of the static string, and update the credential/key assertions to
reference vaultSecretName so all uses of the secret are consistent and unique
per test run.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/operator/encryption/controllers/key_controller.go`:
- Line 121: The informer setup currently only watches
"openshift-config-managed"; add an informer for the "openshift-config" namespace
so KMS plugin Secrets updates trigger reconciliation. Specifically, call
kubeInformersForNamespaces.InformersFor("openshift-config").Core().V1().Secrets().Informer()
and include that informer alongside the existing
kubeInformersForNamespaces.InformersFor("openshift-config-managed").Core().V1().Secrets().Informer()
(the same place where shared informers are assembled/started), ensuring the new
informer is registered with the controller and started so updates to Secrets in
openshift-config will enqueue reconciliations for the key controller.

In `@test/e2e-encryption/encryption_test.go`:
- Around line 338-339: The test builds the map key with an extra "-" causing a
double-dash mismatch with how the code stores secrets; update the assertions to
use the same concatenation as the production code by removing the explicit dash
so they read
keySecret.Data[secrets.EncryptionSecretKMSSecretDataPrefix+"vault-approle-secret-role-id"]
and
keySecret.Data[secrets.EncryptionSecretKMSSecretDataPrefix+"vault-approle-secret-secret-id"]
(i.e. match the s.Data[EncryptionSecretKMSSecretDataPrefix+dataKey] behavior),
keeping the existing keyID usage in the error messages.

---

Duplicate comments:
In `@pkg/operator/encryption/secrets/types.go`:
- Around line 60-64: Remove the trailing dash from the
EncryptionSecretKMSSecretDataPrefix constant value (make it
"...-kms-plugin-secret") and update all call sites that currently do direct
concatenation with that prefix (e.g., where code builds keys by using
EncryptionSecretKMSSecretDataPrefix + dataKey in secrets.go) to explicitly
insert the needed dash(s) when concatenating (e.g., prefix + "-" + secretName +
"-" + dataKey or prefix + "-" + dataKey as appropriate). Also update the comment
above EncryptionSecretKMSSecretDataPrefix to describe that callers must append
"-{secretName}-{dataKey}", and ensure tests that build expected keys are changed
to use the new explicit-dash concatenation rather than relying on a trailing
dash in the constant; keep EncryptionSecretKMSPluginConfig unchanged.

---

Nitpick comments:
In `@pkg/operator/encryption/controllers/key_controller.go`:
- Around line 287-291: The code currently hardcodes "openshift-config" when
calling c.secretClient.Secrets(...) inside the
referencedSecretName(apiServerEncryption.KMS) handling; define a package-level
constant (e.g., const OpenshiftConfigNamespace = "openshift-config") and replace
the literal with that constant so calls like
c.secretClient.Secrets(OpenshiftConfigNamespace).Get(...) use the new constant;
update any other occurrences in this file to use the same constant for
consistency.

In `@test/e2e-encryption/encryption_test.go`:
- Around line 490-500: The test uses a hardcoded Secret name
"vault-approle-secret" which can collide across parallel runs; replace that
literal with a generated unique name (e.g., vaultSecretName :=
fmt.Sprintf("vault-approle-%s-%d", component, rand.Intn(100000))) and use
vaultSecretName when calling kubeClient.CoreV1().Secrets(...).Create and
.Delete, update the APIServer KMS patch payload to interpolate vaultSecretName
instead of the static string, and update the credential/key assertions to
reference vaultSecretName so all uses of the secret are consistent and unique
per test run.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e45cd9d6-1c06-461d-b26a-99e572d57f4f

📥 Commits

Reviewing files that changed from the base of the PR and between 715692d and c10b32e.

📒 Files selected for processing (11)
  • pkg/operator/encryption/controllers/key_controller.go
  • pkg/operator/encryption/controllers/key_controller_test.go
  • pkg/operator/encryption/encryptiondata/config.go
  • pkg/operator/encryption/encryptiondata/config_test.go
  • pkg/operator/encryption/encryptiondata/secret.go
  • pkg/operator/encryption/secrets/secrets.go
  • pkg/operator/encryption/secrets/secrets_test.go
  • pkg/operator/encryption/secrets/types.go
  • pkg/operator/encryption/state/types.go
  • pkg/operator/encryption/testing/helpers.go
  • test/e2e-encryption/encryption_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/operator/encryption/encryptiondata/config_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/operator/encryption/testing/helpers.go
  • pkg/operator/encryption/secrets/secrets_test.go
  • pkg/operator/encryption/controllers/key_controller_test.go

Comment thread pkg/operator/encryption/controllers/key_controller.go
Comment thread test/e2e-encryption/encryption_test.go Outdated
@ardaguclu ardaguclu force-pushed the carry-kms-credentials branch from c10b32e to 9309879 Compare May 14, 2026 07:53
Copy link
Copy Markdown
Contributor

@p0lyn0mial p0lyn0mial left a comment

Choose a reason for hiding this comment

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

did another pass, haven't finished. seems like there is a potential of a collision when there is more than one secret in the future ....

if !ok {
return nil, fmt.Errorf("secret %s in openshift-config is missing required key %q", secretName, key)
}
sd[secretName+"-"+key] = v
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 if secretName already contains - ? is this a problem ?
what if key already contains - ? is this a problem ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

From the encryption controller's perspective this is not a problem. It concatenates secretName and key and propagates to the plugin lifecycle as is.

But this collision can be a problem in plugin lifecycle side. I'd like to discuss more.

if !ok {
return nil, fmt.Errorf("secret %s in openshift-config is missing required key %q", secretName, key)
}
sd[secretName+"-"+key] = v
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 if:

secretName="vault-approle", key="secret-role-id" gives "vault-approle-secret-role-id"
secretName="vault-approle-secret", key="role-id" gives "vault-approle-secret-role-id"

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.

in the future we might ref more than one secret.

func referencedSecretName(plugin configv1.KMSPluginConfig) (string, []string) {
switch plugin.Type {
case configv1.VaultKMSProvider:
return plugin.Vault.Authentication.AppRole.Secret.Name, []string{"role-id", "secret-id"}
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.

it is important that we document that we only care respect []string{"role-id", "secret-id"}

require.NotEmpty(t, secretData, "expected non-empty secret data for keyID %s", keyID)

// Verify actual values match the source secret
require.Equal(t, "test-role-id", secretData["vault-approle-secret-role-id"], "role-id secret data mismatch for keyID %s", keyID)
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.

does the comparison work ? we are comparing []byte with string. i guess it works because in go string actually is []byte

for _, key := range expectedKeys {
v, ok := refSecret.Data[key]
if !ok {
return nil, fmt.Errorf("secret %s in openshift-config is missing required key %q", secretName, key)
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.

worth adding unit tests to covert his scenario ?

// KMSSecretData maps keyID to secret data carried from
// Key Secrets into the encryption-config Secret.
// Inner map keys use the short form (e.g. "app-role-role-id").
KMSSecretData map[string]map[string][]byte
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.

maybe we should rename to KMSPluginsSecretData ?

// (e.g. "kms-plugin-secret-app-role-role-id-1"). KeyIDFromSecretDataKey
// returns the keyID (e.g. "1") and the secretDataKey (e.g. "app-role-role-id").
var kmsSecretData map[string]map[string][]byte
for key, value := range encryptionConfigSecret.Data {
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.

do we have tests that cover changes in this file ?

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.

seems like not everything is covered.

}

// Write secret data entries to the encryption-config Secret.
// Each secret dataKey (e.g. "app-role-role-id") is combined with the keyID
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 if the keyID=123 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

WDYM?. It will be kms-plugin-secret-app-role-role-id-123?

}

// Write secret data entries to the encryption-config Secret.
// Each secret dataKey (e.g. "app-role-role-id") is combined with the keyID
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 if dataKey=token-123 ?

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.

please add unit test to cover all edge cases.

if err != nil {
return nil, err
}
s.Data[dataKey] = value
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.

if we have the same dataKey from two different secrets then I think we have a collision here.

EncryptionConfSecretKey = "encryption-config"
// encryptionConfigSecretDataPrefix is the data key prefix for KMS plugin secret
// data entries in the encryption-config Secret. Full key: "kms-plugin-secret-{secretDataKey}-{keyID}".
encryptionConfigSecretDataPrefix = "kms-plugin-secret-"
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.

worth updating the KEP.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@ardaguclu: 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-aws-encryption 9309879 link true /test e2e-aws-encryption

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.


// SecretData stores fetched values from the referenced secret
// in openshift-config. Keys use the format "{secretName}-{keyName}".
SecretData map[string][]byte
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.

maybe this should be:

SecretData map[string]map[string][]byte  // secretName to dataKey to value

@ardaguclu
Copy link
Copy Markdown
Member Author

/hold
until collision solution is agreed and implemented

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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