Skip to content

Commit

Permalink
remove leftover TODO + improve doc links between discovery and core
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Dec 22, 2021
1 parent c6781c2 commit 597b273
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions kube-client/src/discovery/apigroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,11 @@ impl ApiGroup {

/// Returns served versions (e.g. `["v1", "v2beta1"]`) of this group.
///
/// This list is always non-empty, and sorted in the following order:
/// This iterator is never empty, and returns elements in descending order of [`Version`](kube_core::Version):
/// - Stable versions (with the last being the first)
/// - Beta versions (with the last being the first)
/// - Alpha versions (with the last being the first)
/// - Other versions, alphabetically
///
/// in accordance with [kubernetes version priority](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#version-priority).
/// For more information, see [`Version`](kube_core::Version)
pub fn versions(&self) -> impl Iterator<Item = &str> {
self.data.as_slice().iter().map(|gvd| gvd.version.as_str())
}
Expand All @@ -196,8 +193,9 @@ impl ApiGroup {

/// Returns the preferred version or latest version for working with given group.
///
/// If server does not recommend one, we pick the "most stable and most recent" version
/// in accordance with [kubernetes version priority](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#version-priority).
/// If server does not recommend a version, we pick the "most stable and most recent" version
/// in accordance with [kubernetes version priority](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#version-priority)
/// via the descending sort order from [`Version`](kube_core::Version).
pub fn preferred_version_or_latest(&self) -> &str {
// NB: self.versions is non-empty by construction in ApiGroup
self.preferred
Expand Down
4 changes: 1 addition & 3 deletions kube-core/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{cmp::Reverse, convert::Infallible, str::FromStr};
///
/// ```
/// use kube_core::Version;
/// use std::cmp::Reverse;
/// use std::cmp::Reverse; // for DESCENDING sort
/// let mut versions = vec![
/// "v10beta3",
/// "v2",
Expand Down Expand Up @@ -46,8 +46,6 @@ use std::{cmp::Reverse, convert::Infallible, str::FromStr};
/// assert!(Version::Stable(1) > Version::Alpha(2, Some(2)));
/// assert!(Version::Beta(1, None) > Version::Nonconformant("ver3".into()));
/// ```
///
/// TODO: change Ord to reflect this
#[derive(PartialEq, Eq, Debug, Clone)]
pub enum Version {
/// A major/GA release
Expand Down

0 comments on commit 597b273

Please sign in to comment.