rkubectl_kubeapi/
version.rs1use super::*;
2
3k8s_openapi::k8s_if_1_30! {
4 const K8S_VERSION: &str = "1.30";
5}
6k8s_openapi::k8s_if_1_31! {
7 const K8S_VERSION: &str = "1.31";
8}
9k8s_openapi::k8s_if_1_32! {
10 const K8S_VERSION: &str = "1.32";
11}
12k8s_openapi::k8s_if_1_33! {
13 const K8S_VERSION: &str = "1.33";
14}
15k8s_openapi::k8s_if_1_34! {
16 const K8S_VERSION: &str = "1.34";
17}
18impl Kubeapi {
23 pub async fn version(&self) -> kube::Result<String> {
24 let info = self.client()?.apiserver_version().await?;
25 let text = [
26 format!("Client k8s version: {K8S_VERSION}"),
27 format!("Server k8s version: {}.{}", info.major, info.minor),
28 format!("Server git version: {}", info.git_version),
29 format!("Server git commit: {}", info.git_commit),
30 ]
31 .join("\n");
32
33 Ok(text)
34 }
35}