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

Update controller and agent to kube-rs client 0.91.0 #702

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
402 changes: 305 additions & 97 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ env_logger = "0.10.0"
futures = { version = "0.3.1", package = "futures" }
hyper = "0.14.2"
itertools = "0.12.0"
k8s-openapi = { version = "0.20.0", default-features = false, features = ["schemars", "v1_23"] }
kube = { version = "0.87.1", features = ["derive"] }
kube-runtime = { version = "0.87.1", features = ["unstable-runtime-reconcile-on"] }
k8s-openapi = { version = "0.22.0", default-features = false, features = ["schemars", "v1_25"] }
kube = { version = "0.91.0", features = [ "derive", "runtime"] }
kube-runtime = { version = "0.91.0", features = ["unstable-runtime-reconcile-on"] }
lazy_static = "1.4"
log = "0.4"
mockall_double = "0.3.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use futures::future::try_join_all;
use futures::FutureExt;
use itertools::Itertools;
use kube::core::ObjectMeta;
use kube_runtime::reflector::ObjectRef;
use kube::runtime::reflector::ObjectRef;
use tokio::select;
use tokio::sync::mpsc;
use tokio::sync::watch;
Expand Down
2 changes: 1 addition & 1 deletion agent/src/discovery_handler_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{collections::HashMap, sync::Arc};
use akri_shared::{akri::configuration::Configuration, k8s::api::IntoApi};
use k8s_openapi::api::core::v1::{ConfigMap, Secret};

use kube_runtime::reflector::ObjectRef;
use kube::runtime::reflector::ObjectRef;
use thiserror::Error;
use tokio::sync::{mpsc, watch};

Expand Down
131 changes: 83 additions & 48 deletions agent/src/plugin_manager/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ pub struct NumaNode {
/// Generated client implementations.
pub mod pod_resources_lister_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// PodResourcesLister is a service provided by the kubelet that provides information about the
/// node resources consumed by pods and containers on the node
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -134,8 +134,9 @@ pub mod pod_resources_lister_client {
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
PodResourcesListerClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -173,16 +174,23 @@ pub mod pod_resources_lister_client {
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListPodResourcesRequest>,
) -> std::result::Result<tonic::Response<super::ListPodResourcesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::ListPodResourcesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/v1.PodResourcesLister/List");
let path = http::uri::PathAndQuery::from_static(
"/v1.PodResourcesLister/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("v1.PodResourcesLister", "List"));
Expand All @@ -191,23 +199,28 @@ pub mod pod_resources_lister_client {
pub async fn get_allocatable_resources(
&mut self,
request: impl tonic::IntoRequest<super::AllocatableResourcesRequest>,
) -> std::result::Result<tonic::Response<super::AllocatableResourcesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::AllocatableResourcesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/v1.PodResourcesLister/GetAllocatableResources",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"v1.PodResourcesLister",
"GetAllocatableResources",
));
req.extensions_mut()
.insert(
GrpcMethod::new("v1.PodResourcesLister", "GetAllocatableResources"),
);
self.inner.unary(req, path, codec).await
}
}
Expand All @@ -222,11 +235,17 @@ pub mod pod_resources_lister_server {
async fn list(
&self,
request: tonic::Request<super::ListPodResourcesRequest>,
) -> std::result::Result<tonic::Response<super::ListPodResourcesResponse>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::ListPodResourcesResponse>,
tonic::Status,
>;
async fn get_allocatable_resources(
&self,
request: tonic::Request<super::AllocatableResourcesRequest>,
) -> std::result::Result<tonic::Response<super::AllocatableResourcesResponse>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::AllocatableResourcesResponse>,
tonic::Status,
>;
}
/// PodResourcesLister is a service provided by the kubelet that provides information about the
/// node resources consumed by pods and containers on the node
Expand All @@ -253,7 +272,10 @@ pub mod pod_resources_lister_server {
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
Expand Down Expand Up @@ -309,11 +331,15 @@ pub mod pod_resources_lister_server {
"/v1.PodResourcesLister/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: PodResourcesLister>(pub Arc<T>);
impl<T: PodResourcesLister>
tonic::server::UnaryService<super::ListPodResourcesRequest> for ListSvc<T>
{
impl<
T: PodResourcesLister,
> tonic::server::UnaryService<super::ListPodResourcesRequest>
for ListSvc<T> {
type Response = super::ListPodResourcesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListPodResourcesRequest>,
Expand Down Expand Up @@ -351,22 +377,26 @@ pub mod pod_resources_lister_server {
"/v1.PodResourcesLister/GetAllocatableResources" => {
#[allow(non_camel_case_types)]
struct GetAllocatableResourcesSvc<T: PodResourcesLister>(pub Arc<T>);
impl<T: PodResourcesLister>
tonic::server::UnaryService<super::AllocatableResourcesRequest>
for GetAllocatableResourcesSvc<T>
{
impl<
T: PodResourcesLister,
> tonic::server::UnaryService<super::AllocatableResourcesRequest>
for GetAllocatableResourcesSvc<T> {
type Response = super::AllocatableResourcesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AllocatableResourcesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as PodResourcesLister>::get_allocatable_resources(
&inner, request,
)
.await
&inner,
request,
)
.await
};
Box::pin(fut)
}
Expand Down Expand Up @@ -394,14 +424,18 @@ pub mod pod_resources_lister_server {
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap())
}),
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
Expand All @@ -427,7 +461,8 @@ pub mod pod_resources_lister_server {
write!(f, "{:?}", self.0)
}
}
impl<T: PodResourcesLister> tonic::server::NamedService for PodResourcesListerServer<T> {
impl<T: PodResourcesLister> tonic::server::NamedService
for PodResourcesListerServer<T> {
const NAME: &'static str = "v1.PodResourcesLister";
}
}
Loading
Loading