Skip to content

remove features from k8s-openapi dependency#74

Open
orangecms wants to merge 1 commit into
kube-rs:mainfrom
orangecms:k8s-openapi-nofeats
Open

remove features from k8s-openapi dependency#74
orangecms wants to merge 1 commit into
kube-rs:mainfrom
orangecms:k8s-openapi-nofeats

Conversation

@orangecms

Copy link
Copy Markdown
Contributor

Library crates must not enable k8s-openapi features. The eventual app/operator needs to be able to select their own version.
See https://github.com/Arnavion/k8s-openapi/blob/b2c839b8b1828e9035ff8467cdac87756190aa4e/src/lib.rs#L75.

resolves #73

Library crates must not enable k8s-openapi features. The eventual app/operator
needs to be able to select their own version.
See <https://github.com/Arnavion/k8s-openapi/blob/b2c839b8b1828e9035ff8467cdac87756190aa4e/src/lib.rs#L75>.

For CI, use the `K8S_OPENAPI_ENABLED_VERSION` env var.

Signed-off-by: Jiji Freya Daniel Maslowski <daniel.maslowski@rise-world.com>
@orangecms orangecms force-pushed the k8s-openapi-nofeats branch from 52ef1e7 to 52d29fb Compare June 24, 2026 12:00
@orangecms

Copy link
Copy Markdown
Contributor Author

Oh well, that quick attempt gets

Caused by:
  process didn't exit successfully: `/home/runner/work/envtest/envtest/target/debug/build/k8s-openapi-586482ce6fa3a465/build-script-build` (exit status: 101)
  --- stdout
  cargo::rerun-if-env-changed=K8S_OPENAPI_ENABLED_VERSION

  --- stderr

  thread 'main' (3335) panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/k8s-openapi-0.28.0/build.rs:17:42:

  None of the v1_* features are enabled on the k8s-openapi crate.

  The k8s-openapi crate requires a feature to be enabled to indicate which version of Kubernetes it should support.

  If you're using k8s-openapi in a binary crate, enable the feature corresponding to the minimum version of API server that you want to support. In case your binary crate does not directly depend on k8s-openapi, add a dependency on k8s-openapi and enable the corresponding feature in it.

  If you're using k8s-openapi in a library crate, add a dev-dependency on k8s-openapi and enable one of the features there. This way the feature will be enabled when buildings tests and examples of your library, but not when building the library itself. In case your library crate does not directly depend on k8s-openapi, add a dev-dependency on k8s-openapi and enable the corresponding feature in it.

  Alternatively, when running commands that do not build dev dependencies such as `cargo check` and `cargo doc`, you can set the `K8S_OPENAPI_ENABLED_VERSION` environment variable, such as `K8S_OPENAPI_ENABLED_VERSION=1.50`.

  Library crates *must not* enable any features in their direct dependency on k8s-openapi, only in their dev-dependency. The choice of which Kubernetes version to support should be left to the final binary crate, so only binary crates should enable a specific feature. If library crates also enabled features, it could cause multiple features to be enabled simultaneously, which k8s-openapi does not support.

  If your library crate only supports a single specific version or a specific range of versions of Kubernetes, please use the `k8s_if_*` version-specific macros or a build script to emit different code based on which feature gets enabled in the end.

  If you believe you *have* enabled a version feature and should not be seeing this error, check your Cargo.lock or run `cargo tree -i k8s-openapi` to ensure that this version of k8s-openapi is the only one being used in your project.

  See the k8s-openapi docs for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

must not use k8s-openapi features

1 participant