Expand description
In-memory Kubernetes client for testing controllers and operators.
Based on controller-runtime’s fake client from the Go ecosystem.
§Examples
§Namespaced Resources
use kube_fake_client::ClientBuilder;
use k8s_openapi::api::core::v1::Pod;
use kube::api::{Api, PostParams};
let client = ClientBuilder::new().build().await?;
let pods: Api<Pod> = Api::namespaced(client, "default");
let mut pod = Pod::default();
pod.metadata.name = Some("test-pod".to_string());
pods.create(&PostParams::default(), &pod).await?;Modules§
- discovery
- Resource discovery information from Kubernetes API
- gen
- Auto-generated code from Kubernetes metadata
- interceptor
- Interceptors for customizing client behavior during testing
- label_
selector - Label selector parsing and matching for filtering Kubernetes resources
- registry
- Resource registry for custom resource definitions (CRDs)
- validator
Structs§
- Client
- Client for connecting with a Kubernetes cluster.
- Client
Builder - Builder for creating fake clients