Skip to content

operator: KBS API for LUKS key registration#248

Open
iroykaufman wants to merge 1 commit intotrusted-execution-clusters:mainfrom
iroykaufman:luks-key
Open

operator: KBS API for LUKS key registration#248
iroykaufman wants to merge 1 commit intotrusted-execution-clusters:mainfrom
iroykaufman:luks-key

Conversation

@iroykaufman
Copy link
Copy Markdown
Contributor

Currently, every time the LUKS key is updated, the operator patches the trustee deployment, which causes a restart of the pod. This PR introduces a way to avoid this by setting the LUKS key using the KBS API.

Core implementation points:

  • Right before the trustee first deploys the operator, create an auth key for the KBS API and save it as a kube secret.
  • Replacing the patch mechanism with API calls
  • Add a reconcile loop that watches for changes in the trustee deployment and sync LUKS key that was lost.

Tests:

  • test_luks_key_sync - this test checks that the luks key is first sent to tustee and validates that after trustee restarts, the keys are sent again. Also, at the end, I delete one of the machines and check that the secret has been deleted.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 4, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: iroykaufman

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

Copy link
Copy Markdown
Contributor

@Jakob-Naucke Jakob-Naucke left a comment

Choose a reason for hiding this comment

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

Thank you for creating this, and thank you for already creating a test. Make sure that linting & build/unit tests pass.

Comment thread operator/src/trustee.rs
pub async fn launch_trustee_sync_controller(client: Client) {
let deployments: Api<Deployment> = Api::default_namespaced(client.clone());
let watcher_config = watcher::Config {
label_selector: Some("app=kbs".to_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.

nit: maybe a constant also used in generate_kbs_{service,deployment} is better

Comment thread operator/src/trustee.rs Outdated
use serde::{Serialize, Serializer};
use serde_json::{Value::String as JsonString, json};
use std::collections::BTreeMap;
use kbs_client;
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
Contributor Author

Choose a reason for hiding this comment

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

Right

- Right before the trustee first deploys the operator, create an auth key for the KBS API and save it as a kube secret.
- Replacing the patch mechanism with API calls
- Add a reconcile loop that watches for changes in the trustee deployment and sync LUKS key that was lost.

Test: test_luks_key_sync - this test checks that the luks key is first sent to tustee and
validates that after trustee restarts, the keys are sent again.

Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
@iroykaufman
Copy link
Copy Markdown
Contributor Author

The CI is failing because we need to have some Perl dependency. I solved this by adding this RUN dnf install -y perl-FindBin perl-core to the containerfile. @Jakob-Naucke, any idea what the best approach is to solve it for the CI?

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 6, 2026

@iroykaufman: 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/operator-lifecycle-verify c5ec81d link true /test operator-lifecycle-verify

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.

@Jakob-Naucke
Copy link
Copy Markdown
Contributor

@iroykaufman these tests run in (Ubuntu) GHA containers that aren't affected by the Containerfile (this would get picked up in integration tests once I manage to fix them). You'll need to add them to the steps in .github/rust.yml:

steps:
  - name: "Install OpenSSL dependencies"
    run: apt-get install -y …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants