Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(encryption): fetch secret params from secret source #1833

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dsharma-dc
Copy link
Contributor

@dsharma-dc dsharma-dc commented Mar 12, 2025

When no encryption parameters present create pool request => non-encrypted pool created. no parsing required.

When encryption parameters present source in create/import pool request:

  1. if source file/Secret not found - create/import fails.
  2. if file/Secret found but data has parsing issues -> create/import fails.
  3. if file/Secret parsed successfully -> create/import succeeds.

Basically if a secret source is provided(either a file or a K8s secret), we should always fail if there is any trouble getting params.

@dsharma-dc dsharma-dc force-pushed the fetch_secret branch 2 times, most recently from 9e4dd98 to bb2278a Compare March 13, 2025 09:23
@dsharma-dc
Copy link
Contributor Author

bors try

bors-openebs-mayastor bot pushed a commit that referenced this pull request Mar 13, 2025
@bors-openebs-mayastor
Copy link

try

Build failed:

@dsharma-dc dsharma-dc marked this pull request as ready for review March 13, 2025 11:54
@dsharma-dc dsharma-dc requested a review from a team as a code owner March 13, 2025 11:54
Signed-off-by: Diwakar Sharma <diwakar.sharma@datacore.com>
@@ -57,6 +68,85 @@ impl From<GrowPoolRequest> for FindPoolArgs {
}
}

/// Parse and return encryption parameters from a Kubernetes secret or a file.
async fn _params_get_from_secret_source(secret_source_name: &str) -> Result<PoolEncKey, Status> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be placed on a dependencies crate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should also be placed on a dependencies crate

I can do that in a separate PR as it will need to be made generic based, currently it's tied to PoolEncKey type.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather to that first, and not have this repo know anything about "PlatformDeployer" or even "kube" crate

let enc_key = match params {
PoolEncryptionParams::Create(enc_arg) => {
match enc_arg.clone() {
// Would have been nice to deduplicate the code if we could call secret_data using a
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the problem here that we defined the create and import types separately, rather than reusing? (I mean in the protobuf files)

oneof encryption {
    EncryptionData data = 5;
    EncryptionSecret secret = 6;
  }

If we put the oneof on a spearate definition, then we can reuse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we put the oneof on a spearate definition, then we can reuse it?

We had noticed this and tried to put this into common proto. But then, that requires a type to be defined for use as oneof. So that was resulting into again some nested types and complex handling.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it depends where we want to pay the price. This way we're paying it here by duplicating since we now have 2 different types for the same thing essentially.

Signed-off-by: Diwakar Sharma <diwakar.sharma@datacore.com>
@dsharma-dc
Copy link
Contributor Author

bors try

bors-openebs-mayastor bot pushed a commit that referenced this pull request Mar 17, 2025
@bors-openebs-mayastor
Copy link

try

Build succeeded:

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