Skip to content

Releases: Arnavion/k8s-openapi

v0.13.1

09 Oct 01:47
Compare
Choose a tag to compare

v0.13.1 (2021-10-08)

k8s-openapi

  • BUGFIX: v0.13.0 added schemars::JsonSchema impls for resource types. For types like k8s_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

09 Aug 07:45
Compare
Choose a tag to compare

v0.13.0 (2021-08-09)

k8s-openapi

  • BREAKING CHANGE: The change from v0.12.0 to make Option<Vec<T>> and Option<BTreeMap<K, V>> fields into Vec<T> and BTreeMap<K, V> fields has been reverted, because there is at least one case where a resource type needs to be serialized with an empty Vec 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 optional command parameter as Option<&'a [String]> instead of Option<&'a str>

  • BREAKING CHANGE: Fixed api::core::v1::ServiceSpec's clusterIPs field to be correctly emitted as cluster_ips instead of cluster_i_ps

  • FEATURE: The new schemars crate feature enables impls of schemars::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 of schemars::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 implement schemars::JsonSchema. The schemars feature of the k8s-openapi crate must have been enabled.

v0.12.0

16 Jun 08:38
Compare
Choose a tag to compare

k8s-openapi

  • BREAKING CHANGE: Struct fields of type Option<Vec<T>> and Option<BTreeMap<K, V>> are now of type Vec<T> and BTreeMap<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 a null 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 type Scope: ResourceScope that identifies whether a resource is cluster-scoped, namespace-scoped or a subresource. The second is an associated const URL_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 the http, serde and serde_json crates. It has now been fixed to use the re-exports from the k8s-openapi crate instead.

k8s-openapi-codegen-common

  • BREAKING CHANGE: run now takes an impl of RunState for writing generated code and imports instead of two separate closures. This allows the impl of RunState to share state between invocations of the two functions instead of needing RefCell, etc.

  • BREAKING CHANGE: swagger20::Type::JSONSchemaPropsOrArray, swagger20::Type::JSONSchemaPropsOrBool and swagger20::Type::JSONSchemaPropsOrStringArray have been renamed to swagger20::Type::JsonSchemaPropsOrArray, swagger20::Type::JsonSchemaPropsOrArray and swagger20::Type::JsonSchemaPropsOrArray respectively to match Rust naming conventions.

v0.11.0

23 Jan 08:47
Compare
Choose a tag to compare
  • BREAKING CHANGE: This version partially reverts the change in v0.9.0 that made k8s_openapi::apimachinery::pkg::apis::meta::v1::WatchEvent<T> require T: k8s_openapi::Resource; now it only requires T: serde::Deserialize<'de> once more. This has been done to make it possible to use WatchEvent with custom user-provided resource types that do not implement k8s_openapi::Resource.

    The k8s_openapi::Resource bound in v0.9.0 was added to be able to enforce that the WatchEvent::<T>::Bookmark events contain the correct apiVersion and kind fields for the specified T during deserialization. Without the bound now, it is no longer possible to do that. So it is now possible to deserialize, say, a WatchEvent::<Pod>::Bookmark as a WatchEvent::<Node>::Bookmark without any runtime error. Take care to deserialize watch_* API responses into the right k8s_openapi::WatchResponse<T> type, such as by relying on the returned k8s_openapi::ResponseBody<T> as documented in the crate docs.

  • BREAKING CHANGE: The bytes dependency has been updated to match the tokio 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

12 Oct 03:45
Compare
Choose a tag to compare
  • FEATURE: Added support for Kubernetes 1.19 under the v1_19 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.12
  • v1.18.9
  • v1.19.2

v0.9.0

19 Jul 08:27
Compare
Choose a tag to compare
  • BREAKING CHANGE: Resource types that used to have a metadata: Option<crate::apimachinery::pkg::apis::meta::v1::ObjectMeta> field now have a metadata: 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's metadata getter now returns &Self::Ty instead of Option<&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 a T, but is now a struct variant containing a resource_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 and metadata.resourceVersion fields set to useful values. Previously this would cause deserialization of bookmark events to fail if the T had some required field that was actually unset or null. 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 requires T to also implement k8s_openapi::Resource. Previously it only required T to implement serde::de::DeserializeOwned. This is required to support the change mentioned in the previous item, since the deserialization of a WatchEvent now needs to take the apiVersion, kind and metadata.resourceVersion fields into consideration itself instead of relying on T's serde::Deserialize impl.

  • FEATURE: The k8s_openapi::Metadata trait now has a fn 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

02 May 21:30
Compare
Choose a tag to compare
  • BREAKING CHANGE: Support for v1.8, v1.9 and v1.10 API servers has been dropped. These versions became hard to test with kubectl and kind are are not supported by major cloud providers.

  • BREAKING CHANGE: k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::JSONSchemaPropsOrArray, JSONSchemaPropsOrBool and JSONSchemaPropsOrStringArray types now wrap the v1::JSONSchemaProps type. Previously they incorrectly wrapped the v1beta1::JSONSchemaProps type.

  • BREAKING CHANGE: Turning the api feature off now also disables the k8s_openapi::{http,percent_encoding,url} re-exports, the k8s_openapi::percent_encoding2 module, the k8s_openapi::{RequestError,ResponseError,ResponseBody} types, the k8s_openapi::Response trait, and the k8s_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 the api feature off.

  • BUGFIX: k8s_openapi::apimachinery::pkg::apis::meta::v1::MicroTime and Time 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 impls PartialOrd and Ord.

  • FEATURE: k8s_openapi::apimachinery::pkg::apis::meta::v1::MicroTime and Time now impl Eq, PartialOrd and Ord.

  • 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 the k8s_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

02 May 21:30
Compare
Choose a tag to compare

Fixed docs URLs. No other changes since v0.7.0.

v0.7.0

02 May 21:30
Compare
Choose a tag to compare
  • BREAKING CHANGE: The http and bytes dependencies have been updated. They now match the tokio 0.2 ecosystem.

  • BREAKING CHANGE: The Resource trait's api_version, group, kind and version methods are now API_VERSION, GROUP, KIND and VERSION associated consts of &'static str type.

  • BREAKING CHANGE: The *List resource types like PodList and NodeList have now been combined into a single generic k8s_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 and k8s_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> and WatchResponse<T> types respectively.

  • BUGFIX: v1.16's k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::JSONSchemaPropsOrArray, JSONSchemaPropsOrBool and JSONSchemaPropsOrStringArray types are now generated correctly, just like their v1beta 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 like Pod to its corresponding list type like PodList. Currently the trait only has one member - an associated const LIST_KIND that is the same as the list type's Resource::KIND.

Here are some demonstrative examples of the API changes:

  • Pod::delete_namespaced_pod used to return DeleteNamespacedPodResponse. It now returns DeleteResponse<Self>.
  • Pod::delete_collection_namespaced_pod used to return DeleteCollectionNamespacedPodResponse. It now returns DeleteResponse<List<Self>>.
  • Pod::list_namespaced_pod used to return ListNamespacedPodResponse which had an Ok(PodList) variant. It now returns ListResponse<Self>, which has an Ok(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

19 Oct 03:47
Compare
Choose a tag to compare
  • 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