Skip to content

Commit

Permalink
Make Discovery::groups have deterministic order
Browse files Browse the repository at this point in the history
Fixes #886

Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed Apr 24, 2022
1 parent 5f0ff7d commit 3c2edaf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kube-client/src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{Client, Result};
pub use kube_core::discovery::{verbs, ApiCapabilities, ApiResource, Scope};
use kube_core::gvk::GroupVersionKind;
use std::collections::HashMap;
use std::collections::BTreeMap;
mod apigroup;
pub mod oneshot;
pub use apigroup::ApiGroup;
Expand All @@ -21,7 +21,6 @@ enum DiscoveryMode {
}

impl DiscoveryMode {
#[allow(clippy::ptr_arg)] // hashmap complains on &str here
fn is_queryable(&self, group: &String) -> bool {
match &self {
Self::Allow(allowed) => allowed.contains(group),
Expand Down Expand Up @@ -52,7 +51,7 @@ impl DiscoveryMode {
#[cfg_attr(docsrs, doc(cfg(feature = "client")))]
pub struct Discovery {
client: Client,
groups: HashMap<String, ApiGroup>,
groups: BTreeMap<String, ApiGroup>,
mode: DiscoveryMode,
}

Expand All @@ -63,7 +62,7 @@ impl Discovery {
/// Construct a caching api discovery client
#[must_use]
pub fn new(client: Client) -> Self {
let groups = HashMap::new();
let groups = BTreeMap::new();
let mode = DiscoveryMode::Block(vec![]);
Self { client, groups, mode }
}
Expand Down

0 comments on commit 3c2edaf

Please sign in to comment.