Rust dependencies
I was having an issue with k8s-openapi complaining:
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 believe you have enabled a version feature and should not be seeing this error, check your Cargo.lock or run
cargo tree -i k8s-openapito ensure that this version of k8s-openapi is the only one being used in your project.
This was with a Cargo.toml:
[dependencies]
k8s-openapi = { version = "0.21.0", features = ["v1_26"] }
kube = { version = "0.85.0", features = ["derive"] }
And was confused by the issue until I followed the error instructions:
cargo tree --invert k8s-openapi
error: There are multiple `k8s-openapi` packages in your project, and the specification `k8s-openapi` is ambiguous.
Please re-run this command with one of the following specifications:
[email protected]
[email protected]
I belatedly realized that the command also permits e.g.:
cargo tree --invert [email protected]
k8s-openapi v0.19.0
├── kube v0.85.0
│ └── rust-koyeb-operator v0.0.1 (/path/to/operator-framework/operator-sdk-v1.33.0/rust-koyeb-operator)
├── kube-client v0.85.0
│ └── kube v0.85.0 (*)
└── kube-core v0.85.0
├── kube v0.85.0 (*)
└── kube-client v0.85.0 (*)
And:
cargo tree --invert [email protected]
k8s-openapi v0.21.0
└── rust-koyeb-operator v0.0.1 (/path/to/operator-framework/operator-sdk-v1.33.0/rust-koyeb-operator)
Leading me to conclude that, even though I was trying to use:
k8s-openapi = { version = "0.21.0" }
This conflicts with e.g. kube v0.85.0 requirement for k8s-openapi v0.19.0.
Check crates, there’s a newer kube v0.88.1 and this has suitable dependencies:
[dependencies]
kube = { version = "0.88.1", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.21.0", features = ["latest"] }