Skip to content

CNTRLPLANE-2241: Conditionally add the KMS plugin volume mount to the kube-apiserver container#2015

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
bertinatto:kms
Jan 29, 2026
Merged

CNTRLPLANE-2241: Conditionally add the KMS plugin volume mount to the kube-apiserver container#2015
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
bertinatto:kms

Conversation

@bertinatto
Copy link
Copy Markdown
Member

@bertinatto bertinatto commented Jan 23, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 23, 2026

Walkthrough

Update adds a new featureGateAccessor parameter and field to the target config controller APIs and propagates it through callers for KMS plugin volume/mount integration; also updates dependency versions in go.mod and promotes gomega to a direct require.

Changes

Cohort / File(s) Summary
Target Config Controller
pkg/operator/starter.go, pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Add featureGateAccessor featuregates.FeatureGateAccess field to TargetConfigController; update NewTargetConfigController signature to accept it; update managePods signature and callers to pass featureGateAccessor and invoke encryptionkms.AddKMSPluginVolumeAndMountToPodSpec with it.
Dependencies
go.mod
Bump github.com/openshift/api, github.com/openshift/client-go, github.com/openshift/library-go; add github.com/onsi/gomega v1.35.1 as a direct require.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings

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

@openshift-ci openshift-ci bot requested review from benluddy and p0lyn0mial January 23, 2026 18:49
@bertinatto
Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 23, 2026

@bertinatto: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ba812410-f890-11f0-8937-792694951cf7-0

return fmt.Errorf("failed to get apiserver/cluster: %w", err)
}

if apiServer.Spec.Encryption.Type != configv1.EncryptionTypeKMS {
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.

This decision needs to be based on the revision we're currently rendering, not the current state. We also need to keep mounting the socket path when we're migrating from a revision where KMS was previously enabled.

Maybe the encryption controllers should be able to return any host path(s) they need for a given revision? This is subtle, and we will want to keep implementations in sync across the different apiserver operators.

Copy link
Copy Markdown
Member

@ardaguclu ardaguclu Jan 26, 2026

Choose a reason for hiding this comment

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

This decision needs to be based on the revision we're currently rendering, not the current state. We also need to keep mounting the socket path when we're migrating from a revision where KMS was previously enabled.

I agree with @benluddy.

Let's say, APIServer CR is configured like this;

apiVersion: config.openshift.io/v1
kind: APIServer
metadata:
  name: cluster
spec:
  encryption:
    type: KMS

Encryption controllers generates;

apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
  - resources:
      - secrets
    providers:
      - kms:
          name: myKmsProvider
          endpoint: unix:///var/run/kms-plugin/socket.sock
          cachesize: 100
          timeout: 3s
      - identity: {}

After that cluster admin moves to aescbc;

apiVersion: config.openshift.io/v1
kind: APIServer
metadata:
  name: cluster
spec:
  encryption:
    type: aescbc

EncryptionConfiguration is in this format;

apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
  - resources:
      - secrets
    providers:
     - aescbc:
          keys:
            - name: key1
              secret: key
      - kms: # <---- KMS is still in here
          name: myKmsProvider
          endpoint: unix:///var/run/kms-plugin/socket.sock
          cachesize: 100
          timeout: 3s
      - identity: {}

In order to migrate resources from KMS to aescbc, kms plugin must still be accessible.

In my opinion, if feature gate is enabled, we can always mount this hostPath. In v2, if we adopt side-car approach, kms plugin will be accessible within the pod network and we won't need hostPath.

Maybe the encryption controllers should be able to return any host path(s) they need for a given revision? This is subtle, and we will want to keep implementations in sync across the different apiserver operators.

Encryption controllers are provider agnostic. So they don't know these details. But I believe that we'll need plugin lifecycle controllers which can return this information.

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.

Let’s also add a comment that this solution is considered temporary and is needed for v1.
In the future, we will probably come up with a different solution.

I also think that for v1, if FG is enabled, we could simply use hostPath - let's keep it simple for now.

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 looks like the new FG will be KMSEncryption

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.

Switched to use the feature gate instead. Also, added a comment stating this is a temporary solution.

@bertinatto bertinatto force-pushed the kms branch 2 times, most recently from 05ca276 to 0f9be05 Compare January 26, 2026 17:28
@bertinatto
Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 26, 2026

@bertinatto: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/86364ca0-fadc-11f0-8791-89ff27c17445-0

@bertinatto
Copy link
Copy Markdown
Member Author

/hold
For https://github.com/openshift/api/pull/2669/files (I'll need to re-vendor and change the feature gate name).

@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 Jan 26, 2026
@bertinatto bertinatto changed the title Conditionally add the KMS plugin volume mount to the kube-apiserver container WIP" Conditionally add the KMS plugin volume mount to the kube-apiserver container Jan 26, 2026
@bertinatto bertinatto changed the title WIP" Conditionally add the KMS plugin volume mount to the kube-apiserver container WIP: Conditionally add the KMS plugin volume mount to the kube-apiserver container Jan 26, 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 Jan 26, 2026
@bertinatto
Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 26, 2026

@bertinatto: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/b6582390-faf0-11f0-9d5b-cd80cedec70e-0

@bertinatto
Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 27, 2026

@bertinatto: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/845ac2b0-fb88-11f0-86f7-a63e297741b3-0

@bertinatto
Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
/payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 28, 2026

@bertinatto: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview
  • periodic-ci-openshift-release-master-nightly-4.22-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/6c0f51e0-fc72-11f0-95f5-0f998cdda80a-0

@bertinatto
Copy link
Copy Markdown
Member Author

/retest

@bertinatto
Copy link
Copy Markdown
Member Author

/test k8s-e2e-gcp

@bertinatto
Copy link
Copy Markdown
Member Author

/retest

@bertinatto bertinatto changed the title WIP: Conditionally add the KMS plugin volume mount to the kube-apiserver container Conditionally add the KMS plugin volume mount to the kube-apiserver container Jan 29, 2026
go.mod Outdated
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96
)

