Skip to content

kube dependency enables too many features #160

@sfleen

Description

@sfleen

Currently, gateway-api-rs leaves default features enabled for the kube dependency. The default features of kube are client (a full-featured k8s client), rustls-tls (TLS provider), and ring (crypto backend for rustls).

None of these features are actually used by gateway-api-rs outside of tests, which is problematic for users of this library. For example, this manifests as ring always being included in the dependency tree, even if a different crypto backend is used for rustls.

There's a couple of options for how I would recommend this be fixed:

1) Replace kube with kube-core + kube-derive

This is the "most correct" option, pulling in the exact minimum set of required dependencies for the library. It does require updating usage of the CustomResource the derive macro, telling the macro where to find kube-core:

#[derive(kube_derive::CustomResource)]
#[kube(crates(kube_core = "::kube_core"))]
struct MyCustomResource { ... }

The tests can continue to use kube, as they actually make use of that library, but keeping that dependency in dev-dependencies will be sufficient.

2) Disable default features on kube

This is more of a shortcut option, allowing the kube dependency to be kept with a more targeted set of features (like derive) enabled. It still includes some extraneous parts of kube that this library doesn't use, but afaict they're not particularly large compared to kube-client or the rustls crypto backends.

Recommendation

Overall, I would recommend option 1. It includes the most minimal required subset of dependencies, and sets up gateway-api-rs to be a good citizen of the broader rust/k8s ecosystem. I've posted a PR that implements this option at #159

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions