Skip to content

Releases: Arnavion/k8s-openapi

v0.15.0 (2022-05-22)

23 May 03:19
80f4124
Compare
Choose a tag to compare

k8s-openapi

  • BREAKING CHANGE: The pretty optional parameter has been removed from all operations. Setting this parameter to true 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 and export parameters have been removed from all read operations (eg Pod::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 an optional: 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 just Pod::read. The corresponding optional parameters type and response type no longer include the Namespaced part, eg ReadNamespacedPodResponse is now just ReadPodResponse.

  • 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 run cargo 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

24 Jan 00:02
Compare
Choose a tag to compare

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 the schemars 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 accepts null for required fields and deserializes it as the default value of that field. This is because the Kubernetes API server violates the schema and sends null in some cases.

    For example, a user is allowed to create a DaemonSet whose PodSpec has "containers": null, even though PodSpec::containers is a required field and emitted as a Vec. When querying this DaemonSpec 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 a DaemonSet 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 implements source() correctly instead of always returning None.

k8s-openapi-derive

  • No changes except to bump the k8s-openapi-codegen-common dependency to the new version.

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.