Skip to content

Commit

Permalink
Bump k8s-openapi to 0.23 for Kubernetes 1.31 support (#1581)
Browse files Browse the repository at this point in the history
* bump k8s-openapi pin and associated MK8SV

Signed-off-by: clux <[email protected]>

* option wrap change in upstream type

Signed-off-by: clux <[email protected]>

* client ext small fixes to one doc tests

- reorder imports
- client ext trait needs an explicit import despite being in prelude?
- unpacking of type as now required

Signed-off-by: clux <[email protected]>

* bump msrv according to cargo msrv check

Signed-off-by: clux <[email protected]>

---------

Signed-off-by: clux <[email protected]>
  • Loading branch information
clux authored Sep 16, 2024
1 parent 6118818 commit 2e4512e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/rust:1.75.0-bullseye
FROM docker.io/rust:1.77.2-bullseye

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
fail-fast: false
matrix:
# Run these tests against older clusters as well
k8s: [v1.25, v1.29]
k8s: [v1.26, v1.30]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:

- uses: nolar/setup-k3d-k3s@v1
with:
version: v1.25
version: v1.26
# k3d-kube
k3d-name: kube
# Used to avoid rate limits when fetching the releases from k3s repo.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
tool: [email protected]
- uses: nolar/setup-k3d-k3s@v1
with:
version: v1.25
version: v1.26
# k3d-kube
k3d-name: kube
# Used to avoid rate limits when fetching the releases from k3s repo.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repository = "https://github.com/kube-rs/kube"
readme = "README.md"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.75.0"
rust-version = "1.77.2"

[workspace.lints.rust]
unsafe_code = "forbid"
Expand Down Expand Up @@ -60,7 +60,7 @@ hyper-timeout = "0.5.1"
json-patch = "2.0.0"
jsonptr = "0.4.7"
jsonpath-rust = "0.5.0"
k8s-openapi = { version = "0.22.0", default-features = false }
k8s-openapi = { version = "0.23.0", default-features = false }
openssl = "0.10.36"
parking_lot = "0.12.0"
pem = "3.0.1"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# kube-rs

[![Crates.io](https://img.shields.io/crates/v/kube.svg)](https://crates.io/crates/kube)
[![Rust 1.75](https://img.shields.io/badge/MSRV-1.75-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/1.75.0)
[![Tested against Kubernetes v1_25 and above](https://img.shields.io/badge/MK8SV-v1_25-326ce5.svg)](https://kube.rs/kubernetes-version)
[![Rust 1.77](https://img.shields.io/badge/MSRV-1.77-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/1.77.2)
[![Tested against Kubernetes v1_26 and above](https://img.shields.io/badge/MK8SV-v1_26-326ce5.svg)](https://kube.rs/kubernetes-version)
[![Best Practices](https://bestpractices.coreinfrastructure.org/projects/5413/badge)](https://bestpractices.coreinfrastructure.org/projects/5413)
[![Discord chat](https://img.shields.io/discord/500028886025895936.svg?logo=discord&style=plastic)](https://discord.gg/tokio)

Expand Down
2 changes: 1 addition & 1 deletion e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ path = "boot.rs"

[features]
latest = ["k8s-openapi/latest"]
mk8sv = ["k8s-openapi/v1_25"]
mk8sv = ["k8s-openapi/v1_26"]
rustls = ["kube/rustls-tls"]
openssl = ["kube/openssl-tls"]

Expand Down
7 changes: 1 addition & 6 deletions kube-client/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ use std::fmt::Debug;
mod subresource;
#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub use subresource::{Attach, AttachParams, Execute, Portforward};
pub use subresource::{Attach, AttachParams, Ephemeral, Execute, Portforward};
pub use subresource::{Evict, EvictParams, Log, LogParams, ScaleSpec, ScaleStatus};

// Ephemeral containers were stabilized in Kubernetes 1.25.
k8s_openapi::k8s_if_ge_1_25! {
pub use subresource::Ephemeral;
}

mod util;

pub mod entry;
Expand Down
16 changes: 7 additions & 9 deletions kube-client/src/client/client_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ where
ObjectReference {
api_version: K::api_version(&dt).to_string().into(),
namespace: namespace.into(),
name: self.name.clone(),
name: Some(self.name.clone()),
kind: K::kind(&dt).to_string().into(),
..Default::default()
}
Expand Down Expand Up @@ -243,8 +243,7 @@ pub enum NamespaceError {
/// ## Example
///
/// ```no_run
/// # use k8s_openapi::api::core::v1::Pod;
/// # use k8s_openapi::api::core::v1::Service;
/// # use k8s_openapi::api::core::v1::{Pod, Service};
/// # use kube::client::scope::{Namespace, Cluster};
/// # use kube::prelude::*;
/// # use kube::api::ListParams;
Expand Down Expand Up @@ -295,11 +294,10 @@ impl Client {
///
/// ```no_run
/// # use k8s_openapi::api::rbac::v1::ClusterRole;
/// # use k8s_openapi::api::core::v1::Service;
/// # use k8s_openapi::api::core::v1::Secret;
/// # use k8s_openapi::api::core::v1::ObjectReference;
/// # use k8s_openapi::api::core::v1::LocalObjectReference;
/// # use k8s_openapi::api::core::v1::{Node, Pod};
/// # use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference;
/// # use k8s_openapi::api::core::v1::{ObjectReference, LocalObjectReference};
/// # use k8s_openapi::api::core::v1::{Node, Pod, Service, Secret};
/// # use kube::client::scope::NamespacedRef;
/// # use kube::api::GetParams;
/// # use kube::prelude::*;
/// # use kube::api::DynamicObject;
Expand Down Expand Up @@ -333,7 +331,7 @@ impl Client {
/// .image_pull_secrets
/// .unwrap_or_default()
/// .get(0)
/// .unwrap_or(&LocalObjectReference{name: Some("pull_secret".into())});
/// .unwrap_or(&LocalObjectReference{name: "pull_secret".into()});
/// let secret: Secret = client.fetch(&secret_ref.within(pod.namespace())).await?;
/// # Ok(())
/// # }
Expand Down

0 comments on commit 2e4512e

Please sign in to comment.