Arnavion / k8s-openapi

Rust definitions of the resource types in the Kubernetes client API
Apache License 2.0
373 stars 42 forks source link

about k8s-openapi features upgrade question #150

Closed vCassius closed 8 months ago

vCassius commented 8 months ago

An error occurs when v1 24 is upgraded to v1 26

[target.'cfg(unix)'.dependencies]
k8s-openapi = { version = "0.20.0", default-features = false ,features = ["v1_26"] }
kube-derive = { version = "0.87.1" }
kube = { version = "0.87.1", features = ["admission","derive","client","openssl-tls","runtime","ws"]}
   Compiling k8s-openapi v0.20.0
error: failed to run custom build command for `k8s-openapi v0.20.0`

Caused by:
  process didn't exit successfully: `/Users/vincent/Documents/source/devops-v5/v-kubernetes-action/target/debug/build/k8s-openapi-f7c1c2517a0e4305/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=K8S_OPENAPI_ENABLED_VERSION

  --- stderr
  thread 'main' panicked at /Users/vincent/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/k8s-openapi-0.20.0/build.rs:45:13:

  Both v1_24 and v1_26 features are enabled on the k8s-openapi crate. These feature indicates which version of Kubernetes the k8s-openapi crate should support. Only one feature can be enabled at the same time.

  If you have enabled both of these features yourself, either via the k8s-openapi dependency in your Cargo.toml or via setting the `K8S_OPENAPI_ENABLED_VERSION` env var, please remove one of them. If you are writing a library crate, do not enable any features at all. Library crates *must not* enable any features on the k8s-openapi crate.

  If you have not enabled one or both of these features yourself, then one of the library crates in your dependency graph *has*. Locate which library crates in your dependency graph depend on k8s-openapi and enable one or more of its features, and file a bug against them, citing this text. You can search your Cargo.lock for "k8s-openapi" to discover these crates.
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish.
Arnavion commented 8 months ago

Read the error.

vCassius commented 8 months ago

Read the error. yeah i known,but i did not set any K8S_OPENAPI_ENABLED_VERSION env var and i used features = ["v1_26"] ,so i don't know why told me both v1_24 and v1_26 features are enabled on the k8s-openapi crate

Arnavion commented 8 months ago

Again, as the error says, either you have two features enabled in your Cargo.toml, or you have the K8S_OPENAPI_ENABLED_VERSION env var set, or you have some dependencies that have enabled features. If you're sure that it's not the first or the second then look for the third.

The dependencies you've posted in OP do not have any problem. So look at the rest of your dependencies.

vCassius commented 8 months ago

Again, as the error says, either you have two features enabled in your Cargo.toml, or you have the K8S_OPENAPI_ENABLED_VERSION env var set, or you have some dependencies that have enabled features. If you're sure that it's not the first or the second then look for the third.

The dependencies you've posted in OP do not have any problem. So look at the rest of your dependencies.

thx ~I got it. I went to check the dependencies