Releases: Arnavion/k8s-openapi
v0.17.0
k8s-openapi
-
BREAKING CHANGE: Added support for Kubernetes 1.26 under the
v1_26feature. -
BREAKING CHANGE: Dropped support for Kubernetes 1.18 and 1.19.
-
FEATURE: Allow deserializing non-optional
ByteStrings from JSONnull. The API server is known to allow thesenulls in theConfigMap::binary_dataandSecret::datamaps. The deserialization results in an emptyByteString, to match the behavior of the API server when given anullvalue in theConfigMap::datamap.
Corresponding Kubernetes API server versions:
- v1.20.15
- v1.21.14
- v1.22.17
- v1.23.15
- v1.24.9
- v1.25.5
- v1.26.0
v0.16.0
k8s-openapi
-
BREAKING CHANGE: Added support for Kubernetes 1.25 under the
v1_25feature. -
FEATURE: All spec types now implement a deep-merge API via a
DeepMergetrait impl with afn merge_from(&mut self, other: Self)method. This is useful for builder-like operations.
Corresponding Kubernetes API server versions:
- v1.18.20
- v1.19.16
- v1.20.15
- v1.21.14
- v1.22.14
- v1.23.11
- v1.24.5
- v1.25.1
k8s-openapi-codegen-common
- No changes.
k8s-openapi-derive
-
BREAKING CHANGE:
#[derive(CustomResourceDefinition)]no longer generates a list type alias. For example, when applied tostruct FooSpec, previously the custom derive would generatepub type FooList = k8s_openapi::List<Foo>;It no longer does this, in accordance with the main k8s-openapi crate where such aliases were removed back in v0.7.0 -
FEATURE: The generated custom resource type will implement
k8s_openapi::DeepMergeif theimpl_deep_mergecustom derive attribute is used. Note that this requires you to implementk8s_openapi::DeepMergeon the spec type yourself; the custom derive does not do that.
v0.15.0 (2022-05-22)
k8s-openapi
-
BREAKING CHANGE: The
prettyoptional parameter has been removed from all operations. Setting this parameter totruewould've made the API server pretty-print the JSON response, which is meaningless for a programmatic client. -
BREAKING CHANGE: In addition to the previous change, the
exactandexportparameters have been removed from all read operations (egPod::read_namespaced_pod). These parameters were removed in Kubernetes v1.21 and were known to be broken before that, and would've caused the server response to not be able to be parsed correctly via the operation's response type anyway.All read operations with the exception of
Pod::read_namespaced_pod_loghad only these three optional parameters, so now that they've been removed such read operations don't have anoptional: ReadFooOptional<'_>parameter at all. -
BREAKING CHANGE: Operation names no longer include the
_namespacedpart and the resource type name. For example,Pod::read_namespaced_podis now justPod::read. The corresponding optional parameters type and response type no longer include theNamespacedpart, egReadNamespacedPodResponseis now justReadPodResponse. -
BREAKING CHANGE: Added support for Kubernetes 1.24 under the
v1_24feature. -
BREAKING CHANGE: Dropped support for Kubernetes 1.16 and 1.17.
-
FEATURE: The
K8S_OPENAPI_ENABLED_VERSIONenv var can now be set at build time to enable a specific API version, just like enabling a specific version feature would've done. This is only meant to be used by library developers who want to runcargo check,cargo doc, etc commands, for which the previous advice of enabling a version feature via a dev dependency would not work.
Corresponding Kubernetes API server versions:
- v1.18.20
- v1.19.16
- v1.20.15
- v1.21.12
- v1.22.9
- v1.23.6
- v1.24.0
v0.14.0
v0.14.0 (2022-01-23)
k8s-openapi
-
BREAKING CHANGE: k8s-openapi now disables all default features of its dependencies and only enables the ones it needs. If your code was implicitly relying on some default feature being enabled of an indirect dependency re-exported from
k8s-openapi, it will now not compile. You will need to enable the feature yourself in your own dependency.For example, if you had
use k8s_openapi::schemars; #[derive(schemars::JsonSchema)] struct YourCode { ... }this will no longer compile because the proc macro is only compiled when the"derive"feature is enabled. You will need to add an explicit dependency on theschemarscrate in your code, with its"derive"feature enabled. -
BREAKING CHANGE: Added support for Kubernetes 1.23 under the
v1_23feature. -
BREAKING CHANGE: Dropped support for Kubernetes 1.11, 1.12, 1.13, 1.14 and 1.15.
-
BUGFIX: The
serde::Deserializeimpl of some types now acceptsnullfor required fields and deserializes it as the default value of that field. This is because the Kubernetes API server violates the schema and sendsnullin some cases.For example, a user is allowed to create a
DaemonSetwhosePodSpechas"containers": null, even thoughPodSpec::containersis a required field and emitted as aVec. When querying thisDaemonSpecback from the API server, it will return"containers": nullin the response too. Before this fix, such a response would fail to deserialize. Note that serialization is still spec-compliant as before, so such aDaemonSetcould not have been created with this crate's types before and still cannot be created now.
Corresponding Kubernetes API server versions:
- v1.16.15
- v1.17.17
- v1.18.20
- v1.19.16
- v1.20.15
- v1.21.9
- v1.22.6
- v1.23.2
k8s-openapi-codegen-common
- BUGFIX:
k8s_openapi_codegen_common::Errornow implementssource()correctly instead of always returningNone.
k8s-openapi-derive
- No changes except to bump the
k8s-openapi-codegen-commondependency to the new version.
v0.13.1
v0.13.1 (2021-10-08)
k8s-openapi
- BUGFIX: v0.13.0 added
schemars::JsonSchemaimpls for resource types. For types likek8s_openapi::apimachinery::pkg::apis::meta::v1::FieldsV1that are objects with no defined structure, the impl incorrectly emitted the schema as{}instead of{ "type": "object" }. This has now been fixed.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.12
- v1.16.15
- v1.17.17
- v1.18.20
- v1.19.15
- v1.20.11
- v1.21.5
- v1.22.2
k8s-openapi-codegen-common
- BUGFIX: See the bugfix mentioned above.
k8s-openapi-derive
- No changes except to bump the
k8s-openapi-codegen-commondependency to the new version.
v0.13.0
v0.13.0 (2021-08-09)
k8s-openapi
-
BREAKING CHANGE: The change from v0.12.0 to make
Option<Vec<T>>andOption<BTreeMap<K, V>>fields intoVec<T>andBTreeMap<K, V>fields has been reverted, because there is at least one case where a resource type needs to be serialized with an emptyVecfield. See #103 -
BREAKING CHANGE: Added support for Kubernetes 1.22 under the
v1_22feature. -
BREAKING CHANGE: Fixed
api::core::v1::Pod::connect_get_namespaced_pod_execto take its optionalcommandparameter asOption<&'a [String]>instead ofOption<&'a str> -
BREAKING CHANGE: Fixed
api::core::v1::ServiceSpec'sclusterIPsfield to be correctly emitted ascluster_ipsinstead ofcluster_i_ps -
FEATURE: The new
schemarscrate feature enables impls ofschemars::JsonSchemaon all resource types.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.12
- v1.16.15
- v1.17.17
- v1.18.20
- v1.19.13
- v1.20.9
- v1.21.3
- v1.22.0
k8s-openapi-codegen-common
- BREAKING CHANGE:
k8s_openapi_codegen_common::runnow takes an additional parameter to indicate whether the generated code of resource types should contain an impl ofschemars::JsonSchemaor not.
k8s-openapi-derive
- FEATURE: The
#[derive(CustomResourceDefinition)]custom derive now recognizes a new attribute#[custom_resource_definition(generate_schema)]. If this attribute is provided, the generated custom resource type will also implementschemars::JsonSchema. Theschemarsfeature of thek8s-openapicrate must have been enabled.
v0.12.0
k8s-openapi
-
BREAKING CHANGE: Struct fields of type
Option<Vec<T>>andOption<BTreeMap<K, V>>are now of typeVec<T>andBTreeMap<K, V>respectively. When deserializing from JSON,nullis deserialized to an empty collection. When serializing, an empty collection is not serialized. This was done to improve ergonomics and is not expected to create problems with any existing Kubernetes objects. If you do find a Kubernetes object that meaningfully differentiates between anullcollection and an empty one, please file a bug. -
BREAKING CHANGE: Added support for Kubernetes 1.21 under the
v1_21feature. -
FEATURE: The
Resourcetrait now contains two additional items. The first is an associated typeScope: ResourceScopethat identifies whether a resource is cluster-scoped, namespace-scoped or a subresource. The second is an associated constURL_PATH_SEGMENT: &'static strthat can be used to dynamically construct a URL for operations on the resource - for cluster- and namespace-scoped resources it is their plural name, for subresources it is the subresource name.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.12
- v1.16.15
- v1.17.17
- v1.18.19
- v1.19.11
- v1.20.7
- v1.21.1
k8s-openapi-derive
- BUGFIX: The generated code of
#[derive(CustomResourceDefinition)]implicitly expected the crate to have added a dependency on thehttp,serdeandserde_jsoncrates. It has now been fixed to use the re-exports from thek8s-openapicrate instead.
k8s-openapi-codegen-common
-
BREAKING CHANGE:
runnow takes an impl ofRunStatefor writing generated code and imports instead of two separate closures. This allows the impl ofRunStateto share state between invocations of the two functions instead of needingRefCell, etc. -
BREAKING CHANGE:
swagger20::Type::JSONSchemaPropsOrArray,swagger20::Type::JSONSchemaPropsOrBoolandswagger20::Type::JSONSchemaPropsOrStringArrayhave been renamed toswagger20::Type::JsonSchemaPropsOrArray,swagger20::Type::JsonSchemaPropsOrArrayandswagger20::Type::JsonSchemaPropsOrArrayrespectively to match Rust naming conventions.
v0.11.0
-
BREAKING CHANGE: This version partially reverts the change in v0.9.0 that made
k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent<T>requireT: k8s_openapi::Resource; now it only requiresT: serde::Deserialize<'de>once more. This has been done to make it possible to useWatchEventwith custom user-provided resource types that do not implementk8s_openapi::Resource.The
k8s_openapi::Resourcebound in v0.9.0 was added to be able to enforce that theWatchEvent::<T>::Bookmarkevents contain the correctapiVersionandkindfields for the specifiedTduring deserialization. Without the bound now, it is no longer possible to do that. So it is now possible to deserialize, say, aWatchEvent::<Pod>::Bookmarkas aWatchEvent::<Node>::Bookmarkwithout any runtime error. Take care to deserializewatch_*API responses into the rightk8s_openapi::WatchResponse<T>type, such as by relying on the returnedk8s_openapi::ResponseBody<T>as documented in the crate docs. -
BREAKING CHANGE: The
bytesdependency has been updated to match thetokiov1 ecosystem. -
FEATURE: Added support for Kubernetes 1.20 under the
v1_20feature.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.12
- v1.16.15
- v1.17.17
- v1.18.15
- v1.19.7
- v1.20.2
v0.10.0
v0.9.0
-
BREAKING CHANGE: Resource types that used to have a
metadata: Option<crate::apimachinery::pkg::apis::meta::v1::ObjectMeta>field now have ametadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMetafield instead. That is, metadata is now a required field for resource types. Most client requests and server responses need to set the field, so dealing with it being optional required unnecessary boilerplate in client code for both creating requests and using responses.Likewise, the
k8s_openapi::Metadatatrait'smetadatagetter now returns&Self::Tyinstead ofOption<&Self::Ty>Note that the fields inside the
ObjectMetatype are themselves still optional.There are some sitations like PATCH requests where the metadata truly is optional. In these cases, you can create an empty metadata value via
Default::default(), which will get serialized as an empty JSON object{}. If there is a situation where the empty object does not act the same as if the field had been omitted entirely, please file an issue. -
BREAKING CHANGE:
k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent::<T>::Bookmarkused to be a tuple variant containing aT, but is now a struct variant containing aresource_version: Stringfield.While the Kubernetes OpenAPI spec indicates that bookmark events contain the resource type, in fact they contain a stripped down form of that type with only the
apiVersion,kindandmetadata.resourceVersionfields set to useful values. Previously this would cause deserialization of bookmark events to fail if theThad some required field that was actually unset ornull. Now the deserializer only looks for those three values in the event and ignores any others. -
BREAKING CHANGE:
k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent<T>now requiresTto also implementk8s_openapi::Resource. Previously it only requiredTto implementserde::de::DeserializeOwned. This is required to support the change mentioned in the previous item, since the deserialization of aWatchEventnow needs to take theapiVersion,kindandmetadata.resourceVersionfields into consideration itself instead of relying onT'sserde::Deserializeimpl. -
FEATURE: The
k8s_openapi::Metadatatrait now has afn metadata_mut(&mut self) -> &mut<Self as Metadata>::Tymethod that can be used to mutate the metadata of the resource. -
FEATURE: The
k8s-openapi-codegen-commoncrate is now stable and documented. It can be used by other code generators that want to generate code for Kubernetes-like API servers such as OpenShift.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.12
- v1.16.13
- v1.17.9
- v1.18.6