mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-22 09:49:35 +00:00
protocols: add support sealed_secret
To call CDH ttrpc API, 'unseal_secret' for 'sealed_secret', add protocol file and generate ttrpc code. Fixes: #7544 Signed-off-by: Biao Lu <biao.lu@intel.com>
This commit is contained in:
parent
83b020f4a3
commit
4e3a1ebcaf
@ -9,6 +9,7 @@ license = "Apache-2.0"
|
|||||||
default = []
|
default = []
|
||||||
with-serde = [ "serde", "serde_json" ]
|
with-serde = [ "serde", "serde_json" ]
|
||||||
async = ["ttrpc/async", "async-trait"]
|
async = ["ttrpc/async", "async-trait"]
|
||||||
|
sealed-secret = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ttrpc = { version = "0.7.1" }
|
ttrpc = { version = "0.7.1" }
|
||||||
|
@ -204,6 +204,8 @@ fn real_main() -> Result<(), std::io::Error> {
|
|||||||
"protos/agent.proto",
|
"protos/agent.proto",
|
||||||
"protos/health.proto",
|
"protos/health.proto",
|
||||||
"protos/image.proto",
|
"protos/image.proto",
|
||||||
|
#[cfg(feature = "sealed-secret")]
|
||||||
|
"protos/sealed_secret.proto",
|
||||||
],
|
],
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
@ -211,6 +213,11 @@ fn real_main() -> Result<(), std::io::Error> {
|
|||||||
fs::rename("src/agent_ttrpc.rs", "src/agent_ttrpc_async.rs")?;
|
fs::rename("src/agent_ttrpc.rs", "src/agent_ttrpc_async.rs")?;
|
||||||
fs::rename("src/health_ttrpc.rs", "src/health_ttrpc_async.rs")?;
|
fs::rename("src/health_ttrpc.rs", "src/health_ttrpc_async.rs")?;
|
||||||
fs::rename("src/image_ttrpc.rs", "src/image_ttrpc_async.rs")?;
|
fs::rename("src/image_ttrpc.rs", "src/image_ttrpc_async.rs")?;
|
||||||
|
#[cfg(feature = "sealed-secret")]
|
||||||
|
fs::rename(
|
||||||
|
"src/sealed_secret_ttrpc.rs",
|
||||||
|
"src/sealed_secret_ttrpc_async.rs",
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
codegen(
|
codegen(
|
||||||
@ -219,6 +226,8 @@ fn real_main() -> Result<(), std::io::Error> {
|
|||||||
"protos/agent.proto",
|
"protos/agent.proto",
|
||||||
"protos/health.proto",
|
"protos/health.proto",
|
||||||
"protos/image.proto",
|
"protos/image.proto",
|
||||||
|
#[cfg(feature = "sealed-secret")]
|
||||||
|
"protos/sealed_secret.proto",
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
)?;
|
)?;
|
||||||
|
27
src/libs/protocols/protos/sealed_secret.proto
Normal file
27
src/libs/protocols/protos/sealed_secret.proto
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package api;
|
||||||
|
|
||||||
|
message UnsealSecretInput {
|
||||||
|
bytes secret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnsealSecretOutput {
|
||||||
|
bytes plaintext = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetResourceRequest {
|
||||||
|
string ResourcePath = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetResourceResponse {
|
||||||
|
bytes Resource = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
service SealedSecretService {
|
||||||
|
rpc UnsealSecret(UnsealSecretInput) returns (UnsealSecretOutput) {};
|
||||||
|
}
|
||||||
|
|
||||||
|
service GetResourceService {
|
||||||
|
rpc GetResource(GetResourceRequest) returns (GetResourceResponse) {};
|
||||||
|
}
|
@ -31,3 +31,10 @@ pub use serde_config::{
|
|||||||
deserialize_enum_or_unknown, deserialize_message_field, serialize_enum_or_unknown,
|
deserialize_enum_or_unknown, deserialize_message_field, serialize_enum_or_unknown,
|
||||||
serialize_message_field,
|
serialize_message_field,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "sealed-secret")]
|
||||||
|
pub mod sealed_secret;
|
||||||
|
#[cfg(feature = "sealed-secret")]
|
||||||
|
pub mod sealed_secret_ttrpc;
|
||||||
|
#[cfg(all(feature = "sealed-secret", feature = "async"))]
|
||||||
|
pub mod sealed_secret_ttrpc_async;
|
||||||
|
Loading…
Reference in New Issue
Block a user