Releases: Arnavion/k8s-openapi
v0.15.0 (2022-05-22)
k8s-openapi
-
BREAKING CHANGE: The
pretty
optional parameter has been removed from all operations. Setting this parameter totrue
would'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
exact
andexport
parameters 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_log
had 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
_namespaced
part and the resource type name. For example,Pod::read_namespaced_pod
is now justPod::read
. The corresponding optional parameters type and response type no longer include theNamespaced
part, egReadNamespacedPodResponse
is now justReadPodResponse
. -
BREAKING CHANGE: Added support for Kubernetes 1.24 under the
v1_24
feature. -
BREAKING CHANGE: Dropped support for Kubernetes 1.16 and 1.17.
-
FEATURE: The
K8S_OPENAPI_ENABLED_VERSION
env 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 theschemars
crate in your code, with its"derive"
feature enabled. -
BREAKING CHANGE: Added support for Kubernetes 1.23 under the
v1_23
feature. -
BREAKING CHANGE: Dropped support for Kubernetes 1.11, 1.12, 1.13, 1.14 and 1.15.
-
BUGFIX: The
serde::Deserialize
impl of some types now acceptsnull
for required fields and deserializes it as the default value of that field. This is because the Kubernetes API server violates the schema and sendsnull
in some cases.For example, a user is allowed to create a
DaemonSet
whosePodSpec
has"containers": null
, even thoughPodSpec::containers
is a required field and emitted as aVec
. When querying thisDaemonSpec
back from the API server, it will return"containers": null
in the response too. Before this fix, such a response would fail to deserialize. Note that serialization is still spec-compliant as before, so such aDaemonSet
could 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::Error
now implementssource()
correctly instead of always returningNone
.
k8s-openapi-derive
- No changes except to bump the
k8s-openapi-codegen-common
dependency to the new version.
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