Releases: kube-rs/kube
3.1.0
What's Changed
Maintenance release with fixes for schemas/validation, client exec blocking and proxy handling, as well as some smaller new features listed below. Internal changes and documentation improvements listed in the milestone.
Added
- allow empty body in const context by @tottoto in #1927
- Add typed printcolumn argument to derive macro by @cchndl in #1872
- kube-core: add optionalOldSelf to CEL
Ruleby @Immortal-Beyond-Oblivion in #1947 - Re-add support for basic auth in Proxy by @goenning in #1959
Fixed
- Fix OptionalEnum transform for complex enums by @doxxx93 in #1934
- Bump tower-http dependency to 0.6.4 by @abustany in #1939
- Add minimal-versions CI check by @doxxx93 in #1940
- fix: Produce valid CRDs containing flattened untagged enums by @NickLarsenNZ in #1942
- kube-client: Avoid blocking tokio worker during exec auth token refresh by @blakelawson in #1950
New Contributors
- @abustany made their first contribution in #1939
- @cchndl made their first contribution in #1872
- @Immortal-Beyond-Oblivion made their first contribution in #1947
- @gauravgahlot made their first contribution in #1949
- @blakelawson made their first contribution in #1950
Full Changelog: 3.0.1...3.1.0
3.0.1
What's Changed
Bugfix release for schemas, admission, and docs. Minor internal improvements listed in the milestone. Important fixes below.
Fixed
- Update API version of
AdmissionResponsecreated via invalid call by @Magicloud in #1905 - Fix
OptionalEnumtransform skipping schemas with description by @doxxx93 in #1908 - Remove conflicting
additionalProperties: falsefrom schema by @doxxx93 in #1920
New Contributors
- @phenomenes made their first contribution in #1900
- @Magicloud made their first contribution in #1905
Full Changelog: 3.0.0...3.0.1
3.0.0
New Major
As per the new release schedule to match up with the new Kubernetes release.
Lots of additions, fixes and improvements. Thanks to everyone who contributed so heavily over the holidays! Happy new year.
Breaking Changes
Kubernetes v1_35 support via k8s-openapi 0.27
Please upgrade k8s-openapi along with kube to avoid conflicts.
jiff replaces chrono
Matching k8s-openapi's change, kube has also swapped out chrono. The biggest impact of this is for interacting with timestamps in metadata, but it also updates 2 smaller public interfaces in LogParams, Client::with_valid_until. See controller-rs#217 for an example change.
ErrorResponse has been replaced with Status
ErrorResponse served as a partial metav1/Status replacement which ended up hiding error information to users. These structs have merged, more information is available on errors, and a type alias with a deprecation warning is in place for ErrorResponse which will be removed in a later version.
This creates a small breaking change for users matching on specific Error::Api codes;
.map_err(|error| match error {
- kube::Error::Api(kube::error::ErrorResponse { code: 403, .. }) => {
- Error::UnauthorizedToPatch(obj)
- }
+ kube::Error::Api(s) if s.is_forbidden() => Error::UnauthorizedToPatch(obj),
other => Error::Other(other),
})?;Predicates now has a TTL Cache
This prevents unbounded memory for controllers, particularly affecting ones watching quickly rotating objects with generated names (e.g. pods). By default the TTL is 1h. It can be configured via new PredicateConfig parameter. To use the default;
- .predicate_filter(predicates::resource_version);
+ .predicate_filter(predicates::resource_version, Default::default());Change in #1836. This helped expose and fix a bug in watches with streaming_lists now fixed in #1882.
Subresource Api
Some subresource write methods were public with inconsistent signatures that required less ergonomic use than any other write methods. They took a Vec<u8> for the post body, now they take a &K: Serialize or the actual subresource.
There affect Api::create_subresource, Api::replace_subresource, Api::replace_status, Api::replace_scale. In essence this generally means you do not have to wrap raw objects in json! and serde_json::to_vec for these calls and lean more on rust's typed objects rather than json! blobs which has some footguns for subresources.
- let o = foos.replace_status("qux", &pp, serde_json::to_vec(&object)?).await?;
+ let o = foos.replace_status("qux", &pp, &object).await?;See some more shifts in examples in the implementaion; #1884
Improvements
Support Kubernetes 1.30 Aggregated Discovery
Speeds up api discovery significantly by using the newer api with much less round-tripping.
To opt-in change Discovery::run() to Discovery::run_aggregated()
Changes; #1876 + #1873 + #1889
New Client RetryPolicy opt-in
Allows custom clients (for now) to enable exponential backoff'd retries for retryable errors by exposing a tower::retry::Policy for a tower::retry::Layer. See the new custom_client_retry example for details.
Enabled by a clonable body + the new RetryPolicy based on mirrord's solution*.
Rust 2024
While this is mostly for internal ergonomics, we would like to highlight this also simplifies the Condition implementors which had to deal with a lot of options;
pub fn is_job_completed() -> impl Condition<Job> {
|obj: Option<&Job>| {
- if let Some(job) = &obj {
- if let Some(s) = &job.status {
- if let Some(conds) = &s.conditions {
- if let Some(pcond) = conds.iter().find(|c| c.type_ == "Complete") {
- return pcond.status == "True";
- }
- }
- }
+ if let Some(job) = &obj
+ && let Some(s) = &job.status
+ && let Some(conds) = &s.conditions
+ && let Some(pcond) = conds.iter().find(|c| c.type_ == "Complete")
+ {
+ return pcond.status == "True";Fixes
- streaming list bug fix - #1882
- watcher jitter bug fix - #1897
- schema fix for IntOrString - #1867
- schema fix for optional enums - #1853
- websocket keepalives for long running attaches - #1889
More
Resizesubresource impl forPod- #1851- add
#[kube(attr="...")to allow custom attrs on derives - #1850 - example updates for admission w/axum - #1859
What's Changed
Added
- Add
Resizesubresource forPodby @hugoponthieu in #1851 - feat: add #[kube(attr="...")] attribute helper to set attribute helper on the CR root type by @ngergs in #1850
- Rust 2024 let-chains to simplify wait Conditions by @clux in #1792
- Adds a
try_clonemethod forkube_client::client::Bodywhen it'sKind::Onceby @meowjesty in #1867 - Implement client aggregated discovery API methods by @doxxx93 in #1873
- Implement aggregated discovery API methods by @doxxx93 in #1876
- Permit older version of API for v2 discovery for k8s < 1.30 (down to 1.27) by @Danil-Grigorev in #1889
- Add RetryPolicy for client-level request retries by @doxxx93 in #1894
Changed
- Update tokio-tungstenite requirement from 0.27.0 to 0.28.0 by @dependabot[bot] in #1829
- Predicates: add configurable cache TTL for
predicate_filterby @doxxx93 in #1838 - Update darling requirement from 0.21.0 to 0.23.0 by @dependabot[bot] in #1861
- update to jsonpath-rust 1 by @tottoto in #1863
- Replace
chronowithjiffby @ngergs in #1868 - Merge ErrorResponse and Status by @imp in #1875
- Make subresource methods more ergonomic by @doxxx93 in #1884
- Drop k8s v1.30, crono->jiff replacement for runtime & examples by @ngergs in #1870
- Add a metadata field to Status by @ryanpbrewster in #1891
- Bump
k8s-openapifor Kubernetes 1.35 by @clux in #1898
Fixed
- fix: add use<> to kubelet_node_logs for rust edition 2024 by @co42 in #1849
- Transform optional enums to match pre kube 2.0.0 format by @Danil-Grigorev in #1853
- Distinguish between initial and resumed watch phases for streaming lists by @doxxx93 in #1882
- Re-export deprecated type alias and improve deprecation guidance by @clux in #1883
- Add nullable to optional fields with x-kubernetes-int-or-string by @doxxx93 in #1885
- send websocket ping to keep idle connections alive by @inqode-l...
2.0.1
2.0.0
Kubernetes v1_34 support via k8s-openapi 0.26
Please upgrade k8s-openapi along with kube to avoid conflicts.
Schemars 1.0
A fairly significant upgrade in #1780. Our external facing API should be unchanged, although some schemars public import paths have changed. Note that if you are implementing schemars traits directly, then see the upstream schemars/migrating (and maybe consider using KubeSchema for relevant schema overrides).
Please upgrade schemars along with kube for this version to avoid conflicts.
New Minimums
Minimum versions: MSRV 1.85.0 (for edition 2024), MK8SV: 1.30 (unchanged).
Highlights
This version is contains fixes, dependency clearups, and dependency updates. Noteworthy additions are TryFrom impls for Kubeconfig users in #1801, and a namespace accessor in Api in #1788
New Major
A new semver major for unstable, public facing dependency updates. As per the new release cycle, it is aligned with the Kubernetes release.
What's Changed
Added
- Add
TryFromconversions forKubeconfig->Config->Clientby @Danil-Grigorev in #1801 - Add pub fn namespace(&self) -> Option<&str> to Api by @tgrushka in #1788
Changed
- Update to schemars 1.0 by @Danil-Grigorev in #1780
- Bump Rust Edition to 2024 and MSRV to 1.85 by @clux in #1785
- Replace
hyper-socks2withhyper-utilclient-proxy feature by @tottoto in #1795 - Bump k8s-openapi to 0.26.0 by @clux in #1817
Fixed
- Clamp scheduling delay to 6 months by @dervoeti in #1779
- Update admission example and pin to a local crd by @clux in #1782
- Fix interactive auth mode to allow prompt messages by @gememma in #1800
- Make kube::runtime::controller::Action ctors const by @imp in #1804
- Fix oidc with openssl by @saif-88 in #1807
New Contributors
- @dervoeti made their first contribution in #1779
- @tgrushka made their first contribution in #1788
- @gememma made their first contribution in #1800
- @saif-88 made their first contribution in #1807
Full Changelog: 1.1.0...2.0.0
1.1.0
What's Changed
Missing attribute bugfix + extra standard derives on core::conversion structs.
Added
- Add missing derives on conversion types by @sbernauer in #1759
Fixed
Full Changelog: 1.0.0...1.1.0
1.0.0
A Major Version
It's been a long time coming, but time has come to draw the line in the sand. No alphas, no betas. Hope it finds you all well. Thanks to everyone who has contributed over the years.
This is a somewhat symbolic gesture, because semver-breaking changes are still hard to avoid with a large set of sub-1.0 dependencies we need to bump, as well as managing the large api surface of Kubernetes.
Therefore, the plan is to align our breaking changes and major bumps with Kubernetes versions / k8s-openapi versions for now, and this should allow our other releases to stream in. See #1688 for more information.
Kubernetes v1_33 support via k8s-openapi 0.25
Please upgrade k8s-openapi along with kube to avoid conflicts.
New minimum versions: MSRV 1.82.0, MK8SV: 1.30*
KubeSchema
The CELSchema alternate derive for JsonSchema has been renamed to KubeSchema to indicate the increased functionality.
In addition to being able to inject CEL rules for validations, it can now also inject x-kubernetes properties such as merge-strategy via #1750, handle #[validate] attributes #1749, and pass validation rules as string literals #1754 :
#[derive(CustomResource, Serialize, Deserialize, Debug, PartialEq, Clone, KubeSchema)]
#[kube(...properties)
struct DocumentSpec {
/// New merge strategy support
#[x_kube(merge_strategy = ListMerge::Set)]
x_kubernetes_set: Vec<String>,
/// CEL Validation now lives on x_kube and supports literal Rules:
#[x_kube(validation = "!has(self.variantOne) || self.variantOne.int > 22")]
complex_enum: ComplexEnum,
}See kube.rs docs on validation for more info. Huge thanks to @Danil-Grigorev.
What's Changed
Added
- feat(deps): enable
hyper-util/tracingfeature flag by @cratelyn in #1734 - Permit literal string validation for CEL expressions by @Danil-Grigorev in #1754
Changed
- Support additional
x-kubernetes-*schema extensions by @Danil-Grigorev in #1750 - Bump
k8s-openapito0.25.0by @clux in #1756
Removed
Fixed
- docs: Adjust #[kube(scale(...)] doc example by @Techassi in #1733
- Add suffix to generated struct by
CELSchemaby @Danil-Grigorev in #1747 - Allow schemars validate attribute in
CELSchemaby @Danil-Grigorev in #1749 - fix: resolve conflict with schemars preserve_order feature by @HoKim98 in #1758
New Contributors
- @cratelyn made their first contribution in #1734
- @JanBerktold made their first contribution in #1752
Full Changelog: 0.99.0...1.0.0
0.99.0
Highlights
Dependency Cleanups
backoff(unmaintained) replaced withbackonin #1653- No change if you are using
default_backoffnatively, or throughController. - Parameters configurable via
ExponentialBackofffrombackon::ExponentialBuilderintoWatchStreamExt::backoff
- No change if you are using
json-patchbumped and uses re-exportedjsonptrfor less version clashes #1718randdependency no longer explicit as only rng is underwsfeature viatungstenite'sclient::generate_key#1691ring(still maintained) now optional forrustls-tlsfeature (for alternateaws-lc-rs) #1717
Features
- Support for the
v5.channel.k8s.iostreamingwsprotocol to allow closing streams properly (kubernetes.io blog) #1693 CustomResourcederive; typed attributes for#[kube(scale)]and#[kube(deprecated)]in #1656 + #1697Client::with_valid_untilto handle short lived local client certs #1707- New common
conditionsthat can be awaited #1710
What's Changed
Added
- Add typed scale argument to derive macro by @Techassi in #1656
- Add deprecated argument to derive macro by @Techassi in #1697
- Add
Api::get_metadata_opt_withby @sebsoto in #1708 - Add common wait conditions for Deployments, LoadBalancer Services, and Ingress by @detjensrobert in #1710
- Add
Client::with_valid_untilfor client cert expiry by @goenning in #1707 - kube-runtime: make
ExponentialBackoffpublic by @gdeleon2 in #1716
Changed
- Replace
backoffwithbackonby @flavio in #1653 - Bump
randto 0.9 by @clux in #1686 - Remove
randdependency in favor oftungstenitefn by @clux in #1691 - Exec can return stdout data even after stdin is closed. by @esw-amzn in #1693
- Bump
json-patchto 4 use bundledjsonptrto 0.7 by @clux in #1718 - Allow removing hyper-rustls/ring feature by @eliad-wiz in #1717
Fixed
- kube-runtime: fix exponential backoff max times by @eliad-wiz in #1713
CustomResourcederive; allowstatusattribute to take a path by @clux in #1704
New Contributors
- @esw-amzn made their first contribution in #1693
- @sebsoto made their first contribution in #1708
- @zhanluxianshen made their first contribution in #1709
- @detjensrobert made their first contribution in #1710
- @gdeleon2 made their first contribution in #1716
Full Changelog: 0.98.0...0.99.0
0.98.0
Highlights
- Kubernetes
v1_32support viak8s-openapi0.24- Please upgrade k8s-openapi along with kube to avoid conflicts.
- New minimum versions: MSRV 1.81.0, MK8SV: 1.28
kube-deriveadditions:- A
CELSchemaderive macro wrapper aroundJsonSchemafor injecting cel validations into the schema #1649 - Allow overriding
servedandstoragebooleans for multiple versions ofCustomResourcederives: #1644
- A
kube-runtimeeventRecordernow aggregates repeat events #1655 (some breaking changes, see controller-rs#116)kube-clientUTF-16 edge case handling for windows #1654
What's Changed
Added
- Add
storageandservedargument to derive macro by @Techassi in #1644 - Implement
derive(CELSchema)macro for generating cel validation on CRDs by @Danil-Grigorev in #1649
Changed
- Add series implementation for
runtimeevent recorder by @pando85 in #1655 - Bump
k8s-openapifor Kubernetesv1_32support and MSRV by @clux in #1671 - Update tokio-tungstenite requirement from 0.24.0 to 0.25.0 by @dependabot in #1666
Fixed
New Contributors
- @Techassi made their first contribution in #1644
- @mgs255 made their first contribution in #1647
- @pando85 made their first contribution in #1655
Full Changelog: 0.97.0...0.98.0
0.97.0
Highlights
CustomResourcederive added features for crd yaml output:- Configuration edge cases:
- Feature use:
- Depedency minors:
thiserror,hashbrown,jsonptr,json-patch. Killedlazy_static/once_cell
What's Changed
Added
- Feature: Allow to pass selectableFields for CRD definition by @Danil-Grigorev in #1605
- add support for CRD annotations and labels in kube-derive by @verokarhu in #1631
- Feature: Add config setting to disable gzip compression #1627 by @markdingram in #1628
Changed
Fixed
- fix(kube-runtime): setup backoff with builder pattern by @tiagolobocastro in #1603
- allow null user in kubeconfig's context by @aviramha in #1608
- Gauge SelectableField by k8s 1.30 version by @Danil-Grigorev in #1610
- Add a compile_error if setting selectable fields on K8s < 1.30 by @clux in #1612
- conditionally install
aws-lc-rsby @goenning in #1617 - Warn when trying to use an unsupported proxy protocol by @nightkr in #1626
New Contributors
- @bryantbiggs made their first contribution in #1629
- @verokarhu made their first contribution in #1631
Full Changelog: 0.96.0...0.97.0