|
3 | 3 | use k8s_openapi::api::apps::v1::ReplicaSet; |
4 | 4 | use k8s_openapi::api::batch::v1::{CronJob, CronJobSpec, Job}; |
5 | 5 | use k8s_openapi::api::core::v1::{ |
6 | | - Container, Namespace, Node, PersistentVolumeClaim, PersistentVolumeClaimSpec, |
7 | | - PersistentVolumeClaimStatus, Pod, PodSpec, VolumeResourceRequirements, |
| 6 | + Container, Namespace, Node, NodeAddress, NodeStatus, NodeSystemInfo, PersistentVolumeClaim, |
| 7 | + PersistentVolumeClaimSpec, PersistentVolumeClaimStatus, Pod, PodSpec, |
| 8 | + VolumeResourceRequirements, |
8 | 9 | }; |
9 | 10 | use k8s_openapi::apimachinery::pkg::api::resource::Quantity; |
10 | 11 | use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference, Time}; |
@@ -103,6 +104,43 @@ pub fn node(name: &str) -> Node { |
103 | 104 | } |
104 | 105 | } |
105 | 106 |
|
| 107 | +pub fn node_prefilled(name: &str) -> Node { |
| 108 | + let timestamp: Timestamp = "2026-08-07 15:22:45-04".parse().unwrap(); |
| 109 | + let mut node = node(name); |
| 110 | + node.metadata.creation_timestamp = Some(Time(timestamp)); |
| 111 | + node.metadata.labels = Some(BTreeMap::from([ |
| 112 | + (s("kubernetes.io/hostname"), name.to_string()), |
| 113 | + (s("kubernetes.io/arch"), s("amd64")), |
| 114 | + ])); |
| 115 | + node.metadata.annotations = Some(BTreeMap::from([ |
| 116 | + (s("example.com/cool-animal"), s("monkeys")), |
| 117 | + (s("checkmk.com/promote-to-host"), s("true")), |
| 118 | + ])); |
| 119 | + node.status = Some(NodeStatus { |
| 120 | + addresses: Some(vec![ |
| 121 | + NodeAddress { |
| 122 | + address: s("10.0.0.5"), |
| 123 | + type_: s("InternalIP"), |
| 124 | + }, |
| 125 | + NodeAddress { |
| 126 | + address: name.to_string(), |
| 127 | + type_: s("Hostname"), |
| 128 | + }, |
| 129 | + ]), |
| 130 | + node_info: Some(NodeSystemInfo { |
| 131 | + architecture: s("amd64"), |
| 132 | + container_runtime_version: s("containerd://1.7.24"), |
| 133 | + kernel_version: s("6.8.0-51-generic"), |
| 134 | + kubelet_version: s("v1.34.0"), |
| 135 | + operating_system: s("linux"), |
| 136 | + os_image: s("Ubuntu 22.04.5 LTS"), |
| 137 | + ..Default::default() |
| 138 | + }), |
| 139 | + ..Default::default() |
| 140 | + }); |
| 141 | + node |
| 142 | +} |
| 143 | + |
106 | 144 | pub fn owner_ref(kind: &str, name: &str, uid: &str) -> OwnerReference { |
107 | 145 | OwnerReference { |
108 | 146 | kind: kind.into(), |
|
0 commit comments