Skip to content

Commit

Permalink
runtime - fixes #147
Browse files Browse the repository at this point in the history
  • Loading branch information
clux committed Feb 26, 2020
1 parent f02777e commit d2f7bdf
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.27.0 / 2020-02-XX
===================
* `Reflector` + `Informer` moved from `kube::api` to `kube::runtime`

0.26.0 / 2020-02-25
===================
* Fix a large percentage of EOFs from watches #146
Expand Down
6 changes: 1 addition & 5 deletions examples/configmap_reflector.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#[macro_use] extern crate log;
use kube::{
api::{Api, Reflector},
client::APIClient,
config,
};
use kube::{api::Api, client::APIClient, config, runtime::Reflector};

/// Example way to read secrets
#[tokio::main]
Expand Down
3 changes: 2 additions & 1 deletion examples/crd_reflector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ use futures_timer::Delay;
use std::time::Duration;

use kube::{
api::{NotUsed, Object, RawApi, Reflector},
api::{NotUsed, Object, RawApi},
client::APIClient,
config,
runtime::Reflector,
};

// Own custom resource spec
Expand Down
6 changes: 1 addition & 5 deletions examples/deployment_reflector.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#[macro_use] extern crate log;
use kube::{
api::{Api, Reflector},
client::APIClient,
config,
};
use kube::{api::Api, client::APIClient, config, runtime::Reflector};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
Expand Down
3 changes: 2 additions & 1 deletion examples/event_informer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[macro_use] extern crate log;
use kube::{
api::{v1Event, Api, Informer, WatchEvent},
api::{v1Event, Api, WatchEvent},
client::APIClient,
config,
runtime::Informer,
};

use futures::StreamExt;
Expand Down
3 changes: 2 additions & 1 deletion examples/node_informer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
use futures::StreamExt;
use k8s_openapi::api::core::v1::{NodeSpec, NodeStatus};
use kube::{
api::{v1Event, Api, Informer, ListParams, Object, RawApi, WatchEvent},
api::{v1Event, Api, ListParams, Object, RawApi, WatchEvent},
client::APIClient,
config,
runtime::Informer,
};

type Node = Object<NodeSpec, NodeStatus>;
Expand Down
6 changes: 1 addition & 5 deletions examples/node_reflector.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#[macro_use] extern crate log;
use futures_timer::Delay;
use kube::{
api::{Api, Reflector},
client::APIClient,
config,
};
use kube::{api::Api, client::APIClient, config, runtime::Reflector};

use std::time::Duration;

Expand Down
3 changes: 2 additions & 1 deletion examples/pod_informer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
use futures::{StreamExt, TryStreamExt};
use k8s_openapi::api::core::v1::{PodSpec, PodStatus};
use kube::{
api::{Api, Informer, Object, WatchEvent},
api::{Api, Object, WatchEvent},
client::APIClient,
config,
runtime::Informer,
};
use std::env;
type Pod = Object<PodSpec, PodStatus>;
Expand Down
6 changes: 1 addition & 5 deletions examples/pod_reflector.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#[macro_use] extern crate log;
use futures_timer::Delay;
use kube::{
api::{Api, Reflector},
client::APIClient,
config,
};
use kube::{api::Api, client::APIClient, config, runtime::Reflector};
use std::time::Duration;

#[tokio::main]
Expand Down
6 changes: 1 addition & 5 deletions examples/secret_reflector.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#[macro_use] extern crate log;
use std::collections::BTreeMap;

use kube::{
api::{Api, Reflector},
client::APIClient,
config,
};
use kube::{api::Api, client::APIClient, config, runtime::Reflector};

/// Example way to read secrets
#[derive(Debug)]
Expand Down
12 changes: 3 additions & 9 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ pub struct NotUsed {}
#[deprecated]
pub type Void = NotUsed;

mod reflector;
pub use self::reflector::Reflector;

mod informer;
pub use self::informer::Informer;

mod raw;
pub(crate) mod raw;
pub use raw::{DeleteParams, ListParams, PatchParams, PatchStrategy, PostParams, PropagationPolicy, RawApi};

mod typed;
pub(crate) mod typed;
pub use typed::Api;

mod subresource;
pub use subresource::{LogParams, Scale, ScaleSpec, ScaleStatus};

mod resource;
pub(crate) mod resource;
pub use self::resource::{KubeObject, Object, ObjectList, WatchEvent};

mod openapi;
Expand Down
8 changes: 4 additions & 4 deletions src/api/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ use crate::{
#[derive(Clone)]
pub struct Api<K> {
/// The request creator object
pub(in crate::api) api: RawApi,
pub(crate) api: RawApi,
/// The client to use (from this library)
pub(in crate::api) client: APIClient,
/// sPec and statUs structs
pub(in crate::api) phantom: PhantomData<K>,
pub(crate) client: APIClient,
/// Underlying Object unstored
pub(crate) phantom: PhantomData<K>,
}

/// Expose same interface as Api for controlling scope/group/versions/ns
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ pub mod api;
pub mod client;
pub mod config;
mod oauth2;
pub mod runtime;
File renamed without changes.
5 changes: 5 additions & 0 deletions src/runtime/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod reflector;
pub use self::reflector::Reflector;

mod informer;
pub use self::informer::Informer;
File renamed without changes.

0 comments on commit d2f7bdf

Please sign in to comment.