k8s_openapi_ext/get/
statefulset.rs1use super::*;
2
3pub trait StatefulSetGetExt {
4 fn spec(&self) -> Option<&appsv1::StatefulSetSpec>;
5
6 fn status(&self) -> Option<&appsv1::StatefulSetStatus>;
7
8 fn ordinals(&self) -> Option<i32> {
10 self.spec()?.ordinals.as_ref()?.start
11 }
12
13 fn pod_management_policy(&self) -> Option<&str> {
14 self.spec()?.pod_management_policy.as_deref()
15 }
16
17 fn revision_history_limit(&self) -> Option<i32> {
18 self.spec()?.revision_history_limit
19 }
20
21 fn service_name(&self) -> Option<&str> {
22 self.spec()?.service_name.as_deref()
23 }
24
25 fn spec_replicas(&self) -> Option<i32> {
26 self.spec()?.replicas
27 }
28
29 fn min_ready_seconds(&self) -> Option<i32> {
30 self.spec()?.min_ready_seconds
31 }
32
33 fn available_replicas(&self) -> Option<i32> {
35 self.status()?.available_replicas
36 }
37
38 fn collision_count(&self) -> Option<i32> {
42 self.status()?.collision_count
43 }
44
45 fn conditions(&self) -> Option<&[appsv1::StatefulSetCondition]> {
47 self.status()?.conditions.as_deref()
48 }
49
50 fn current_replicas(&self) -> Option<i32> {
52 self.status()?.current_replicas
53 }
54
55 fn current_revision(&self) -> Option<&str> {
57 self.status()?.current_revision.as_deref()
58 }
59
60 fn observed_generation(&self) -> Option<i64> {
63 self.status()?.observed_generation
64 }
65
66 fn ready_replicas(&self) -> Option<i32> {
68 self.status()?.ready_replicas
69 }
70
71 fn status_replicas(&self) -> i32 {
73 self.status()
74 .map(|status| status.replicas)
75 .unwrap_or_default()
76 }
77
78 fn update_revision(&self) -> Option<&str> {
80 self.status()?.update_revision.as_deref()
81 }
82
83 fn updated_replicas(&self) -> Option<i32> {
85 self.status()?.updated_replicas
86 }
87}
88
89impl StatefulSetGetExt for appsv1::StatefulSet {
90 fn spec(&self) -> Option<&appsv1::StatefulSetSpec> {
91 self.spec.as_ref()
92 }
93
94 fn status(&self) -> Option<&appsv1::StatefulSetStatus> {
95 self.status.as_ref()
96 }
97}