Skip to content

Commit 495f32b

Browse files
committed
sync 4.0
Signed-off-by: clux <sszynrae@gmail.com>
1 parent 5954af3 commit 495f32b

2 files changed

Lines changed: 122 additions & 8 deletions

File tree

docs/changelog.md

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,121 @@
77
<!-- next-header -->
88
UNRELEASED
99
===================
10-
* see https://github.com/kube-rs/kube/compare/3.1.0...main
10+
* see https://github.com/kube-rs/kube/compare/4.0.0...main
11+
12+
[4.0.0](https://github.com/kube-rs/kube/releases/tag/4.0.0) / 2026-06-16
13+
===================
14+
<!-- Release notes generated using configuration in .github/release.yml at 4.0.0 -->
15+
## New Major
16+
As per the release schedule to match up with the [latest Kubernetes ハル release](https://kubernetes.io/blog/2026/04/22/kubernetes-v1-36-release/).
17+
Lots of fixes and improvements. Thanks to everyone who contributed!
18+
19+
## Kubernetes `v1_36` support via k8s-openapi [0.28](https://github.com/Arnavion/k8s-openapi/releases/tag/v0.28.0)
20+
21+
Please [upgrade k8s-openapi along with kube](https://kube.rs/upgrading/) to avoid conflicts.
22+
23+
## CEL Validation
24+
A new optional crate [kube-cel](https://docs.rs/kube-cel/latest/kube_cel/) is being re-exported through `kube::core::cel` via https://github.com/kube-rs/kube/pull/1954
25+
26+
Kubernetes CRDs support [CEL validation rules](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#validation-rules) via `x-kubernetes-validations`, and were supported from 3.0 via [`KubeSchema`](https://docs.rs/kube/latest/kube/derive.KubeSchema.html), but these rules could only be evaluated server-side by the API server.
27+
28+
The new crate allows evaluating these rules locally using rules matching the [upstream Kubernetes CEL libraries](https://docs.rs/kube/latest/kube/core/cel/trait.KubeCelExt.html#upstream-sources).
29+
30+
While low-level, a higher-level CEL validator integrates with [`CustomResource`](https://docs.rs/kube/latest/kube/derive.CustomResource.html) via [`#[kube(cel)]`](https://docs.rs/kube/latest/kube/derive.CustomResource.html#cel-validation-client-side) from https://github.com/kube-rs/kube/pull/2011 and can be used as;
31+
32+
```rust
33+
#[derive(CustomResource, Serialize, Deserialize, Clone, KubeSchema)]
34+
#[kube(group = "example.com", version = "v1", kind = "Foo", namespaced)]
35+
#[kube(cel, validation = "self.spec.replicas >= 0")] // cel trigger + validation rule
36+
struct FooSpec { replicas: i32 }
37+
38+
let foo = Foo::new("test", FooSpec { replicas: -1 });
39+
foo.validate_cel()?; // new impl; checks creation rules
40+
new_foo.validate_cel_update(&old_foo)?; // new impl; checks transition rules
41+
```
42+
43+
See [examples/crd_derive_cel.rs](https://github.com/kube-rs/kube/blob/main/examples/crd_derive_cel.rs) for more details.
44+
45+
This is available under the `kube/cel` feature, courtesy of @doxxx93.
46+
47+
## Config
48+
A lot of improvements to config handling;
49+
50+
- better error handling of malformed client certs in https://github.com/kube-rs/kube/pull/1966
51+
- add missing `Kubeconfig` fields in https://github.com/kube-rs/kube/pull/1965
52+
- `Kubeconfig` future key compatibility for new fields by adding catch-all `other` key via https://github.com/kube-rs/kube/pull/1964
53+
- deserialization changed from `serde-yaml` to [`serde-saphyr`](https://github.com/bourumir-wyngs/serde-saphyr) to get rid of the long-deprecated dependency. https://github.com/kube-rs/kube/pull/1975
54+
55+
### Retry and Timeouts
56+
Better timeout and retry handling to better deal with flaky network conditions, and busy or initializing apiservers.
57+
58+
- default global read timeouts has been unset in favor of `watcher` level timeouts in https://github.com/kube-rs/kube/pull/1945 (see https://github.com/kube-rs/kube/issues/1798 for context)
59+
- regular (non-watch) queries now respect the [`RetryPolicy`](https://docs.rs/kube/latest/kube/client/retry/struct.RetryPolicy.html) - now enabled by default in https://github.com/kube-rs/kube/pull/2007.
60+
61+
### Client
62+
63+
- properly handling rotating ca certs in cluster via https://github.com/kube-rs/kube/pull/1962
64+
- handle `tls-server-name` with `openssl-tls` via https://github.com/kube-rs/kube/pull/1993
65+
- auth exec: accept `yaml` output from `exec` plugins via https://github.com/kube-rs/kube/pull/2003
66+
- fix `ws` task leak and `drop`, and a deadlock on `join()` via https://github.com/kube-rs/kube/pull/1978
67+
- **change**: client tracing now opt-in due to issues. see https://github.com/kube-rs/kube/pull/1972
68+
69+
### Runtime
70+
71+
- [`watcher`](https://docs.rs/kube/latest/kube/runtime/watcher/index.html) automatically uses the `metadata_` api methods when called with [`PartialObjectMeta<K>`](https://docs.rs/kube/latest/kube/core/metadata/struct.PartialObjectMeta.html) via https://github.com/kube-rs/kube/pull/1952
72+
* (this deprecates [`metadata_watcher`](https://docs.rs/kube/latest/kube/runtime/watcher/fn.metadata_watcher.html) in favor of an explicit change from `Api::<K>` to `Api::<PartialObjectMeta<K>>`)
73+
- added [`wait::conditions::is_created`](https://docs.rs/kube/latest/kube/runtime/wait/conditions/fn.is_deleted.html) as a counter to `is_deleted` https://github.com/kube-rs/kube/pull/2000
74+
- added [`Store::state_filtered`](https://docs.rs/kube/latest/kube/runtime/reflector/struct.Store.html#method.state_filter) and [`Store::state_filter_selector`](https://docs.rs/kube/latest/kube/runtime/reflector/struct.Store.html#method.state_filter_selector) to allow more efficient slicing of the locked cache via https://github.com/kube-rs/kube/pull/2002 + https://github.com/kube-rs/kube/pull/1998
75+
76+
77+
78+
79+
## What's Changed
80+
### Added
81+
* feat: add typed kubeconfig fields for client-go parity by @alex-lapuka in https://github.com/kube-rs/kube/pull/1965
82+
* Add CEL validation via kube-cel re-export by @doxxx93 in https://github.com/kube-rs/kube/pull/1954
83+
* Add `AdmissionRequest::to_cel_request()` for VAP CEL bridging by @doxxx93 in https://github.com/kube-rs/kube/pull/1991
84+
* runtime: implement `Store::state_with` and `Store::state_filtered` by @Alvov1 in https://github.com/kube-rs/kube/pull/1998
85+
* runtime: add `wait::conditions::is_created` helper by @orangecms in https://github.com/kube-rs/kube/pull/2000
86+
* refactor(runtime): rename Store::state_with/state_filtered per review feedback by @Alvov1 in https://github.com/kube-rs/kube/pull/2002
87+
* deps: bump kube-cel to 0.6.1 (validation surface flattened) by @doxxx93 in https://github.com/kube-rs/kube/pull/2005
88+
* Enable `RetryPolicy::server_retry` by default for `Client` by @Danil-Grigorev in https://github.com/kube-rs/kube/pull/2007
89+
* feat(derive): client-side CEL validation via #[kube(cel)] / #[x_kube(cel)] by @doxxx93 in https://github.com/kube-rs/kube/pull/2011
90+
### Changed
91+
* preserve unknown kubeconfig fields via serde(flatten) by @alex-lapuka in https://github.com/kube-rs/kube/pull/1964
92+
* Remove global read_timeout default, add watcher-level idle timeout by @doxxx93 in https://github.com/kube-rs/kube/pull/1945
93+
* Update tokio-tungstenite requirement from 0.28.0 to 0.29.0 by @dependabot[bot] in https://github.com/kube-rs/kube/pull/1963
94+
* convert from serde-yaml to serde-saphyr by @clux in https://github.com/kube-rs/kube/pull/1975
95+
* features: making client tracing opt-in by @mattklein123 in https://github.com/kube-rs/kube/pull/1972
96+
* client: reload in-cluster CA bundle on rotation (rustls-tls) by @chrnorm in https://github.com/kube-rs/kube/pull/1962
97+
* Api<PartialObjectMeta<K>> should opportunistically degrade to metadata requests by @doxxx93 in https://github.com/kube-rs/kube/pull/1952
98+
* Chore(deps): Update garde requirement from 0.22.0 to 0.23.0 by @dependabot[bot] in https://github.com/kube-rs/kube/pull/1989
99+
* bump k8s-openapi to 0.28 by @clux in https://github.com/kube-rs/kube/pull/2009
100+
* Box a large runtime error in ReconcilerErr by @clux in https://github.com/kube-rs/kube/pull/1880
101+
### Fixed
102+
* fix: feature-flag CREATE_NO_WINDOW to not break stderr inheritance by @cristeigabriela in https://github.com/kube-rs/kube/pull/1971
103+
* Remove silent error when client-key/client-certificate is malformed by @goenning in https://github.com/kube-rs/kube/pull/1966
104+
* Fix AttachedProcess task leak on drop and join() deadlock by @SebTardif in https://github.com/kube-rs/kube/pull/1978
105+
* support auth exec yaml output by @aviramha in https://github.com/kube-rs/kube/pull/2003
106+
* fix(client): apply tls-server-name on the openssl-tls path by @dgunzy in https://github.com/kube-rs/kube/pull/1993
107+
* Use the resource's own name for the schema title by @cehoffman in https://github.com/kube-rs/kube/pull/1985
108+
109+
110+
* @alex-lapuka made their first contribution in https://github.com/kube-rs/kube/pull/1965
111+
* @cristeigabriela made their first contribution in https://github.com/kube-rs/kube/pull/1971
112+
* @mattklein123 made their first contribution in https://github.com/kube-rs/kube/pull/1972
113+
* @chrnorm made their first contribution in https://github.com/kube-rs/kube/pull/1962
114+
* @SebTardif made their first contribution in https://github.com/kube-rs/kube/pull/1978
115+
* @Alvov1 made their first contribution in https://github.com/kube-rs/kube/pull/1998
116+
* @orangecms made their first contribution in https://github.com/kube-rs/kube/pull/2000
117+
* @dgunzy made their first contribution in https://github.com/kube-rs/kube/pull/1993
118+
* @cehoffman made their first contribution in https://github.com/kube-rs/kube/pull/1985
119+
120+
**Full Changelog**: https://github.com/kube-rs/kube/compare/3.1.0...4.0.0
121+
122+
4.0.0 / 2026-06-16
123+
===================
124+
* see https://github.com/kube-rs/kube/compare/4.0.0...main
11125

12126
[3.1.0](https://github.com/kube-rs/kube/releases/tag/3.1.0) / 2026-03-17
13127
===================
@@ -39,7 +153,7 @@ Maintenance release with fixes for schemas/validation, client exec blocking and
39153

40154
3.1.0 / 2026-03-17
41155
===================
42-
* see https://github.com/kube-rs/kube/compare/3.1.0...main
156+
* see https://github.com/kube-rs/kube/compare/4.0.0...main
43157

44158
[3.0.1](https://github.com/kube-rs/kube/releases/tag/3.0.1) / 2026-01-30
45159
===================

docs/getting-started.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![Crates.io](https://img.shields.io/crates/v/kube.svg)](https://crates.io/crates/kube)
55
[![Rust 1.88](https://img.shields.io/badge/MSRV-1.88-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/1.88.0)
6-
[![Tested against Kubernetes v1.31 and above](https://img.shields.io/badge/MK8SV-v1.31-326ce5.svg)](https://kube.rs/kubernetes-version)
6+
[![Tested against Kubernetes v1.32 and above](https://img.shields.io/badge/MK8SV-v1.32-326ce5.svg)](https://kube.rs/kubernetes-version)
77
[![Best Practices](https://bestpractices.coreinfrastructure.org/projects/5413/badge)](https://bestpractices.coreinfrastructure.org/projects/5413)
88
[![Discord chat](https://img.shields.io/discord/500028886025895936.svg?logo=discord&style=plastic)](https://discord.gg/tokio)
99

@@ -17,8 +17,8 @@ Select a version of `kube` along matching versions of [k8s-openapi](https://gith
1717

1818
```toml
1919
[dependencies]
20-
kube = { version = "3.1.0", features = ["runtime", "derive"] }
21-
k8s-openapi = { version = "0.27.0", features = ["latest", "schemars"] }
20+
kube = { version = "4.0.0", features = ["runtime", "derive"] }
21+
k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] }
2222
schemars = { version = "1" }
2323
```
2424

@@ -87,7 +87,7 @@ Then you can use the generated wrapper struct `Document` as a [`kube::Resource`]
8787
let docs: Api<Document> = Api::default_namespaced(client);
8888
let d = Document::new("guide", DocumentSpec::default());
8989
println!("doc: {:?}", d);
90-
println!("crd: {:?}", serde_yaml::to_string(&Document::crd()));
90+
println!("crd: {:?}", serde_saphyr::to_string(&Document::crd()));
9191
```
9292

9393
There are a ton of kubebuilder-like instructions that you can annotate with here. See the [documentation](https://docs.rs/kube/latest/kube/derive.CustomResource.html) or the `crd_` prefixed [examples](https://github.com/kube-rs/kube/blob/main/examples) for more.
@@ -159,13 +159,13 @@ Uses [rustls](https://github.com/rustls/rustls) with `ring` provider (default) o
159159
To switch [rustls providers](https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html), turn off `default-features` and enable the `aws-lc-rs` feature:
160160

161161
```toml
162-
kube = { version = "3.1.0", default-features = false, features = ["client", "rustls-tls", "aws-lc-rs"] }
162+
kube = { version = "4.0.0", default-features = false, features = ["client", "rustls-tls", "aws-lc-rs"] }
163163
```
164164

165165
To switch to `openssl`, turn off `default-features`, and enable the `openssl-tls` feature:
166166

167167
```toml
168-
kube = { version = "3.1.0", default-features = false, features = ["client", "openssl-tls"] }
168+
kube = { version = "4.0.0", default-features = false, features = ["client", "openssl-tls"] }
169169
```
170170

171171
This will pull in `openssl` and `hyper-openssl`. If `default-features` is left enabled, you will pull in two TLS stacks, and the default will remain as `rustls`.

0 commit comments

Comments
 (0)