-
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add a versioned CustomResourceExt trait - fixes #497 * less import lines * simplify cargo release flags via crate-ci/cargo-release#253 * new clippy lint
- Loading branch information
Showing
24 changed files
with
100 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! Traits and tyes for CustomResources | ||
use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions as apiexts; | ||
|
||
/// Types for v1 CustomResourceDefinitions | ||
pub mod v1 { | ||
/// Extension trait that will be implemented by kube-derive | ||
/// | ||
/// This trait variant is implemented by default (or when `#[kube(apiextensions = "v1")]`) | ||
pub trait CustomResourceExt { | ||
/// Helper to generate the CRD including the JsonSchema | ||
/// | ||
/// This is using the stable v1::CustomResourceDefinitions (present in kubernetes >= 1.16) | ||
fn crd() -> super::apiexts::v1::CustomResourceDefinition; | ||
/// Helper to generate the api information type for use with the dynamic `Api` | ||
fn api_resource() -> crate::discovery::ApiResource; | ||
} | ||
} | ||
|
||
/// Types for legacy v1beta1 CustomResourceDefinitions | ||
pub mod v1beta1 { | ||
/// Extension trait that will be implemented by kube-derive for legacy v1beta1::CustomResourceDefinitions | ||
/// | ||
/// This trait variant is only implemented with `#[kube(apiextensions = "v1beta1")]` | ||
pub trait CustomResourceExt { | ||
/// Helper to generate the legacy CRD without a JsonSchema | ||
/// | ||
/// This is using v1beta1::CustomResourceDefinitions (which will be removed in kubernetes 1.22) | ||
fn crd() -> super::apiexts::v1beta1::CustomResourceDefinition; | ||
/// Helper to generate the api information type for use with the dynamic `Api` | ||
fn api_resource() -> crate::discovery::ApiResource; | ||
} | ||
} | ||
|
||
/// re-export the current latest version until a newer one is available in cloud providers | ||
pub use v1::CustomResourceExt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.