syncable-cli 0.37.1

A Rust-based CLI that analyzes code repositories and generates Infrastructure as Code configurations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
//! Kubernetes object wrappers for linting.

use crate::analyzer::kubelint::types::ObjectKind;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

/// Metadata about a parsed Kubernetes object.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ObjectMetadata {
    /// The file path where this object was defined.
    pub file_path: PathBuf,
    /// The raw YAML content (for error reporting).
    pub raw: Option<Vec<u8>>,
    /// Line number in the source file (1-indexed).
    pub line_number: Option<u32>,
}

impl ObjectMetadata {
    /// Create new metadata for an object from a file.
    pub fn from_file(path: impl Into<PathBuf>) -> Self {
        Self {
            file_path: path.into(),
            raw: None,
            line_number: None,
        }
    }

    /// Set the raw content.
    pub fn with_raw(mut self, raw: Vec<u8>) -> Self {
        self.raw = Some(raw);
        self
    }

    /// Set the line number.
    pub fn with_line(mut self, line: u32) -> Self {
        self.line_number = Some(line);
        self
    }
}

/// A parsed Kubernetes object ready for linting.
#[derive(Debug, Clone)]
pub struct Object {
    /// Metadata about where this object came from.
    pub metadata: ObjectMetadata,
    /// The Kubernetes object data.
    pub k8s_object: K8sObject,
}

impl Object {
    /// Create a new object.
    pub fn new(metadata: ObjectMetadata, k8s_object: K8sObject) -> Self {
        Self {
            metadata,
            k8s_object,
        }
    }

    /// Get the object's kind.
    pub fn kind(&self) -> ObjectKind {
        self.k8s_object.kind()
    }

    /// Get the object's name.
    pub fn name(&self) -> &str {
        self.k8s_object.name()
    }

    /// Get the object's namespace.
    pub fn namespace(&self) -> Option<&str> {
        self.k8s_object.namespace()
    }

    /// Get annotations from the object.
    pub fn annotations(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        self.k8s_object.annotations()
    }
}

/// An object that failed to parse.
#[derive(Debug, Clone)]
pub struct InvalidObject {
    /// Metadata about where this object came from.
    pub metadata: ObjectMetadata,
    /// The error that occurred during parsing.
    pub load_err: String,
}

impl InvalidObject {
    /// Create a new invalid object record.
    pub fn new(metadata: ObjectMetadata, error: impl Into<String>) -> Self {
        Self {
            metadata,
            load_err: error.into(),
        }
    }
}

/// Enum representing all supported Kubernetes object types.
///
/// This enum provides type-safe access to K8s objects while also
/// supporting unknown/custom types via the Unknown variant.
#[derive(Debug, Clone)]
pub enum K8sObject {
    // Workloads
    Deployment(Box<DeploymentData>),
    StatefulSet(Box<StatefulSetData>),
    DaemonSet(Box<DaemonSetData>),
    ReplicaSet(Box<ReplicaSetData>),
    Pod(Box<PodData>),
    Job(Box<JobData>),
    CronJob(Box<CronJobData>),

    // Services & Networking
    Service(Box<ServiceData>),
    Ingress(Box<IngressData>),
    NetworkPolicy(Box<NetworkPolicyData>),

    // RBAC
    Role(Box<RoleData>),
    ClusterRole(Box<ClusterRoleData>),
    RoleBinding(Box<RoleBindingData>),
    ClusterRoleBinding(Box<ClusterRoleBindingData>),
    ServiceAccount(Box<ServiceAccountData>),

    // Scaling
    HorizontalPodAutoscaler(Box<HpaData>),
    PodDisruptionBudget(Box<PdbData>),

    // Storage
    PersistentVolumeClaim(Box<PvcData>),

    // Unknown/CRD
    Unknown(Box<UnknownObject>),
}