require github.com/onsi/gomega v1.35.1
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.

What caused this change?

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.

also could it be merged with the existing require block ?

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.

no, go.mod isn't supposed to be edited manually, go mod should be used instead. Something in the chain of the library-go bump caused this

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

🤖 Fix all issues with AI agents
In `@go.mod`:
- Around line 40-41: The standalone require for github.com/onsi/gomega v1.35.1
// indirect should be moved into the existing indirect require block so all
indirect dependencies are grouped together; edit the go.mod to remove the
separate line and insert that require entry into the existing indirect block
(near the other // indirect entries) preserving alphabetical order among the
package paths.

}

if err := encryptionkms.AddKMSPluginVolumeAndMountToPodSpec(&required.Spec, "kube-apiserver", featureGateAccessor); err != nil {
return nil, false, fmt.Errorf("failed to add KMS encryption volumes: %v", err)
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.

wrap the err with %w

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

@p0lyn0mial
Copy link
Copy Markdown
Contributor

/lgtm

@p0lyn0mial
Copy link
Copy Markdown
Contributor

p0lyn0mial commented Jan 29, 2026

/retitle CNTRLPLANE-2241: Conditionally add the KMS plugin volume mount to the kube-apiserver container

@openshift-ci openshift-ci bot changed the title Conditionally add the KMS plugin volume mount to the kube-apiserver container CNTRLPLANE-2241: Conditionally add the KMS plugin volume mount to the kube-apiserver container Jan 29, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Jan 29, 2026

@bertinatto: This pull request references CNTRLPLANE-2241 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 "4.22.0" version, but no target version was set.

Details

In response to this:

/assign @ardaguclu @benluddy @p0lyn0mial

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 openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 29, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 29, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bertinatto, 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2026
@bertinatto
Copy link
Copy Markdown
Member Author

/retest-required

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 29, 2026

@bertinatto: The following tests 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-gcp-operator-encryption-single-node f82dace link false /test e2e-gcp-operator-encryption-single-node
ci/prow/e2e-gcp-operator-serial-ote f82dace link false /test e2e-gcp-operator-serial-ote

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.

@bertinatto
Copy link
Copy Markdown
Member Author

/verified by @bertinatto

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jan 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@bertinatto: This PR has been marked as verified by @bertinatto.

Details

In response to this:

/verified by @bertinatto

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-merge-bot openshift-merge-bot bot merged commit fecf00c into openshift:main Jan 29, 2026
22 of 24 checks passed
@bertinatto
Copy link
Copy Markdown
Member Author

/cherry-pick release-4.21

@openshift-cherrypick-robot
Copy link
Copy Markdown

@bertinatto: #2015 failed to apply on top of branch "release-4.21":

Applying: Conditionally add the KMS plugin volume mount to the kube-apiserver container
Applying: Bump library-go to get KMS helper
.git/rebase-apply/patch:380: trailing whitespace.
update-non-codegen: update-protobuf tests-vendor update-prerelease-lifecycle-gen 
.git/rebase-apply/patch:1165: new blank line at EOF.
+
.git/rebase-apply/patch:5737: new blank line at EOF.
+
warning: 3 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	go.mod
M	go.sum
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Removing vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/gcpserviceendpoint.go
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Bump library-go to get KMS helper

Details

In response to this:

/cherry-pick release-4.21

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.

@ardaguclu
Copy link
Copy Markdown
Member

/cherry-pick release-4.21

In any case I will have to bump apiservers with the changes in library-go. Maybe it is better to get the changes in that PR.

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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants