Releases: Arnavion/k8s-openapi
v0.13.1
v0.13.1 (2021-10-08)
k8s-openapi
- BUGFIX: v0.13.0 added
schemars::JsonSchema
impls for resource types. For types likek8s_openapi::apimachinery::pkg::apis::meta::v1::FieldsV1
that 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-common
dependency 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 emptyVec
field. See #103 -
BREAKING CHANGE: Added support for Kubernetes 1.22 under the
v1_22
feature. -
BREAKING CHANGE: Fixed
api::core::v1::Pod::connect_get_namespaced_pod_exec
to take its optionalcommand
parameter asOption<&'a [String]>
instead ofOption<&'a str>
-
BREAKING CHANGE: Fixed
api::core::v1::ServiceSpec
'sclusterIPs
field to be correctly emitted ascluster_ips
instead ofcluster_i_ps
-
FEATURE: The new
schemars
crate feature enables impls ofschemars::JsonSchema
on 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::run
now takes an additional parameter to indicate whether the generated code of resource types should contain an impl ofschemars::JsonSchema
or 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
. Theschemars
feature of thek8s-openapi
crate 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,null
is 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 anull
collection and an empty one, please file a bug. -
BREAKING CHANGE: Added support for Kubernetes 1.21 under the
v1_21
feature. -
FEATURE: The
Resource
trait now contains two additional items. The first is an associated typeScope: ResourceScope
that identifies whether a resource is cluster-scoped, namespace-scoped or a subresource. The second is an associated constURL_PATH_SEGMENT: &'static str
that 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
,serde
andserde_json
crates. It has now been fixed to use the re-exports from thek8s-openapi
crate instead.
k8s-openapi-codegen-common
-
BREAKING CHANGE:
run
now takes an impl ofRunState
for writing generated code and imports instead of two separate closures. This allows the impl ofRunState
to share state between invocations of the two functions instead of needingRefCell
, etc. -
BREAKING CHANGE:
swagger20::Type::JSONSchemaPropsOrArray
,swagger20::Type::JSONSchemaPropsOrBool
andswagger20::Type::JSONSchemaPropsOrStringArray
have been renamed toswagger20::Type::JsonSchemaPropsOrArray
,swagger20::Type::JsonSchemaPropsOrArray
andswagger20::Type::JsonSchemaPropsOrArray
respectively 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 useWatchEvent
with custom user-provided resource types that do not implementk8s_openapi::Resource
.The
k8s_openapi::Resource
bound in v0.9.0 was added to be able to enforce that theWatchEvent::<T>::Bookmark
events contain the correctapiVersion
andkind
fields for the specifiedT
during deserialization. Without the bound now, it is no longer possible to do that. So it is now possible to deserialize, say, aWatchEvent::<Pod>::Bookmark
as aWatchEvent::<Node>::Bookmark
without 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
bytes
dependency has been updated to match thetokio
v1 ecosystem. -
FEATURE: Added support for Kubernetes 1.20 under the
v1_20
feature.
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::ObjectMeta
field 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::Metadata
trait'smetadata
getter now returns&Self::Ty
instead ofOption<&Self::Ty>
Note that the fields inside the
ObjectMeta
type 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>::Bookmark
used to be a tuple variant containing aT
, but is now a struct variant containing aresource_version: String
field.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
,kind
andmetadata.resourceVersion
fields set to useful values. Previously this would cause deserialization of bookmark events to fail if theT
had 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 requiresT
to also implementk8s_openapi::Resource
. Previously it only requiredT
to implementserde::de::DeserializeOwned
. This is required to support the change mentioned in the previous item, since the deserialization of aWatchEvent
now needs to take theapiVersion
,kind
andmetadata.resourceVersion
fields into consideration itself instead of relying onT
'sserde::Deserialize
impl. -
FEATURE: The
k8s_openapi::Metadata
trait now has afn metadata_mut(&mut self) -> &mut<Self as Metadata>::Ty
method that can be used to mutate the metadata of the resource. -
FEATURE: The
k8s-openapi-codegen-common
crate 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
v0.8.0
-
BREAKING CHANGE: Support for v1.8, v1.9 and v1.10 API servers has been dropped. These versions became hard to test with
kubectl
andkind
are are not supported by major cloud providers. -
BREAKING CHANGE:
k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::JSONSchemaPropsOrArray
,JSONSchemaPropsOrBool
andJSONSchemaPropsOrStringArray
types now wrap thev1::JSONSchemaProps
type. Previously they incorrectly wrapped thev1beta1::JSONSchemaProps
type. -
BREAKING CHANGE: Turning the
api
feature off now also disables thek8s_openapi::{http,percent_encoding,url}
re-exports, thek8s_openapi::percent_encoding2
module, thek8s_openapi::{RequestError,ResponseError,ResponseBody}
types, thek8s_openapi::Response
trait, and thek8s_openapi::{Create,Delete,List,Patch,Replace,Watch}{Optional,Response}
types. All of these were only used by the API functions which had been disabled by turning theapi
feature off. -
BUGFIX:
k8s_openapi::apimachinery::pkg::apis::meta::v1::MicroTime
andTime
are now serialized with six and zero decimals in their seconds respectively, to match the API server's expectations. Previously they would be serialized with a variable number of decimals up to nine. -
FEATURE: Added support for Kubernetes 1.18 under the
v1_18
feature. -
FEATURE:
k8s_openapi::ByteString
now implsPartialOrd
andOrd
. -
FEATURE:
k8s_openapi::apimachinery::pkg::apis::meta::v1::MicroTime
andTime
now implEq
,PartialOrd
andOrd
. -
FEATURE: If your crate has a dependency on
k8s-openapi
, you can now use a build script to detect which version feature has been enabled on the crate. This is a more verbose but also more flexible alternative to using thek8s_if_*
version detection macros in your crate code. -
FEATURE:
k8s-openapi-derive
's#[derive(CustomResourceDefinition)]
now supports emitting a subresources field in the generated CR type.
Corresponding Kubernetes API server versions:
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.11
- v1.16.9
- v1.17.5
- v1.18.2
v0.7.1
v0.7.0
-
BREAKING CHANGE: The
http
andbytes
dependencies have been updated. They now match thetokio
0.2 ecosystem. -
BREAKING CHANGE: The
Resource
trait'sapi_version
,group
,kind
andversion
methods are nowAPI_VERSION
,GROUP
,KIND
andVERSION
associated consts of&'static str
type. -
BREAKING CHANGE: The
*List
resource types likePodList
andNodeList
have now been combined into a single generick8s_openapi::List<T>
type. The API response types that contained these list types have been updated accordingly. -
BREAKING CHANGE: The optional parameters of create and replace operations are now emitted as a single common type -
k8s_openapi::CreateOptional
andk8s_openapi::ReplaceOptional
respectively. -
BREAKING CHANGE: The response types of create, delete, delete-collection, list, patch, replace and watch operations have now been combined into generic
CreateResponse<T>
,DeleteResponse<T>
,DeleteResponse<List<T>>
,ListResponse<T>
,PatchResponse<T>
,ReplaceResponse<T>
andWatchResponse<T>
types respectively. -
BUGFIX: v1.16's
k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::JSONSchemaPropsOrArray
,JSONSchemaPropsOrBool
andJSONSchemaPropsOrStringArray
types are now generated correctly, just like theirv1beta
cousins. -
FEATURE: Added support for Kubernetes 1.17 under the
v1_17
feature. -
FEATURE: A new
k8s_openapi::ListableResource
trait has been added to connect a resource type likePod
to its corresponding list type likePodList
. Currently the trait only has one member - an associated constLIST_KIND
that is the same as the list type'sResource::KIND
.
Here are some demonstrative examples of the API changes:
Pod::delete_namespaced_pod
used to returnDeleteNamespacedPodResponse
. It now returnsDeleteResponse<Self>
.Pod::delete_collection_namespaced_pod
used to returnDeleteCollectionNamespacedPodResponse
. It now returnsDeleteResponse<List<Self>>
.Pod::list_namespaced_pod
used to returnListNamespacedPodResponse
which had anOk(PodList)
variant. It now returnsListResponse<Self>
, which has anOk(List<Self>)
variant.
Combining these response types has reduced the compile time and memory usage of the Rust compiler when compiling this crate. Notably, the compiler's memory usage now peaks at ~3 GiB from its earlier ~5 GiB, making it easier to use with environments limited to 4 GiB RAM, like CI VMs and Raspberry Pi's.
Corresponding Kubernetes API server versions:
- v1.8.15
- v1.9.11
- v1.10.13
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.9
- v1.16.6
- v1.17.2
v0.6.0
-
BREAKING CHANGE: Updated
url
dependency, and thus the re-export, to v2. The re-export is only used internally by code-generated API functions and is not part of any public signatures, so it is only a breaking change for you if you were also using it for your own code. -
FEATURE: Added support for Kubernetes 1.16 under the
v1_16
feature. -
FEATURE: The
k8s-openapi-derive
crate is now out of beta.
Corresponding Kubernetes API server versions:
- v1.8.15
- v1.9.11
- v1.10.13
- v1.11.10
- v1.12.10
- v1.13.12
- v1.14.8
- v1.15.5
- v1.16.2