impl K8sObject {
    /// Get the object kind.
    pub fn kind(&self) -> ObjectKind {
        match self {
            Self::Deployment(_) => ObjectKind::Deployment,
            Self::StatefulSet(_) => ObjectKind::StatefulSet,
            Self::DaemonSet(_) => ObjectKind::DaemonSet,
            Self::ReplicaSet(_) => ObjectKind::ReplicaSet,
            Self::Pod(_) => ObjectKind::Pod,
            Self::Job(_) => ObjectKind::Job,
            Self::CronJob(_) => ObjectKind::CronJob,
            Self::Service(_) => ObjectKind::Service,
            Self::Ingress(_) => ObjectKind::Ingress,
            Self::NetworkPolicy(_) => ObjectKind::NetworkPolicy,
            Self::Role(_) => ObjectKind::Role,
            Self::ClusterRole(_) => ObjectKind::ClusterRole,
            Self::RoleBinding(_) => ObjectKind::RoleBinding,
            Self::ClusterRoleBinding(_) => ObjectKind::ClusterRoleBinding,
            Self::ServiceAccount(_) => ObjectKind::ServiceAccount,
            Self::HorizontalPodAutoscaler(_) => ObjectKind::HorizontalPodAutoscaler,
            Self::PodDisruptionBudget(_) => ObjectKind::PodDisruptionBudget,
            Self::PersistentVolumeClaim(_) => ObjectKind::PersistentVolumeClaim,
            Self::Unknown(_) => ObjectKind::Any,
        }
    }

    /// Get the object name.
    pub fn name(&self) -> &str {
        match self {
            Self::Deployment(d) => &d.name,
            Self::StatefulSet(d) => &d.name,
            Self::DaemonSet(d) => &d.name,
            Self::ReplicaSet(d) => &d.name,
            Self::Pod(d) => &d.name,
            Self::Job(d) => &d.name,
            Self::CronJob(d) => &d.name,
            Self::Service(d) => &d.name,
            Self::Ingress(d) => &d.name,
            Self::NetworkPolicy(d) => &d.name,
            Self::Role(d) => &d.name,
            Self::ClusterRole(d) => &d.name,
            Self::RoleBinding(d) => &d.name,
            Self::ClusterRoleBinding(d) => &d.name,
            Self::ServiceAccount(d) => &d.name,
            Self::HorizontalPodAutoscaler(d) => &d.name,
            Self::PodDisruptionBudget(d) => &d.name,
            Self::PersistentVolumeClaim(d) => &d.name,
            Self::Unknown(d) => &d.name,
        }
    }

    /// Get the object namespace.
    pub fn namespace(&self) -> Option<&str> {
        match self {
            Self::Deployment(d) => d.namespace.as_deref(),
            Self::StatefulSet(d) => d.namespace.as_deref(),
            Self::DaemonSet(d) => d.namespace.as_deref(),
            Self::ReplicaSet(d) => d.namespace.as_deref(),
            Self::Pod(d) => d.namespace.as_deref(),
            Self::Job(d) => d.namespace.as_deref(),
            Self::CronJob(d) => d.namespace.as_deref(),
            Self::Service(d) => d.namespace.as_deref(),
            Self::Ingress(d) => d.namespace.as_deref(),
            Self::NetworkPolicy(d) => d.namespace.as_deref(),
            Self::Role(d) => d.namespace.as_deref(),
            Self::ClusterRole(_) => None, // Cluster-scoped
            Self::RoleBinding(d) => d.namespace.as_deref(),
            Self::ClusterRoleBinding(_) => None, // Cluster-scoped
            Self::ServiceAccount(d) => d.namespace.as_deref(),
            Self::HorizontalPodAutoscaler(d) => d.namespace.as_deref(),
            Self::PodDisruptionBudget(d) => d.namespace.as_deref(),
            Self::PersistentVolumeClaim(d) => d.namespace.as_deref(),
            Self::Unknown(d) => d.namespace.as_deref(),
        }
    }

