### Example usage of k8s_if_1_33 Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_33.html Shows how to conditionally import a module when the v1_33 feature is enabled. ```rust k8s_if_1_33! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### k8s_if_1_32 macro usage example Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_32.html?search= Example usage of the k8s_if_1_32 macro. The macro evaluates to its contents if the v1_32 feature is enabled, otherwise it evaluates to nothing. ```rust k8s_if_1_32! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### Example usage of k8s_if_1_36 Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_36.html Conditionally imports the core v1 API module when the v1_36 feature is enabled. If the feature is disabled, the macro expands to nothing. ```rust k8s_if_1_36! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### k8s_if_1_36 macro definition and usage Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_36.html?search=u32+-%3E+bool The macro definition and its usage example. The macro evaluates to its contents only when the v1_36 feature is enabled; otherwise it evaluates to nothing. ```rust macro_rules! k8s_if_1_36 { ($($tt:tt)*) => { ... }; } ``` ```rust k8s_if_1_36! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### Example usage of k8s_if_1_35 Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_35.html Conditionally imports the core v1 API module when the v1_35 feature is enabled. The macro expands to the use statement only if the feature is active. ```rust k8s_if_1_35! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### Example struct for DeepMerge Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/trait.DeepMerge.html?search=std%3A%3Avec An example struct `S` with fields `a` and `b` used to illustrate how to implement `DeepMerge` for a struct. ```rust struct S { a: i32, b: String, } ``` -------------------------------- ### Function `version` Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/fn.version.html Documentation for the `version` function in the `k8s_openapi` crate. ```APIDOC ## Function `version` ### Description Extracts the version of the given resource value. This just returns the `Resource::VERSION` value for the argument’s type, but is useful when you already have a value and don’t want to explicitly write its type. ### Signature ```rust pub fn version(_: &T) -> &'static str where T: Resource, ``` ### Parameters - **`_: &T`** - A reference to a value of type `T` that implements the `Resource` trait. The value is not used; only its type matters. ### Return Value - **`&'static str`** - The version string associated with the resource type, i.e., `Resource::VERSION`. ``` -------------------------------- ### Example DeepMerge implementation for struct Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/trait.DeepMerge.html?search=std%3A%3Avec The expected implementation of `DeepMerge` for the example struct `S`, merging each field individually. This pattern is recommended for custom types. ```rust impl DeepMerge for S { fn merge_from(&mut self, other: Self) { self.a.merge_from(other.a); self.b.merge_from(other.b); } } ``` -------------------------------- ### Cargo.toml for library crates Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/index.html?search= Shows how to declare k8s-openapi as a dependency and dev-dependency in a library crate, enabling a version feature only for the dev-dependency. ```toml # For library crates [dependencies] k8s-openapi = "..." [dev-dependencies] k8s-openapi = { version = "...", features = ["v1_50"] } ``` -------------------------------- ### Cargo.toml for application crates Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/index.html?search= Shows how to enable a Kubernetes version feature (v1_50) in an application crate's dependencies. Only one v1_* feature can be enabled at a time. ```toml # For application crates [dependencies] k8s-openapi = { version = "...", features = ["v1_50"] } ``` -------------------------------- ### k8s_if_1_32 macro definition and usage example Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_32.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The macro definition shows the signature of k8s_if_1_32, which expands to its contents when the v1_32 feature is enabled and to nothing otherwise. The example demonstrates using the macro to conditionally import the core v1 API module. ```rust macro_rules! k8s_if_1_32 { ($($tt:tt)*) => { ... }; } ``` ```rust k8s_if_1_32! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### Create and pretty-print a PodSpec Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/index.html?search= Creates a default instance of api::core::v1::PodSpec and prints it with the {:#?} debug formatter. Requires the v1_36 feature to be enabled. ```rust use k8s_openapi::api::core::v1 as api; fn main() { let pod_spec: api::PodSpec = Default::default(); println!("{pod_spec:#?}"); } ``` -------------------------------- ### version Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/fn.version.html?search= Documentation for the `version` function in the k8s-openapi crate, which extracts the version of a Kubernetes resource value. ```APIDOC ## Function `version` ### Description Extracts the version of the given resource value. This just returns the `Resource::VERSION` value for the argument's type, but is useful when you already have a value and don't want to explicitly write its type. ### Signature ```rust pub fn version(_: &T) -> &'static str where T: Resource, ``` ### Parameters - `_: &T` - The resource value whose version is to be extracted. The type `T` must implement the `Resource` trait. ### Return Value - `&'static str` - The version string associated with the resource type, equivalent to `Resource::VERSION`. ``` -------------------------------- ### JSON wire format example Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/apimachinery/pkg/runtime/struct.RawExtension.html?search= Shows the JSON serialized on the wire for a RawExtension field, including kind and apiVersion. ```json { "kind":"MyAPIObject", "apiVersion":"v1", "myPlugin": { "kind":"PluginA", "aOption":"foo", }, } ``` -------------------------------- ### Struct DeploymentStrategy Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/api/apps/v1/struct.DeploymentStrategy.html?search=std%3A%3Avec DeploymentStrategy describes how to replace existing pods with new ones. This struct is part of the k8s-openapi crate and can be instantiated directly by users. ```APIDOC ## Struct DeploymentStrategy ### Description DeploymentStrategy describes how to replace existing pods with new ones. ### Fields - **rolling_update** (`Option`) - Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate. - **type_** (`Option`) - Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. ### Trait Implementations - `Clone` - Provides methods to duplicate the value. - `Debug` - Formats the value using the given formatter. - `DeepMerge` - Merges another `DeploymentStrategy` into `self`. - `Default` - Returns the default value for the type. - `Deserialize` - Deserializes this value from a Serde deserializer. - `PartialEq` - Provides equality comparison operators. - `Serialize` - Serializes this value into a Serde serializer. - `StructuralPartialEq` - Marker trait for structural equality. ``` -------------------------------- ### DeploymentSpec struct Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/api/apps/v1/struct.DeploymentSpec.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Defines the DeploymentSpec struct with its fields and descriptions, as documented in the k8s-openapi crate. ```APIDOC ## DeploymentSpec Struct ### Description DeploymentSpec is the specification of the desired behavior of the Deployment. ### Syntax ```rust pub struct DeploymentSpec { pub min_ready_seconds: Option, pub paused: Option, pub progress_deadline_seconds: Option, pub replicas: Option, pub revision_history_limit: Option, pub selector: LabelSelector, pub strategy: Option, pub template: PodTemplateSpec, } ``` ### Fields #### `min_ready_seconds: Option` Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0. #### `paused: Option` Indicates that the deployment is paused. #### `progress_deadline_seconds: Option` Maximum time in seconds for a deployment to make progress before being considered failed. Defaults to 600s. #### `replicas: Option` Number of desired pods. Distinguishes between explicit zero and not specified. Defaults to 1. #### `revision_history_limit: Option` Number of old ReplicaSets to retain to allow rollback. Defaults to 10. #### `selector: LabelSelector` Label selector for pods. Existing ReplicaSets whose pods are selected by this will be affected by this deployment. #### `strategy: Option` Deployment strategy to use to replace existing pods with new ones. #### `template: PodTemplateSpec` Template describes the pods that will be created. The only allowed `template.spec.restartPolicy` value is "Always". ``` -------------------------------- ### Info struct definition Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/apimachinery/pkg/version/struct.Info.html Defines the Info struct with fields for build date, compiler, emulation versions, git metadata, Go version, major/minor versions, and platform. Optional fields represent emulation and minimum compatibility versions. ```rust pub struct Info {Show 13 fields pub build_date: String, pub compiler: String, pub emulation_major: Option, pub emulation_minor: Option, pub git_commit: String, pub git_tree_state: String, pub git_version: String, pub go_version: String, pub major: String, pub min_compatibility_major: Option, pub min_compatibility_minor: Option, pub minor: String, pub platform: String, } ``` -------------------------------- ### k8s_if_1_34 macro definition and usage Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/macro.k8s_if_1_34.html The macro definition and an example usage. The macro evaluates to its contents when the v1_34 feature is enabled, otherwise it evaluates to nothing. ```rust macro_rules! k8s_if_1_34 { ($($tt:tt)*) => { ... }; } ``` ```rust k8s_if_1_34! { use k8s_openapi::api::core::v1 as api; } ``` -------------------------------- ### ContainerStateRunning struct definition Source: https://docs.rs/k8s-openapi/latest/k8s_openapi/api/core/v1/struct.ContainerStateRunning.html?search= Defines the ContainerStateRunning struct with a single optional field started_at of type Option