    /// Get annotations from the object.
    pub fn annotations(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        match self {
            Self::Deployment(d) => d.annotations.as_ref(),
            Self::StatefulSet(d) => d.annotations.as_ref(),
            Self::DaemonSet(d) => d.annotations.as_ref(),
            Self::ReplicaSet(d) => d.annotations.as_ref(),
            Self::Pod(d) => d.annotations.as_ref(),
            Self::Job(d) => d.annotations.as_ref(),
            Self::CronJob(d) => d.annotations.as_ref(),
            Self::Service(d) => d.annotations.as_ref(),
            Self::Ingress(d) => d.annotations.as_ref(),
            Self::NetworkPolicy(d) => d.annotations.as_ref(),
            Self::Role(d) => d.annotations.as_ref(),
            Self::ClusterRole(d) => d.annotations.as_ref(),
            Self::RoleBinding(d) => d.annotations.as_ref(),
            Self::ClusterRoleBinding(d) => d.annotations.as_ref(),
            Self::ServiceAccount(d) => d.annotations.as_ref(),
            Self::HorizontalPodAutoscaler(d) => d.annotations.as_ref(),
            Self::PodDisruptionBudget(d) => d.annotations.as_ref(),
            Self::PersistentVolumeClaim(d) => d.annotations.as_ref(),
            Self::Unknown(d) => d.annotations.as_ref(),
        }
    }
}

// ============================================================================
// Data structures for each K8s object type
// These are simplified representations; full k8s-openapi types will be used
// in the actual implementation
// ============================================================================

/// Common metadata fields.
#[derive(Debug, Clone, Default)]
pub struct CommonMeta {
    pub name: String,
    pub namespace: Option<String>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
}

/// Simplified container spec.
#[derive(Debug, Clone, Default)]
pub struct ContainerSpec {
    pub name: String,
    pub image: Option<String>,
    pub security_context: Option<SecurityContext>,
    pub resources: Option<ResourceRequirements>,
    pub liveness_probe: Option<Probe>,
    pub readiness_probe: Option<Probe>,
    pub startup_probe: Option<Probe>,
    pub env: Vec<EnvVar>,
    pub volume_mounts: Vec<VolumeMount>,
    pub ports: Vec<ContainerPort>,
}

/// Security context for containers/pods.
#[derive(Debug, Clone, Default)]
pub struct SecurityContext {
    pub privileged: Option<bool>,
    pub allow_privilege_escalation: Option<bool>,
    pub run_as_non_root: Option<bool>,
    pub run_as_user: Option<i64>,
    pub read_only_root_filesystem: Option<bool>,
    pub capabilities: Option<Capabilities>,
    pub proc_mount: Option<String>,
}

/// Linux capabilities.
#[derive(Debug, Clone, Default)]
pub struct Capabilities {
    pub add: Vec<String>,
    pub drop: Vec<String>,
}

/// Resource requirements.
#[derive(Debug, Clone, Default)]
pub struct ResourceRequirements {
    pub limits: Option<std::collections::BTreeMap<String, String>>,
    pub requests: Option<std::collections::BTreeMap<String, String>>,
}

/// Probe configuration.
#[derive(Debug, Clone, Default)]
pub struct Probe {
    pub http_get: Option<HttpGetAction>,
    pub tcp_socket: Option<TcpSocketAction>,
    pub exec: Option<ExecAction>,
}

#[derive(Debug, Clone, Default)]
pub struct HttpGetAction {
    pub port: i32,
    pub path: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct TcpSocketAction {
    pub port: i32,
}

#[derive(Debug, Clone, Default)]
pub struct ExecAction {
    pub command: Vec<String>,
}

/// Environment variable.
#[derive(Debug, Clone, Default)]
pub struct EnvVar {
    pub name: String,
    pub value: Option<String>,
    pub value_from: Option<EnvVarSource>,
}

#[derive(Debug, Clone)]
pub enum EnvVarSource {
    SecretKeyRef { name: String, key: String },
    ConfigMapKeyRef { name: String, key: String },
    FieldRef { field_path: String },
}

/// Volume mount.
#[derive(Debug, Clone, Default)]
pub struct VolumeMount {
    pub name: String,
    pub mount_path: String,
    pub read_only: Option<bool>,
}

/// Container port.
#[derive(Debug, Clone, Default)]
pub struct ContainerPort {
    pub container_port: i32,
    pub protocol: Option<String>,
    pub host_port: Option<i32>,
}

/// Pod spec (simplified).
#[derive(Debug, Clone, Default)]
pub struct PodSpec {
    pub containers: Vec<ContainerSpec>,
    pub init_containers: Vec<ContainerSpec>,
    pub volumes: Vec<Volume>,
    pub service_account_name: Option<String>,
    pub host_network: Option<bool>,
    pub host_pid: Option<bool>,
    pub host_ipc: Option<bool>,
    pub security_context: Option<PodSecurityContext>,
    pub affinity: Option<Affinity>,
    pub dns_config: Option<DnsConfig>,
    pub restart_policy: Option<String>,
    pub priority_class_name: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct PodSecurityContext {
    pub run_as_non_root: Option<bool>,
    pub run_as_user: Option<i64>,
    pub sysctls: Vec<Sysctl>,
}

#[derive(Debug, Clone, Default)]
pub struct Sysctl {
    pub name: String,
    pub value: String,
}

#[derive(Debug, Clone, Default)]
pub struct Volume {
    pub name: String,
    pub host_path: Option<HostPathVolumeSource>,
    pub secret: Option<SecretVolumeSource>,
}

#[derive(Debug, Clone, Default)]
pub struct HostPathVolumeSource {
    pub path: String,
    pub type_: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct SecretVolumeSource {
    pub secret_name: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct Affinity {
    pub pod_anti_affinity: Option<PodAntiAffinity>,
    pub node_affinity: Option<NodeAffinity>,
}

#[derive(Debug, Clone, Default)]
pub struct PodAntiAffinity {
    pub required_during_scheduling_ignored_during_execution: Vec<PodAffinityTerm>,
    pub preferred_during_scheduling_ignored_during_execution: Vec<WeightedPodAffinityTerm>,
}

#[derive(Debug, Clone, Default)]
pub struct PodAffinityTerm {
    pub topology_key: String,
}

#[derive(Debug, Clone, Default)]
pub struct WeightedPodAffinityTerm {
    pub weight: i32,
    pub pod_affinity_term: PodAffinityTerm,
}

#[derive(Debug, Clone, Default)]
pub struct NodeAffinity {
    pub required_during_scheduling_ignored_during_execution: Option<NodeSelector>,
}

#[derive(Debug, Clone, Default)]
pub struct NodeSelector {
    pub node_selector_terms: Vec<NodeSelectorTerm>,
}

#[derive(Debug, Clone, Default)]
pub struct NodeSelectorTerm {
    pub match_expressions: Vec<NodeSelectorRequirement>,
}

#[derive(Debug, Clone, Default)]
pub struct NodeSelectorRequirement {
    pub key: String,
    pub operator: String,
    pub values: Vec<String>,
}

#[derive(Debug, Clone, Default)]
pub struct DnsConfig {
    pub options: Vec<PodDnsConfigOption>,
}

#[derive(Debug, Clone, Default)]
pub struct PodDnsConfigOption {
    pub name: Option<String>,
    pub value: Option<String>,
}

// ============================================================================
// Object data types
// ============================================================================

#[derive(Debug, Clone, Default)]
pub struct DeploymentData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub replicas: Option<i32>,
    pub selector: Option<LabelSelector>,
    pub pod_spec: Option<PodSpec>,
    pub strategy: Option<DeploymentStrategy>,
}

#[derive(Debug, Clone, Default)]
pub struct LabelSelector {
    pub match_labels: Option<std::collections::BTreeMap<String, String>>,
}

#[derive(Debug, Clone, Default)]
pub struct DeploymentStrategy {
    pub type_: Option<String>,
    pub rolling_update: Option<RollingUpdateDeployment>,
}

#[derive(Debug, Clone, Default)]
pub struct RollingUpdateDeployment {
    pub max_unavailable: Option<String>,
    pub max_surge: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct StatefulSetData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub replicas: Option<i32>,
    pub selector: Option<LabelSelector>,
    pub pod_spec: Option<PodSpec>,
}

#[derive(Debug, Clone, Default)]
pub struct DaemonSetData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub selector: Option<LabelSelector>,
    pub pod_spec: Option<PodSpec>,
    pub update_strategy: Option<DaemonSetUpdateStrategy>,
}

#[derive(Debug, Clone, Default)]
pub struct DaemonSetUpdateStrategy {
    pub type_: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct ReplicaSetData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub replicas: Option<i32>,
    pub selector: Option<LabelSelector>,
    pub pod_spec: Option<PodSpec>,
}

#[derive(Debug, Clone, Default)]
pub struct PodData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub spec: Option<PodSpec>,
}

#[derive(Debug, Clone, Default)]
pub struct JobData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub pod_spec: Option<PodSpec>,
    pub ttl_seconds_after_finished: Option<i32>,
}

#[derive(Debug, Clone, Default)]
pub struct CronJobData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub job_spec: Option<JobData>,
}

#[derive(Debug, Clone, Default)]
pub struct ServiceData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub selector: Option<std::collections::BTreeMap<String, String>>,
    pub ports: Vec<ServicePort>,
    pub type_: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct ServicePort {
    pub port: i32,
    pub target_port: Option<String>,
    pub protocol: Option<String>,
    pub name: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct IngressData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub rules: Vec<IngressRule>,
}

#[derive(Debug, Clone, Default)]
pub struct IngressRule {
    pub host: Option<String>,
    pub http: Option<HttpIngressRuleValue>,
}

#[derive(Debug, Clone, Default)]
pub struct HttpIngressRuleValue {
    pub paths: Vec<HttpIngressPath>,
}

#[derive(Debug, Clone, Default)]
pub struct HttpIngressPath {
    pub path: Option<String>,
    pub backend: IngressBackend,
}

#[derive(Debug, Clone, Default)]
pub struct IngressBackend {
    pub service: Option<IngressServiceBackend>,
}

#[derive(Debug, Clone, Default)]
pub struct IngressServiceBackend {
    pub name: String,
    pub port: Option<ServiceBackendPort>,
}

#[derive(Debug, Clone, Default)]
pub struct ServiceBackendPort {
    pub number: Option<i32>,
    pub name: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct NetworkPolicyData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub pod_selector: Option<LabelSelector>,
}

#[derive(Debug, Clone, Default)]
pub struct RoleData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub rules: Vec<PolicyRule>,
}

#[derive(Debug, Clone, Default)]
pub struct ClusterRoleData {
    pub name: String,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub rules: Vec<PolicyRule>,
}

#[derive(Debug, Clone, Default)]
pub struct PolicyRule {
    pub api_groups: Vec<String>,
    pub resources: Vec<String>,
    pub verbs: Vec<String>,
}

#[derive(Debug, Clone, Default)]
pub struct RoleBindingData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub role_ref: RoleRef,
    pub subjects: Vec<Subject>,
}

#[derive(Debug, Clone, Default)]
pub struct ClusterRoleBindingData {
    pub name: String,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub role_ref: RoleRef,
    pub subjects: Vec<Subject>,
}

#[derive(Debug, Clone, Default)]
pub struct RoleRef {
    pub api_group: String,
    pub kind: String,
    pub name: String,
}

#[derive(Debug, Clone, Default)]
pub struct Subject {
    pub kind: String,
    pub name: String,
    pub namespace: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct ServiceAccountData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
}

#[derive(Debug, Clone, Default)]
pub struct HpaData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub min_replicas: Option<i32>,
    pub max_replicas: i32,
    pub scale_target_ref: CrossVersionObjectReference,
}

#[derive(Debug, Clone, Default)]
pub struct CrossVersionObjectReference {
    pub api_version: Option<String>,
    pub kind: String,
    pub name: String,
}

#[derive(Debug, Clone, Default)]
pub struct PdbData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub min_available: Option<String>,
    pub max_unavailable: Option<String>,
    pub selector: Option<LabelSelector>,
    pub unhealthy_pod_eviction_policy: Option<String>,
}

#[derive(Debug, Clone, Default)]
pub struct PvcData {
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
}

#[derive(Debug, Clone, Default)]
pub struct UnknownObject {
    pub api_version: String,
    pub kind: String,
    pub name: String,
    pub namespace: Option<String>,
    pub annotations: Option<std::collections::BTreeMap<String, String>>,
    pub labels: Option<std::collections::BTreeMap<String, String>>,
    pub raw: serde_yaml::Value,
}