Skip to main content

k8s_crds_cloud_native_pg/
clusters.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium -f clusters.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
3// kopium version: 0.24.1
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
9    pub use kube_derive::CustomResource;
10    #[cfg(feature = "schemars")]
11    pub use schemars::JsonSchema;
12    pub use serde::{Deserialize, Serialize};
13    pub use std::collections::BTreeMap;
14    #[cfg(feature = "builder")]
15    pub use typed_builder::TypedBuilder;
16}
17
18use self::prelude::*;
19
20/// Specification of the desired behavior of the cluster.
21/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
22#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
23#[cfg_attr(feature = "builder", derive(TypedBuilder))]
24#[cfg_attr(feature = "schemars", derive(JsonSchema))]
25#[cfg_attr(not(feature = "schemars"), kube(schema = "disabled"))]
26#[kube(
27    group = "postgresql.cnpg.io",
28    version = "v1",
29    kind = "Cluster",
30    plural = "clusters"
31)]
32#[kube(namespaced)]
33#[kube(status = "ClusterStatus")]
34#[kube(derive = "Default")]
35#[kube(derive = "PartialEq")]
36pub struct ClusterSpec {
37    /// Affinity/Anti-affinity rules for Pods
38    #[serde(default, skip_serializing_if = "Option::is_none")]
39    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
40    pub affinity: Option<ClusterAffinity>,
41    /// The configuration to be used for backups
42    #[serde(default, skip_serializing_if = "Option::is_none")]
43    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
44    pub backup: Option<ClusterBackup>,
45    /// Instructions to bootstrap this cluster
46    #[serde(default, skip_serializing_if = "Option::is_none")]
47    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
48    pub bootstrap: Option<ClusterBootstrap>,
49    /// The configuration for the CA and related certificates
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
52    pub certificates: Option<ClusterCertificates>,
53    /// Description of this PostgreSQL cluster
54    #[serde(default, skip_serializing_if = "Option::is_none")]
55    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
56    pub description: Option<String>,
57    /// Manage the `PodDisruptionBudget` resources within the cluster. When
58    /// configured as `true` (default setting), the pod disruption budgets
59    /// will safeguard the primary node from being terminated. Conversely,
60    /// setting it to `false` will result in the absence of any
61    /// `PodDisruptionBudget` resource, permitting the shutdown of all nodes
62    /// hosting the PostgreSQL cluster. This latter configuration is
63    /// advisable for any PostgreSQL cluster employed for
64    /// development/staging purposes.
65    #[serde(default, skip_serializing_if = "Option::is_none", rename = "enablePDB")]
66    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
67    pub enable_pdb: Option<bool>,
68    /// When this option is enabled, the operator will use the `SuperuserSecret`
69    /// to update the `postgres` user password (if the secret is
70    /// not present, the operator will automatically create one). When this
71    /// option is disabled, the operator will ignore the `SuperuserSecret` content, delete
72    /// it when automatically created, and then blank the password of the `postgres`
73    /// user by setting it to `NULL`. Disabled by default.
74    #[serde(
75        default,
76        skip_serializing_if = "Option::is_none",
77        rename = "enableSuperuserAccess"
78    )]
79    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
80    pub enable_superuser_access: Option<bool>,
81    /// Env follows the Env format to pass environment variables
82    /// to the pods created in the cluster
83    #[serde(default, skip_serializing_if = "Option::is_none")]
84    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
85    pub env: Option<Vec<ClusterEnv>>,
86    /// EnvFrom follows the EnvFrom format to pass environment variables
87    /// sources to the pods to be used by Env
88    #[serde(default, skip_serializing_if = "Option::is_none", rename = "envFrom")]
89    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
90    pub env_from: Option<Vec<ClusterEnvFrom>>,
91    /// EphemeralVolumeSource allows the user to configure the source of ephemeral volumes.
92    #[serde(
93        default,
94        skip_serializing_if = "Option::is_none",
95        rename = "ephemeralVolumeSource"
96    )]
97    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
98    pub ephemeral_volume_source: Option<ClusterEphemeralVolumeSource>,
99    /// EphemeralVolumesSizeLimit allows the user to set the limits for the ephemeral
100    /// volumes
101    #[serde(
102        default,
103        skip_serializing_if = "Option::is_none",
104        rename = "ephemeralVolumesSizeLimit"
105    )]
106    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
107    pub ephemeral_volumes_size_limit: Option<ClusterEphemeralVolumesSizeLimit>,
108    /// The list of external clusters which are used in the configuration
109    #[serde(
110        default,
111        skip_serializing_if = "Option::is_none",
112        rename = "externalClusters"
113    )]
114    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
115    pub external_clusters: Option<Vec<ClusterExternalClusters>>,
116    /// The amount of time (in seconds) to wait before triggering a failover
117    /// after the primary PostgreSQL instance in the cluster was detected
118    /// to be unhealthy
119    #[serde(
120        default,
121        skip_serializing_if = "Option::is_none",
122        rename = "failoverDelay"
123    )]
124    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
125    pub failover_delay: Option<i32>,
126    /// Defines the major PostgreSQL version we want to use within an ImageCatalog
127    #[serde(
128        default,
129        skip_serializing_if = "Option::is_none",
130        rename = "imageCatalogRef"
131    )]
132    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
133    pub image_catalog_ref: Option<ClusterImageCatalogRef>,
134    /// Name of the container image, supporting both tags (`<image>:<tag>`)
135    /// and digests for deterministic and repeatable deployments
136    /// (`<image>:<tag>@sha256:<digestValue>`)
137    #[serde(default, skip_serializing_if = "Option::is_none", rename = "imageName")]
138    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
139    pub image_name: Option<String>,
140    /// Image pull policy.
141    /// One of `Always`, `Never` or `IfNotPresent`.
142    /// If not defined, it defaults to `IfNotPresent`.
143    /// Cannot be updated.
144    /// More info: <https://kubernetes.io/docs/concepts/containers/images#updating-images>
145    #[serde(
146        default,
147        skip_serializing_if = "Option::is_none",
148        rename = "imagePullPolicy"
149    )]
150    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
151    pub image_pull_policy: Option<String>,
152    /// The list of pull secrets to be used to pull the images
153    #[serde(
154        default,
155        skip_serializing_if = "Option::is_none",
156        rename = "imagePullSecrets"
157    )]
158    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
159    pub image_pull_secrets: Option<Vec<ClusterImagePullSecrets>>,
160    /// Metadata that will be inherited by all objects related to the Cluster
161    #[serde(
162        default,
163        skip_serializing_if = "Option::is_none",
164        rename = "inheritedMetadata"
165    )]
166    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
167    pub inherited_metadata: Option<ClusterInheritedMetadata>,
168    /// Number of instances required in the cluster
169    pub instances: i64,
170    /// LivenessProbeTimeout is the time (in seconds) that is allowed for a PostgreSQL instance
171    /// to successfully respond to the liveness probe (default 30).
172    /// The Liveness probe failure threshold is derived from this value using the formula:
173    /// ceiling(livenessProbe / 10).
174    #[serde(
175        default,
176        skip_serializing_if = "Option::is_none",
177        rename = "livenessProbeTimeout"
178    )]
179    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
180    pub liveness_probe_timeout: Option<i32>,
181    /// The instances' log level, one of the following values: error, warning, info (default), debug, trace
182    #[serde(default, skip_serializing_if = "Option::is_none", rename = "logLevel")]
183    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
184    pub log_level: Option<ClusterLogLevel>,
185    /// The configuration that is used by the portions of PostgreSQL that are managed by the instance manager
186    #[serde(default, skip_serializing_if = "Option::is_none")]
187    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
188    pub managed: Option<ClusterManaged>,
189    /// The target value for the synchronous replication quorum, that can be
190    /// decreased if the number of ready standbys is lower than this.
191    /// Undefined or 0 disable synchronous replication.
192    #[serde(
193        default,
194        skip_serializing_if = "Option::is_none",
195        rename = "maxSyncReplicas"
196    )]
197    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
198    pub max_sync_replicas: Option<i64>,
199    /// Minimum number of instances required in synchronous replication with the
200    /// primary. Undefined or 0 allow writes to complete when no standby is
201    /// available.
202    #[serde(
203        default,
204        skip_serializing_if = "Option::is_none",
205        rename = "minSyncReplicas"
206    )]
207    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
208    pub min_sync_replicas: Option<i64>,
209    /// The configuration of the monitoring infrastructure of this cluster
210    #[serde(default, skip_serializing_if = "Option::is_none")]
211    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
212    pub monitoring: Option<ClusterMonitoring>,
213    /// Define a maintenance window for the Kubernetes nodes
214    #[serde(
215        default,
216        skip_serializing_if = "Option::is_none",
217        rename = "nodeMaintenanceWindow"
218    )]
219    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
220    pub node_maintenance_window: Option<ClusterNodeMaintenanceWindow>,
221    /// The plugins configuration, containing
222    /// any plugin to be loaded with the corresponding configuration
223    #[serde(default, skip_serializing_if = "Option::is_none")]
224    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
225    pub plugins: Option<Vec<ClusterPlugins>>,
226    /// Override the PodSecurityContext applied to every Pod of the cluster.
227    /// When set, this overrides the operator's default PodSecurityContext for the cluster.
228    /// If omitted, the operator defaults are used.
229    /// This field doesn't have any effect if SecurityContextConstraints are present.
230    #[serde(
231        default,
232        skip_serializing_if = "Option::is_none",
233        rename = "podSecurityContext"
234    )]
235    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
236    pub pod_security_context: Option<ClusterPodSecurityContext>,
237    /// PodSelectorRefs defines named pod label selectors that can be referenced
238    /// in pg_hba rules using the ${podselector:NAME} syntax in the address field.
239    /// The operator resolves matching pod IPs and the instance manager expands
240    /// pg_hba lines accordingly. Only pods in the Cluster's own namespace are considered.
241    #[serde(
242        default,
243        skip_serializing_if = "Option::is_none",
244        rename = "podSelectorRefs"
245    )]
246    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
247    pub pod_selector_refs: Option<Vec<ClusterPodSelectorRefs>>,
248    /// The GID of the `postgres` user inside the image, defaults to `26`
249    #[serde(
250        default,
251        skip_serializing_if = "Option::is_none",
252        rename = "postgresGID"
253    )]
254    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
255    pub postgres_gid: Option<i64>,
256    /// The UID of the `postgres` user inside the image, defaults to `26`
257    #[serde(
258        default,
259        skip_serializing_if = "Option::is_none",
260        rename = "postgresUID"
261    )]
262    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
263    pub postgres_uid: Option<i64>,
264    /// Configuration of the PostgreSQL server
265    #[serde(default, skip_serializing_if = "Option::is_none")]
266    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
267    pub postgresql: Option<ClusterPostgresql>,
268    /// Configuration of the Kubernetes `Lease` used to coordinate safe primary
269    /// election within the cluster. When omitted, the operator applies built-in
270    /// defaults; tune these values only if you understand the consequences for
271    /// failover timing.
272    #[serde(
273        default,
274        skip_serializing_if = "Option::is_none",
275        rename = "primaryLease"
276    )]
277    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
278    pub primary_lease: Option<ClusterPrimaryLease>,
279    /// Method to follow to upgrade the primary server during a rolling
280    /// update procedure, after all replicas have been successfully updated:
281    /// it can be with a switchover (`switchover`) or in-place (`restart` - default).
282    /// Note: when using `switchover`, the operator will reject updates that change both
283    /// the image name and PostgreSQL configuration parameters simultaneously to avoid
284    /// configuration mismatches during the switchover process.
285    #[serde(
286        default,
287        skip_serializing_if = "Option::is_none",
288        rename = "primaryUpdateMethod"
289    )]
290    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
291    pub primary_update_method: Option<ClusterPrimaryUpdateMethod>,
292    /// Deployment strategy to follow to upgrade the primary server during a rolling
293    /// update procedure, after all replicas have been successfully updated:
294    /// it can be automated (`unsupervised` - default) or manual (`supervised`)
295    #[serde(
296        default,
297        skip_serializing_if = "Option::is_none",
298        rename = "primaryUpdateStrategy"
299    )]
300    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
301    pub primary_update_strategy: Option<ClusterPrimaryUpdateStrategy>,
302    /// Name of the priority class which will be used in every generated Pod, if the PriorityClass
303    /// specified does not exist, the pod will not be able to schedule.  Please refer to
304    /// <https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass>
305    /// for more information
306    #[serde(
307        default,
308        skip_serializing_if = "Option::is_none",
309        rename = "priorityClassName"
310    )]
311    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
312    pub priority_class_name: Option<String>,
313    /// The configuration of the probes to be injected
314    /// in the PostgreSQL Pods.
315    #[serde(default, skip_serializing_if = "Option::is_none")]
316    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
317    pub probes: Option<ClusterProbes>,
318    /// Template to be used to define projected volumes, projected volumes will be mounted
319    /// under `/projected` base folder
320    #[serde(
321        default,
322        skip_serializing_if = "Option::is_none",
323        rename = "projectedVolumeTemplate"
324    )]
325    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
326    pub projected_volume_template: Option<ClusterProjectedVolumeTemplate>,
327    /// Replica cluster configuration
328    #[serde(default, skip_serializing_if = "Option::is_none")]
329    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
330    pub replica: Option<ClusterReplica>,
331    /// Replication slots management configuration
332    #[serde(
333        default,
334        skip_serializing_if = "Option::is_none",
335        rename = "replicationSlots"
336    )]
337    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
338    pub replication_slots: Option<ClusterReplicationSlots>,
339    /// Resources requirements of every generated Pod. Please refer to
340    /// <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
341    /// for more information.
342    #[serde(default, skip_serializing_if = "Option::is_none")]
343    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
344    pub resources: Option<ClusterResources>,
345    /// If specified, the pod will be dispatched by specified Kubernetes
346    /// scheduler. If not specified, the pod will be dispatched by the default
347    /// scheduler. More info:
348    /// <https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/>
349    #[serde(
350        default,
351        skip_serializing_if = "Option::is_none",
352        rename = "schedulerName"
353    )]
354    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
355    pub scheduler_name: Option<String>,
356    /// The SeccompProfile applied to every Pod and Container.
357    /// Defaults to: `RuntimeDefault`
358    #[serde(
359        default,
360        skip_serializing_if = "Option::is_none",
361        rename = "seccompProfile"
362    )]
363    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
364    pub seccomp_profile: Option<ClusterSeccompProfile>,
365    /// Override the SecurityContext applied to every Container in the Pod of the cluster.
366    /// When set, this overrides the operator's default Container SecurityContext.
367    /// If omitted, the operator defaults are used.
368    #[serde(
369        default,
370        skip_serializing_if = "Option::is_none",
371        rename = "securityContext"
372    )]
373    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
374    pub security_context: Option<ClusterSecurityContext>,
375    /// Name of an existing ServiceAccount in the same namespace to use for the cluster.
376    /// When specified, the operator will not create a new ServiceAccount
377    /// but will use the provided one. This is useful for sharing a single
378    /// ServiceAccount across multiple clusters (e.g., for cloud IAM configurations).
379    /// If not specified, a ServiceAccount will be created with the cluster name.
380    /// Mutually exclusive with ServiceAccountTemplate.
381    #[serde(
382        default,
383        skip_serializing_if = "Option::is_none",
384        rename = "serviceAccountName"
385    )]
386    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
387    pub service_account_name: Option<String>,
388    /// Configure the generation of the service account
389    #[serde(
390        default,
391        skip_serializing_if = "Option::is_none",
392        rename = "serviceAccountTemplate"
393    )]
394    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
395    pub service_account_template: Option<ClusterServiceAccountTemplate>,
396    /// The time in seconds that controls the window of time reserved for the smart shutdown of Postgres to complete.
397    /// Make sure you reserve enough time for the operator to request a fast shutdown of Postgres
398    /// (that is: `stopDelay` - `smartShutdownTimeout`). Default is 180 seconds.
399    #[serde(
400        default,
401        skip_serializing_if = "Option::is_none",
402        rename = "smartShutdownTimeout"
403    )]
404    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
405    pub smart_shutdown_timeout: Option<i32>,
406    /// The time in seconds that is allowed for a PostgreSQL instance to
407    /// successfully start up (default 3600).
408    /// The startup probe failure threshold is derived from this value using the formula:
409    /// ceiling(startDelay / 10).
410    #[serde(
411        default,
412        skip_serializing_if = "Option::is_none",
413        rename = "startDelay"
414    )]
415    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
416    pub start_delay: Option<i32>,
417    /// The time in seconds that is allowed for a PostgreSQL instance to
418    /// gracefully shutdown (default 1800)
419    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stopDelay")]
420    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
421    pub stop_delay: Option<i32>,
422    /// Configuration of the storage of the instances
423    #[serde(default, skip_serializing_if = "Option::is_none")]
424    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
425    pub storage: Option<ClusterStorage>,
426    /// The secret containing the superuser password. If not defined a new
427    /// secret will be created with a randomly generated password
428    #[serde(
429        default,
430        skip_serializing_if = "Option::is_none",
431        rename = "superuserSecret"
432    )]
433    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
434    pub superuser_secret: Option<ClusterSuperuserSecret>,
435    /// The time in seconds that is allowed for a primary PostgreSQL instance
436    /// to gracefully shutdown during a switchover.
437    /// Default value is 3600 seconds (1 hour).
438    #[serde(
439        default,
440        skip_serializing_if = "Option::is_none",
441        rename = "switchoverDelay"
442    )]
443    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
444    pub switchover_delay: Option<i32>,
445    /// The tablespaces configuration
446    #[serde(default, skip_serializing_if = "Option::is_none")]
447    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
448    pub tablespaces: Option<Vec<ClusterTablespaces>>,
449    /// TopologySpreadConstraints specifies how to spread matching pods among the given topology.
450    /// More info:
451    /// <https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/>
452    #[serde(
453        default,
454        skip_serializing_if = "Option::is_none",
455        rename = "topologySpreadConstraints"
456    )]
457    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
458    pub topology_spread_constraints: Option<Vec<ClusterTopologySpreadConstraints>>,
459    /// Configuration of the storage for PostgreSQL WAL (Write-Ahead Log)
460    #[serde(
461        default,
462        skip_serializing_if = "Option::is_none",
463        rename = "walStorage"
464    )]
465    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
466    pub wal_storage: Option<ClusterWalStorage>,
467}
468
469/// Affinity/Anti-affinity rules for Pods
470#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
471#[cfg_attr(feature = "builder", derive(TypedBuilder))]
472#[cfg_attr(feature = "schemars", derive(JsonSchema))]
473pub struct ClusterAffinity {
474    /// AdditionalPodAffinity allows to specify pod affinity terms to be passed to all the cluster's pods.
475    #[serde(
476        default,
477        skip_serializing_if = "Option::is_none",
478        rename = "additionalPodAffinity"
479    )]
480    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
481    pub additional_pod_affinity: Option<ClusterAffinityAdditionalPodAffinity>,
482    /// AdditionalPodAntiAffinity allows to specify pod anti-affinity terms to be added to the ones generated
483    /// by the operator if EnablePodAntiAffinity is set to true (default) or to be used exclusively if set to false.
484    #[serde(
485        default,
486        skip_serializing_if = "Option::is_none",
487        rename = "additionalPodAntiAffinity"
488    )]
489    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
490    pub additional_pod_anti_affinity: Option<ClusterAffinityAdditionalPodAntiAffinity>,
491    /// Activates anti-affinity for the pods. The operator will define pods
492    /// anti-affinity unless this field is explicitly set to false
493    #[serde(
494        default,
495        skip_serializing_if = "Option::is_none",
496        rename = "enablePodAntiAffinity"
497    )]
498    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
499    pub enable_pod_anti_affinity: Option<bool>,
500    /// NodeAffinity describes node affinity scheduling rules for the pod.
501    /// More info: <https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity>
502    #[serde(
503        default,
504        skip_serializing_if = "Option::is_none",
505        rename = "nodeAffinity"
506    )]
507    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
508    pub node_affinity: Option<ClusterAffinityNodeAffinity>,
509    /// NodeSelector is map of key-value pairs used to define the nodes on which
510    /// the pods can run.
511    /// More info: <https://kubernetes.io/docs/concepts/configuration/assign-pod-node/>
512    #[serde(
513        default,
514        skip_serializing_if = "Option::is_none",
515        rename = "nodeSelector"
516    )]
517    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
518    pub node_selector: Option<BTreeMap<String, String>>,
519    /// PodAntiAffinityType allows the user to decide whether pod anti-affinity between cluster instance has to be
520    /// considered a strong requirement during scheduling or not. Allowed values are: "preferred" (default if empty) or
521    /// "required". Setting it to "required", could lead to instances remaining pending until new kubernetes nodes are
522    /// added if all the existing nodes don't match the required pod anti-affinity rule.
523    /// More info:
524    /// <https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity>
525    #[serde(
526        default,
527        skip_serializing_if = "Option::is_none",
528        rename = "podAntiAffinityType"
529    )]
530    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
531    pub pod_anti_affinity_type: Option<String>,
532    /// Tolerations is a list of Tolerations that should be set for all the pods, in order to allow them to run
533    /// on tainted nodes.
534    /// More info: <https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/>
535    #[serde(default, skip_serializing_if = "Option::is_none")]
536    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
537    pub tolerations: Option<Vec<ClusterAffinityTolerations>>,
538    /// TopologyKey to use for anti-affinity configuration. See k8s documentation
539    /// for more info on that
540    #[serde(
541        default,
542        skip_serializing_if = "Option::is_none",
543        rename = "topologyKey"
544    )]
545    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
546    pub topology_key: Option<String>,
547}
548
549/// AdditionalPodAffinity allows to specify pod affinity terms to be passed to all the cluster's pods.
550#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
551#[cfg_attr(feature = "builder", derive(TypedBuilder))]
552#[cfg_attr(feature = "schemars", derive(JsonSchema))]
553pub struct ClusterAffinityAdditionalPodAffinity {
554    /// The scheduler will prefer to schedule pods to nodes that satisfy
555    /// the affinity expressions specified by this field, but it may choose
556    /// a node that violates one or more of the expressions. The node that is
557    /// most preferred is the one with the greatest sum of weights, i.e.
558    /// for each node that meets all of the scheduling requirements (resource
559    /// request, requiredDuringScheduling affinity expressions, etc.),
560    /// compute a sum by iterating through the elements of this field and adding
561    /// "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
562    /// node(s) with the highest sum are the most preferred.
563    #[serde(
564        default,
565        skip_serializing_if = "Option::is_none",
566        rename = "preferredDuringSchedulingIgnoredDuringExecution"
567    )]
568    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
569    pub preferred_during_scheduling_ignored_during_execution: Option<
570        Vec<ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecution>,
571    >,
572    /// If the affinity requirements specified by this field are not met at
573    /// scheduling time, the pod will not be scheduled onto the node.
574    /// If the affinity requirements specified by this field cease to be met
575    /// at some point during pod execution (e.g. due to a pod label update), the
576    /// system may or may not try to eventually evict the pod from its node.
577    /// When there are multiple elements, the lists of nodes corresponding to each
578    /// podAffinityTerm are intersected, i.e. all terms must be satisfied.
579    #[serde(
580        default,
581        skip_serializing_if = "Option::is_none",
582        rename = "requiredDuringSchedulingIgnoredDuringExecution"
583    )]
584    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
585    pub required_during_scheduling_ignored_during_execution: Option<
586        Vec<ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecution>,
587    >,
588}
589
590/// The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)
591#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
592#[cfg_attr(feature = "builder", derive(TypedBuilder))]
593#[cfg_attr(feature = "schemars", derive(JsonSchema))]
594pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecution {
595    /// Required. A pod affinity term, associated with the corresponding weight.
596    #[serde(rename = "podAffinityTerm")]
597    pub pod_affinity_term: ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm,
598    /// weight associated with matching the corresponding podAffinityTerm,
599    /// in the range 1-100.
600    pub weight: i32,
601}
602
603/// Required. A pod affinity term, associated with the corresponding weight.
604#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
605#[cfg_attr(feature = "builder", derive(TypedBuilder))]
606#[cfg_attr(feature = "schemars", derive(JsonSchema))]
607pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm {
608    /// A label query over a set of resources, in this case pods.
609    /// If it's null, this PodAffinityTerm matches with no Pods.
610    #[serde(default, skip_serializing_if = "Option::is_none", rename = "labelSelector")]
611#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
612    pub label_selector: Option<ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelector>,
613    /// MatchLabelKeys is a set of pod label keys to select which pods will
614    /// be taken into consideration. The keys are used to lookup values from the
615    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
616    /// to select the group of existing pods which pods will be taken into consideration
617    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
618    /// pod labels will be ignored. The default value is empty.
619    /// The same key is forbidden to exist in both matchLabelKeys and labelSelector.
620    /// Also, matchLabelKeys cannot be set when labelSelector isn't set.
621    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabelKeys")]
622#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
623    pub match_label_keys: Option<Vec<String>>,
624    /// MismatchLabelKeys is a set of pod label keys to select which pods will
625    /// be taken into consideration. The keys are used to lookup values from the
626    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
627    /// to select the group of existing pods which pods will be taken into consideration
628    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
629    /// pod labels will be ignored. The default value is empty.
630    /// The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
631    /// Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
632    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mismatchLabelKeys")]
633#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
634    pub mismatch_label_keys: Option<Vec<String>>,
635    /// A label query over the set of namespaces that the term applies to.
636    /// The term is applied to the union of the namespaces selected by this field
637    /// and the ones listed in the namespaces field.
638    /// null selector and null or empty namespaces list means "this pod's namespace".
639    /// An empty selector ({}) matches all namespaces.
640    #[serde(default, skip_serializing_if = "Option::is_none", rename = "namespaceSelector")]
641#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
642    pub namespace_selector: Option<ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelector>,
643    /// namespaces specifies a static list of namespace names that the term applies to.
644    /// The term is applied to the union of the namespaces listed in this field
645    /// and the ones selected by namespaceSelector.
646    /// null or empty namespaces list and null namespaceSelector means "this pod's namespace".
647    #[serde(default, skip_serializing_if = "Option::is_none")]
648#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
649    pub namespaces: Option<Vec<String>>,
650    /// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
651    /// the labelSelector in the specified namespaces, where co-located is defined as running on a node
652    /// whose value of the label with key topologyKey matches that of any node on which any of the
653    /// selected pods is running.
654    /// Empty topologyKey is not allowed.
655    #[serde(rename = "topologyKey")]
656    pub topology_key: String,
657}
658
659/// A label query over a set of resources, in this case pods.
660/// If it's null, this PodAffinityTerm matches with no Pods.
661#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
662#[cfg_attr(feature = "builder", derive(TypedBuilder))]
663#[cfg_attr(feature = "schemars", derive(JsonSchema))]
664pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelector {
665    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
666    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
667#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
668    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressions>>,
669    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
670    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
671    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
672    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
673#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
674    pub match_labels: Option<BTreeMap<String, String>>,
675}
676
677/// A label selector requirement is a selector that contains values, a key, and an operator that
678/// relates the key and values.
679#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
680#[cfg_attr(feature = "builder", derive(TypedBuilder))]
681#[cfg_attr(feature = "schemars", derive(JsonSchema))]
682pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressions
683{
684    /// key is the label key that the selector applies to.
685    pub key: String,
686    /// operator represents a key's relationship to a set of values.
687    /// Valid operators are In, NotIn, Exists and DoesNotExist.
688    pub operator: String,
689    /// values is an array of string values. If the operator is In or NotIn,
690    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
691    /// the values array must be empty. This array is replaced during a strategic
692    /// merge patch.
693    #[serde(default, skip_serializing_if = "Option::is_none")]
694    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
695    pub values: Option<Vec<String>>,
696}
697
698/// A label query over the set of namespaces that the term applies to.
699/// The term is applied to the union of the namespaces selected by this field
700/// and the ones listed in the namespaces field.
701/// null selector and null or empty namespaces list means "this pod's namespace".
702/// An empty selector ({}) matches all namespaces.
703#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
704#[cfg_attr(feature = "builder", derive(TypedBuilder))]
705#[cfg_attr(feature = "schemars", derive(JsonSchema))]
706pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelector {
707    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
708    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
709#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
710    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelectorMatchExpressions>>,
711    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
712    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
713    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
714    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
715#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
716    pub match_labels: Option<BTreeMap<String, String>>,
717}
718
719/// A label selector requirement is a selector that contains values, a key, and an operator that
720/// relates the key and values.
721#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
722#[cfg_attr(feature = "builder", derive(TypedBuilder))]
723#[cfg_attr(feature = "schemars", derive(JsonSchema))]
724pub struct ClusterAffinityAdditionalPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelectorMatchExpressions
725{
726    /// key is the label key that the selector applies to.
727    pub key: String,
728    /// operator represents a key's relationship to a set of values.
729    /// Valid operators are In, NotIn, Exists and DoesNotExist.
730    pub operator: String,
731    /// values is an array of string values. If the operator is In or NotIn,
732    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
733    /// the values array must be empty. This array is replaced during a strategic
734    /// merge patch.
735    #[serde(default, skip_serializing_if = "Option::is_none")]
736    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
737    pub values: Option<Vec<String>>,
738}
739
740/// Defines a set of pods (namely those matching the labelSelector
741/// relative to the given namespace(s)) that this pod should be
742/// co-located (affinity) or not co-located (anti-affinity) with,
743/// where co-located is defined as running on a node whose value of
744/// the label with key <topologyKey> matches that of any node on which
745/// a pod of the set of pods is running
746#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
747#[cfg_attr(feature = "builder", derive(TypedBuilder))]
748#[cfg_attr(feature = "schemars", derive(JsonSchema))]
749pub struct ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecution {
750    /// A label query over a set of resources, in this case pods.
751    /// If it's null, this PodAffinityTerm matches with no Pods.
752    #[serde(default, skip_serializing_if = "Option::is_none", rename = "labelSelector")]
753#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
754    pub label_selector: Option<ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelector>,
755    /// MatchLabelKeys is a set of pod label keys to select which pods will
756    /// be taken into consideration. The keys are used to lookup values from the
757    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
758    /// to select the group of existing pods which pods will be taken into consideration
759    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
760    /// pod labels will be ignored. The default value is empty.
761    /// The same key is forbidden to exist in both matchLabelKeys and labelSelector.
762    /// Also, matchLabelKeys cannot be set when labelSelector isn't set.
763    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabelKeys")]
764#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
765    pub match_label_keys: Option<Vec<String>>,
766    /// MismatchLabelKeys is a set of pod label keys to select which pods will
767    /// be taken into consideration. The keys are used to lookup values from the
768    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
769    /// to select the group of existing pods which pods will be taken into consideration
770    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
771    /// pod labels will be ignored. The default value is empty.
772    /// The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
773    /// Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
774    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mismatchLabelKeys")]
775#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
776    pub mismatch_label_keys: Option<Vec<String>>,
777    /// A label query over the set of namespaces that the term applies to.
778    /// The term is applied to the union of the namespaces selected by this field
779    /// and the ones listed in the namespaces field.
780    /// null selector and null or empty namespaces list means "this pod's namespace".
781    /// An empty selector ({}) matches all namespaces.
782    #[serde(default, skip_serializing_if = "Option::is_none", rename = "namespaceSelector")]
783#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
784    pub namespace_selector: Option<ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelector>,
785    /// namespaces specifies a static list of namespace names that the term applies to.
786    /// The term is applied to the union of the namespaces listed in this field
787    /// and the ones selected by namespaceSelector.
788    /// null or empty namespaces list and null namespaceSelector means "this pod's namespace".
789    #[serde(default, skip_serializing_if = "Option::is_none")]
790#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
791    pub namespaces: Option<Vec<String>>,
792    /// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
793    /// the labelSelector in the specified namespaces, where co-located is defined as running on a node
794    /// whose value of the label with key topologyKey matches that of any node on which any of the
795    /// selected pods is running.
796    /// Empty topologyKey is not allowed.
797    #[serde(rename = "topologyKey")]
798    pub topology_key: String,
799}
800
801/// A label query over a set of resources, in this case pods.
802/// If it's null, this PodAffinityTerm matches with no Pods.
803#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
804#[cfg_attr(feature = "builder", derive(TypedBuilder))]
805#[cfg_attr(feature = "schemars", derive(JsonSchema))]
806pub struct ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelector {
807    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
808    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
809#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
810    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelectorMatchExpressions>>,
811    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
812    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
813    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
814    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
815#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
816    pub match_labels: Option<BTreeMap<String, String>>,
817}
818
819/// A label selector requirement is a selector that contains values, a key, and an operator that
820/// relates the key and values.
821#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
822#[cfg_attr(feature = "builder", derive(TypedBuilder))]
823#[cfg_attr(feature = "schemars", derive(JsonSchema))]
824pub struct ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelectorMatchExpressions
825{
826    /// key is the label key that the selector applies to.
827    pub key: String,
828    /// operator represents a key's relationship to a set of values.
829    /// Valid operators are In, NotIn, Exists and DoesNotExist.
830    pub operator: String,
831    /// values is an array of string values. If the operator is In or NotIn,
832    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
833    /// the values array must be empty. This array is replaced during a strategic
834    /// merge patch.
835    #[serde(default, skip_serializing_if = "Option::is_none")]
836    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
837    pub values: Option<Vec<String>>,
838}
839
840/// A label query over the set of namespaces that the term applies to.
841/// The term is applied to the union of the namespaces selected by this field
842/// and the ones listed in the namespaces field.
843/// null selector and null or empty namespaces list means "this pod's namespace".
844/// An empty selector ({}) matches all namespaces.
845#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
846#[cfg_attr(feature = "builder", derive(TypedBuilder))]
847#[cfg_attr(feature = "schemars", derive(JsonSchema))]
848pub struct ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelector {
849    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
850    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
851#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
852    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelectorMatchExpressions>>,
853    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
854    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
855    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
856    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
857#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
858    pub match_labels: Option<BTreeMap<String, String>>,
859}
860
861/// A label selector requirement is a selector that contains values, a key, and an operator that
862/// relates the key and values.
863#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
864#[cfg_attr(feature = "builder", derive(TypedBuilder))]
865#[cfg_attr(feature = "schemars", derive(JsonSchema))]
866pub struct ClusterAffinityAdditionalPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelectorMatchExpressions
867{
868    /// key is the label key that the selector applies to.
869    pub key: String,
870    /// operator represents a key's relationship to a set of values.
871    /// Valid operators are In, NotIn, Exists and DoesNotExist.
872    pub operator: String,
873    /// values is an array of string values. If the operator is In or NotIn,
874    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
875    /// the values array must be empty. This array is replaced during a strategic
876    /// merge patch.
877    #[serde(default, skip_serializing_if = "Option::is_none")]
878    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
879    pub values: Option<Vec<String>>,
880}
881
882/// AdditionalPodAntiAffinity allows to specify pod anti-affinity terms to be added to the ones generated
883/// by the operator if EnablePodAntiAffinity is set to true (default) or to be used exclusively if set to false.
884#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
885#[cfg_attr(feature = "builder", derive(TypedBuilder))]
886#[cfg_attr(feature = "schemars", derive(JsonSchema))]
887pub struct ClusterAffinityAdditionalPodAntiAffinity {
888    /// The scheduler will prefer to schedule pods to nodes that satisfy
889    /// the anti-affinity expressions specified by this field, but it may choose
890    /// a node that violates one or more of the expressions. The node that is
891    /// most preferred is the one with the greatest sum of weights, i.e.
892    /// for each node that meets all of the scheduling requirements (resource
893    /// request, requiredDuringScheduling anti-affinity expressions, etc.),
894    /// compute a sum by iterating through the elements of this field and subtracting
895    /// "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
896    /// node(s) with the highest sum are the most preferred.
897    #[serde(
898        default,
899        skip_serializing_if = "Option::is_none",
900        rename = "preferredDuringSchedulingIgnoredDuringExecution"
901    )]
902    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
903    pub preferred_during_scheduling_ignored_during_execution: Option<
904        Vec<
905            ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecution,
906        >,
907    >,
908    /// If the anti-affinity requirements specified by this field are not met at
909    /// scheduling time, the pod will not be scheduled onto the node.
910    /// If the anti-affinity requirements specified by this field cease to be met
911    /// at some point during pod execution (e.g. due to a pod label update), the
912    /// system may or may not try to eventually evict the pod from its node.
913    /// When there are multiple elements, the lists of nodes corresponding to each
914    /// podAffinityTerm are intersected, i.e. all terms must be satisfied.
915    #[serde(
916        default,
917        skip_serializing_if = "Option::is_none",
918        rename = "requiredDuringSchedulingIgnoredDuringExecution"
919    )]
920    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
921    pub required_during_scheduling_ignored_during_execution: Option<
922        Vec<ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecution>,
923    >,
924}
925
926/// The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)
927#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
928#[cfg_attr(feature = "builder", derive(TypedBuilder))]
929#[cfg_attr(feature = "schemars", derive(JsonSchema))]
930pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecution {
931    /// Required. A pod affinity term, associated with the corresponding weight.
932    #[serde(rename = "podAffinityTerm")]
933    pub pod_affinity_term: ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm,
934    /// weight associated with matching the corresponding podAffinityTerm,
935    /// in the range 1-100.
936    pub weight: i32,
937}
938
939/// Required. A pod affinity term, associated with the corresponding weight.
940#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
941#[cfg_attr(feature = "builder", derive(TypedBuilder))]
942#[cfg_attr(feature = "schemars", derive(JsonSchema))]
943pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm {
944    /// A label query over a set of resources, in this case pods.
945    /// If it's null, this PodAffinityTerm matches with no Pods.
946    #[serde(default, skip_serializing_if = "Option::is_none", rename = "labelSelector")]
947#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
948    pub label_selector: Option<ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelector>,
949    /// MatchLabelKeys is a set of pod label keys to select which pods will
950    /// be taken into consideration. The keys are used to lookup values from the
951    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
952    /// to select the group of existing pods which pods will be taken into consideration
953    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
954    /// pod labels will be ignored. The default value is empty.
955    /// The same key is forbidden to exist in both matchLabelKeys and labelSelector.
956    /// Also, matchLabelKeys cannot be set when labelSelector isn't set.
957    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabelKeys")]
958#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
959    pub match_label_keys: Option<Vec<String>>,
960    /// MismatchLabelKeys is a set of pod label keys to select which pods will
961    /// be taken into consideration. The keys are used to lookup values from the
962    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
963    /// to select the group of existing pods which pods will be taken into consideration
964    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
965    /// pod labels will be ignored. The default value is empty.
966    /// The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
967    /// Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
968    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mismatchLabelKeys")]
969#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
970    pub mismatch_label_keys: Option<Vec<String>>,
971    /// A label query over the set of namespaces that the term applies to.
972    /// The term is applied to the union of the namespaces selected by this field
973    /// and the ones listed in the namespaces field.
974    /// null selector and null or empty namespaces list means "this pod's namespace".
975    /// An empty selector ({}) matches all namespaces.
976    #[serde(default, skip_serializing_if = "Option::is_none", rename = "namespaceSelector")]
977#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
978    pub namespace_selector: Option<ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelector>,
979    /// namespaces specifies a static list of namespace names that the term applies to.
980    /// The term is applied to the union of the namespaces listed in this field
981    /// and the ones selected by namespaceSelector.
982    /// null or empty namespaces list and null namespaceSelector means "this pod's namespace".
983    #[serde(default, skip_serializing_if = "Option::is_none")]
984#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
985    pub namespaces: Option<Vec<String>>,
986    /// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
987    /// the labelSelector in the specified namespaces, where co-located is defined as running on a node
988    /// whose value of the label with key topologyKey matches that of any node on which any of the
989    /// selected pods is running.
990    /// Empty topologyKey is not allowed.
991    #[serde(rename = "topologyKey")]
992    pub topology_key: String,
993}
994
995/// A label query over a set of resources, in this case pods.
996/// If it's null, this PodAffinityTerm matches with no Pods.
997#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
998#[cfg_attr(feature = "builder", derive(TypedBuilder))]
999#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1000pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelector {
1001    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
1002    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1003#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1004    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressions>>,
1005    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1006    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
1007    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
1008    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
1009#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1010    pub match_labels: Option<BTreeMap<String, String>>,
1011}
1012
1013/// A label selector requirement is a selector that contains values, a key, and an operator that
1014/// relates the key and values.
1015#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1016#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1017#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1018pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressions
1019{
1020    /// key is the label key that the selector applies to.
1021    pub key: String,
1022    /// operator represents a key's relationship to a set of values.
1023    /// Valid operators are In, NotIn, Exists and DoesNotExist.
1024    pub operator: String,
1025    /// values is an array of string values. If the operator is In or NotIn,
1026    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1027    /// the values array must be empty. This array is replaced during a strategic
1028    /// merge patch.
1029    #[serde(default, skip_serializing_if = "Option::is_none")]
1030    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1031    pub values: Option<Vec<String>>,
1032}
1033
1034/// A label query over the set of namespaces that the term applies to.
1035/// The term is applied to the union of the namespaces selected by this field
1036/// and the ones listed in the namespaces field.
1037/// null selector and null or empty namespaces list means "this pod's namespace".
1038/// An empty selector ({}) matches all namespaces.
1039#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1040#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1041#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1042pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelector {
1043    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
1044    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1045#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1046    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelectorMatchExpressions>>,
1047    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1048    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
1049    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
1050    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
1051#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1052    pub match_labels: Option<BTreeMap<String, String>>,
1053}
1054
1055/// A label selector requirement is a selector that contains values, a key, and an operator that
1056/// relates the key and values.
1057#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1058#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1059#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1060pub struct ClusterAffinityAdditionalPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermNamespaceSelectorMatchExpressions
1061{
1062    /// key is the label key that the selector applies to.
1063    pub key: String,
1064    /// operator represents a key's relationship to a set of values.
1065    /// Valid operators are In, NotIn, Exists and DoesNotExist.
1066    pub operator: String,
1067    /// values is an array of string values. If the operator is In or NotIn,
1068    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1069    /// the values array must be empty. This array is replaced during a strategic
1070    /// merge patch.
1071    #[serde(default, skip_serializing_if = "Option::is_none")]
1072    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1073    pub values: Option<Vec<String>>,
1074}
1075
1076/// Defines a set of pods (namely those matching the labelSelector
1077/// relative to the given namespace(s)) that this pod should be
1078/// co-located (affinity) or not co-located (anti-affinity) with,
1079/// where co-located is defined as running on a node whose value of
1080/// the label with key <topologyKey> matches that of any node on which
1081/// a pod of the set of pods is running
1082#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1083#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1084#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1085pub struct ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecution {
1086    /// A label query over a set of resources, in this case pods.
1087    /// If it's null, this PodAffinityTerm matches with no Pods.
1088    #[serde(default, skip_serializing_if = "Option::is_none", rename = "labelSelector")]
1089#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1090    pub label_selector: Option<ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelector>,
1091    /// MatchLabelKeys is a set of pod label keys to select which pods will
1092    /// be taken into consideration. The keys are used to lookup values from the
1093    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
1094    /// to select the group of existing pods which pods will be taken into consideration
1095    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
1096    /// pod labels will be ignored. The default value is empty.
1097    /// The same key is forbidden to exist in both matchLabelKeys and labelSelector.
1098    /// Also, matchLabelKeys cannot be set when labelSelector isn't set.
1099    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabelKeys")]
1100#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1101    pub match_label_keys: Option<Vec<String>>,
1102    /// MismatchLabelKeys is a set of pod label keys to select which pods will
1103    /// be taken into consideration. The keys are used to lookup values from the
1104    /// incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
1105    /// to select the group of existing pods which pods will be taken into consideration
1106    /// for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
1107    /// pod labels will be ignored. The default value is empty.
1108    /// The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
1109    /// Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
1110    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mismatchLabelKeys")]
1111#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1112    pub mismatch_label_keys: Option<Vec<String>>,
1113    /// A label query over the set of namespaces that the term applies to.
1114    /// The term is applied to the union of the namespaces selected by this field
1115    /// and the ones listed in the namespaces field.
1116    /// null selector and null or empty namespaces list means "this pod's namespace".
1117    /// An empty selector ({}) matches all namespaces.
1118    #[serde(default, skip_serializing_if = "Option::is_none", rename = "namespaceSelector")]
1119#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1120    pub namespace_selector: Option<ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelector>,
1121    /// namespaces specifies a static list of namespace names that the term applies to.
1122    /// The term is applied to the union of the namespaces listed in this field
1123    /// and the ones selected by namespaceSelector.
1124    /// null or empty namespaces list and null namespaceSelector means "this pod's namespace".
1125    #[serde(default, skip_serializing_if = "Option::is_none")]
1126#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1127    pub namespaces: Option<Vec<String>>,
1128    /// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
1129    /// the labelSelector in the specified namespaces, where co-located is defined as running on a node
1130    /// whose value of the label with key topologyKey matches that of any node on which any of the
1131    /// selected pods is running.
1132    /// Empty topologyKey is not allowed.
1133    #[serde(rename = "topologyKey")]
1134    pub topology_key: String,
1135}
1136
1137/// A label query over a set of resources, in this case pods.
1138/// If it's null, this PodAffinityTerm matches with no Pods.
1139#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1140#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1141#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1142pub struct ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelector {
1143    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
1144    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1145#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1146    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelectorMatchExpressions>>,
1147    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1148    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
1149    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
1150    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
1151#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1152    pub match_labels: Option<BTreeMap<String, String>>,
1153}
1154
1155/// A label selector requirement is a selector that contains values, a key, and an operator that
1156/// relates the key and values.
1157#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1158#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1159#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1160pub struct ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionLabelSelectorMatchExpressions
1161{
1162    /// key is the label key that the selector applies to.
1163    pub key: String,
1164    /// operator represents a key's relationship to a set of values.
1165    /// Valid operators are In, NotIn, Exists and DoesNotExist.
1166    pub operator: String,
1167    /// values is an array of string values. If the operator is In or NotIn,
1168    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1169    /// the values array must be empty. This array is replaced during a strategic
1170    /// merge patch.
1171    #[serde(default, skip_serializing_if = "Option::is_none")]
1172    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1173    pub values: Option<Vec<String>>,
1174}
1175
1176/// A label query over the set of namespaces that the term applies to.
1177/// The term is applied to the union of the namespaces selected by this field
1178/// and the ones listed in the namespaces field.
1179/// null selector and null or empty namespaces list means "this pod's namespace".
1180/// An empty selector ({}) matches all namespaces.
1181#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1182#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1183#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1184pub struct ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelector {
1185    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
1186    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1187#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1188    pub match_expressions: Option<Vec<ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelectorMatchExpressions>>,
1189    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1190    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
1191    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
1192    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
1193#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1194    pub match_labels: Option<BTreeMap<String, String>>,
1195}
1196
1197/// A label selector requirement is a selector that contains values, a key, and an operator that
1198/// relates the key and values.
1199#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1200#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1201#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1202pub struct ClusterAffinityAdditionalPodAntiAffinityRequiredDuringSchedulingIgnoredDuringExecutionNamespaceSelectorMatchExpressions
1203{
1204    /// key is the label key that the selector applies to.
1205    pub key: String,
1206    /// operator represents a key's relationship to a set of values.
1207    /// Valid operators are In, NotIn, Exists and DoesNotExist.
1208    pub operator: String,
1209    /// values is an array of string values. If the operator is In or NotIn,
1210    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1211    /// the values array must be empty. This array is replaced during a strategic
1212    /// merge patch.
1213    #[serde(default, skip_serializing_if = "Option::is_none")]
1214    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1215    pub values: Option<Vec<String>>,
1216}
1217
1218/// NodeAffinity describes node affinity scheduling rules for the pod.
1219/// More info: <https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity>
1220#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1221#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1222#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1223pub struct ClusterAffinityNodeAffinity {
1224    /// The scheduler will prefer to schedule pods to nodes that satisfy
1225    /// the affinity expressions specified by this field, but it may choose
1226    /// a node that violates one or more of the expressions. The node that is
1227    /// most preferred is the one with the greatest sum of weights, i.e.
1228    /// for each node that meets all of the scheduling requirements (resource
1229    /// request, requiredDuringScheduling affinity expressions, etc.),
1230    /// compute a sum by iterating through the elements of this field and adding
1231    /// "weight" to the sum if the node matches the corresponding matchExpressions; the
1232    /// node(s) with the highest sum are the most preferred.
1233    #[serde(
1234        default,
1235        skip_serializing_if = "Option::is_none",
1236        rename = "preferredDuringSchedulingIgnoredDuringExecution"
1237    )]
1238    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1239    pub preferred_during_scheduling_ignored_during_execution:
1240        Option<Vec<ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecution>>,
1241    /// If the affinity requirements specified by this field are not met at
1242    /// scheduling time, the pod will not be scheduled onto the node.
1243    /// If the affinity requirements specified by this field cease to be met
1244    /// at some point during pod execution (e.g. due to an update), the system
1245    /// may or may not try to eventually evict the pod from its node.
1246    #[serde(
1247        default,
1248        skip_serializing_if = "Option::is_none",
1249        rename = "requiredDuringSchedulingIgnoredDuringExecution"
1250    )]
1251    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1252    pub required_during_scheduling_ignored_during_execution:
1253        Option<ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution>,
1254}
1255
1256/// An empty preferred scheduling term matches all objects with implicit weight 0
1257/// (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).
1258#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1259#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1260#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1261pub struct ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecution {
1262    /// A node selector term, associated with the corresponding weight.
1263    pub preference:
1264        ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreference,
1265    /// Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
1266    pub weight: i32,
1267}
1268
1269/// A node selector term, associated with the corresponding weight.
1270#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1271#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1272#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1273pub struct ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreference {
1274    /// A list of node selector requirements by node's labels.
1275    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1276#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1277    pub match_expressions: Option<Vec<ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchExpressions>>,
1278    /// A list of node selector requirements by node's fields.
1279    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchFields")]
1280#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1281    pub match_fields: Option<Vec<ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchFields>>,
1282}
1283
1284/// A node selector requirement is a selector that contains values, a key, and an operator
1285/// that relates the key and values.
1286#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1287#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1288#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1289pub struct ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchExpressions
1290{
1291    /// The label key that the selector applies to.
1292    pub key: String,
1293    /// Represents a key's relationship to a set of values.
1294    /// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
1295    pub operator: String,
1296    /// An array of string values. If the operator is In or NotIn,
1297    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1298    /// the values array must be empty. If the operator is Gt or Lt, the values
1299    /// array must have a single element, which will be interpreted as an integer.
1300    /// This array is replaced during a strategic merge patch.
1301    #[serde(default, skip_serializing_if = "Option::is_none")]
1302    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1303    pub values: Option<Vec<String>>,
1304}
1305
1306/// A node selector requirement is a selector that contains values, a key, and an operator
1307/// that relates the key and values.
1308#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1309#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1310#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1311pub struct ClusterAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchFields
1312{
1313    /// The label key that the selector applies to.
1314    pub key: String,
1315    /// Represents a key's relationship to a set of values.
1316    /// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
1317    pub operator: String,
1318    /// An array of string values. If the operator is In or NotIn,
1319    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1320    /// the values array must be empty. If the operator is Gt or Lt, the values
1321    /// array must have a single element, which will be interpreted as an integer.
1322    /// This array is replaced during a strategic merge patch.
1323    #[serde(default, skip_serializing_if = "Option::is_none")]
1324    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1325    pub values: Option<Vec<String>>,
1326}
1327
1328/// If the affinity requirements specified by this field are not met at
1329/// scheduling time, the pod will not be scheduled onto the node.
1330/// If the affinity requirements specified by this field cease to be met
1331/// at some point during pod execution (e.g. due to an update), the system
1332/// may or may not try to eventually evict the pod from its node.
1333#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1334#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1335#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1336pub struct ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution {
1337    /// Required. A list of node selector terms. The terms are ORed.
1338    #[serde(rename = "nodeSelectorTerms")]
1339    #[cfg_attr(feature = "builder", builder(default))]
1340    pub node_selector_terms: Vec<
1341        ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTerms,
1342    >,
1343}
1344
1345/// A null or empty node selector term matches no objects. The requirements of
1346/// them are ANDed.
1347/// The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.
1348#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1349#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1350#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1351pub struct ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTerms {
1352    /// A list of node selector requirements by node's labels.
1353    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
1354#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1355    pub match_expressions: Option<Vec<ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchExpressions>>,
1356    /// A list of node selector requirements by node's fields.
1357    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchFields")]
1358#[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1359    pub match_fields: Option<Vec<ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchFields>>,
1360}
1361
1362/// A node selector requirement is a selector that contains values, a key, and an operator
1363/// that relates the key and values.
1364#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1365#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1366#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1367pub struct ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchExpressions
1368{
1369    /// The label key that the selector applies to.
1370    pub key: String,
1371    /// Represents a key's relationship to a set of values.
1372    /// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
1373    pub operator: String,
1374    /// An array of string values. If the operator is In or NotIn,
1375    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1376    /// the values array must be empty. If the operator is Gt or Lt, the values
1377    /// array must have a single element, which will be interpreted as an integer.
1378    /// This array is replaced during a strategic merge patch.
1379    #[serde(default, skip_serializing_if = "Option::is_none")]
1380    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1381    pub values: Option<Vec<String>>,
1382}
1383
1384/// A node selector requirement is a selector that contains values, a key, and an operator
1385/// that relates the key and values.
1386#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1387#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1388#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1389pub struct ClusterAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchFields
1390{
1391    /// The label key that the selector applies to.
1392    pub key: String,
1393    /// Represents a key's relationship to a set of values.
1394    /// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
1395    pub operator: String,
1396    /// An array of string values. If the operator is In or NotIn,
1397    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
1398    /// the values array must be empty. If the operator is Gt or Lt, the values
1399    /// array must have a single element, which will be interpreted as an integer.
1400    /// This array is replaced during a strategic merge patch.
1401    #[serde(default, skip_serializing_if = "Option::is_none")]
1402    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1403    pub values: Option<Vec<String>>,
1404}
1405
1406/// The pod this Toleration is attached to tolerates any taint that matches
1407/// the triple <key,value,effect> using the matching operator <operator>.
1408#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1409#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1410#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1411pub struct ClusterAffinityTolerations {
1412    /// Effect indicates the taint effect to match. Empty means match all taint effects.
1413    /// When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
1414    #[serde(default, skip_serializing_if = "Option::is_none")]
1415    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1416    pub effect: Option<String>,
1417    /// Key is the taint key that the toleration applies to. Empty means match all taint keys.
1418    /// If the key is empty, operator must be Exists; this combination means to match all values and all keys.
1419    #[serde(default, skip_serializing_if = "Option::is_none")]
1420    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1421    pub key: Option<String>,
1422    /// Operator represents a key's relationship to the value.
1423    /// Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal.
1424    /// Exists is equivalent to wildcard for value, so that a pod can
1425    /// tolerate all taints of a particular category.
1426    /// Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators).
1427    #[serde(default, skip_serializing_if = "Option::is_none")]
1428    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1429    pub operator: Option<String>,
1430    /// TolerationSeconds represents the period of time the toleration (which must be
1431    /// of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
1432    /// it is not set, which means tolerate the taint forever (do not evict). Zero and
1433    /// negative values will be treated as 0 (evict immediately) by the system.
1434    #[serde(
1435        default,
1436        skip_serializing_if = "Option::is_none",
1437        rename = "tolerationSeconds"
1438    )]
1439    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1440    pub toleration_seconds: Option<i64>,
1441    /// Value is the taint value the toleration matches to.
1442    /// If the operator is Exists, the value should be empty, otherwise just a regular string.
1443    #[serde(default, skip_serializing_if = "Option::is_none")]
1444    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1445    pub value: Option<String>,
1446}
1447
1448/// The configuration to be used for backups
1449#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1450#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1451#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1452pub struct ClusterBackup {
1453    /// The configuration for the barman-cloud tool suite
1454    #[serde(
1455        default,
1456        skip_serializing_if = "Option::is_none",
1457        rename = "barmanObjectStore"
1458    )]
1459    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1460    pub barman_object_store: Option<ClusterBackupBarmanObjectStore>,
1461    /// RetentionPolicy is the retention policy to be used for backups
1462    /// and WALs (i.e. '60d'). The retention policy is expressed in the form
1463    /// of `XXu` where `XX` is a positive integer and `u` is in `[dwm]` -
1464    /// days, weeks, months.
1465    /// It's currently only applicable when using the BarmanObjectStore method.
1466    #[serde(
1467        default,
1468        skip_serializing_if = "Option::is_none",
1469        rename = "retentionPolicy"
1470    )]
1471    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1472    pub retention_policy: Option<String>,
1473    /// The policy to decide which instance should perform backups. Available
1474    /// options are empty string, which will default to `prefer-standby` policy,
1475    /// `primary` to have backups run always on primary instances, `prefer-standby`
1476    /// to have backups run preferably on the most updated standby, if available.
1477    #[serde(default, skip_serializing_if = "Option::is_none")]
1478    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1479    pub target: Option<ClusterBackupTarget>,
1480    /// VolumeSnapshot provides the configuration for the execution of volume snapshot backups.
1481    #[serde(
1482        default,
1483        skip_serializing_if = "Option::is_none",
1484        rename = "volumeSnapshot"
1485    )]
1486    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1487    pub volume_snapshot: Option<ClusterBackupVolumeSnapshot>,
1488}
1489
1490/// The configuration for the barman-cloud tool suite
1491#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1492#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1493#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1494pub struct ClusterBackupBarmanObjectStore {
1495    /// The credentials to use to upload data to Azure Blob Storage
1496    #[serde(
1497        default,
1498        skip_serializing_if = "Option::is_none",
1499        rename = "azureCredentials"
1500    )]
1501    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1502    pub azure_credentials: Option<ClusterBackupBarmanObjectStoreAzureCredentials>,
1503    /// The configuration to be used to backup the data files
1504    /// When not defined, base backups files will be stored uncompressed and may
1505    /// be unencrypted in the object store, according to the bucket default
1506    /// policy.
1507    #[serde(default, skip_serializing_if = "Option::is_none")]
1508    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1509    pub data: Option<ClusterBackupBarmanObjectStoreData>,
1510    /// The path where to store the backup (i.e. s3://bucket/path/to/folder)
1511    /// this path, with different destination folders, will be used for WALs
1512    /// and for data
1513    #[serde(rename = "destinationPath")]
1514    pub destination_path: String,
1515    /// EndpointCA store the CA bundle of the barman endpoint.
1516    /// Useful when using self-signed certificates to avoid
1517    /// errors with certificate issuer and barman-cloud-wal-archive
1518    #[serde(
1519        default,
1520        skip_serializing_if = "Option::is_none",
1521        rename = "endpointCA"
1522    )]
1523    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1524    pub endpoint_ca: Option<ClusterBackupBarmanObjectStoreEndpointCa>,
1525    /// Endpoint to be used to upload data to the cloud,
1526    /// overriding the automatic endpoint discovery
1527    #[serde(
1528        default,
1529        skip_serializing_if = "Option::is_none",
1530        rename = "endpointURL"
1531    )]
1532    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1533    pub endpoint_url: Option<String>,
1534    /// The credentials to use to upload data to Google Cloud Storage
1535    #[serde(
1536        default,
1537        skip_serializing_if = "Option::is_none",
1538        rename = "googleCredentials"
1539    )]
1540    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1541    pub google_credentials: Option<ClusterBackupBarmanObjectStoreGoogleCredentials>,
1542    /// HistoryTags is a list of key value pairs that will be passed to the
1543    /// Barman --history-tags option.
1544    #[serde(
1545        default,
1546        skip_serializing_if = "Option::is_none",
1547        rename = "historyTags"
1548    )]
1549    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1550    pub history_tags: Option<BTreeMap<String, String>>,
1551    /// The credentials to use to upload data to S3
1552    #[serde(
1553        default,
1554        skip_serializing_if = "Option::is_none",
1555        rename = "s3Credentials"
1556    )]
1557    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1558    pub s3_credentials: Option<ClusterBackupBarmanObjectStoreS3Credentials>,
1559    /// The server name on S3, the cluster name is used if this
1560    /// parameter is omitted
1561    #[serde(
1562        default,
1563        skip_serializing_if = "Option::is_none",
1564        rename = "serverName"
1565    )]
1566    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1567    pub server_name: Option<String>,
1568    /// Tags is a list of key value pairs that will be passed to the
1569    /// Barman --tags option.
1570    #[serde(default, skip_serializing_if = "Option::is_none")]
1571    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1572    pub tags: Option<BTreeMap<String, String>>,
1573    /// The configuration for the backup of the WAL stream.
1574    /// When not defined, WAL files will be stored uncompressed and may be
1575    /// unencrypted in the object store, according to the bucket default policy.
1576    #[serde(default, skip_serializing_if = "Option::is_none")]
1577    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1578    pub wal: Option<ClusterBackupBarmanObjectStoreWal>,
1579}
1580
1581/// The credentials to use to upload data to Azure Blob Storage
1582#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1583#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1584#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1585pub struct ClusterBackupBarmanObjectStoreAzureCredentials {
1586    /// The connection string to be used
1587    #[serde(
1588        default,
1589        skip_serializing_if = "Option::is_none",
1590        rename = "connectionString"
1591    )]
1592    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1593    pub connection_string: Option<ClusterBackupBarmanObjectStoreAzureCredentialsConnectionString>,
1594    /// Use the Azure AD based authentication without providing explicitly the keys.
1595    #[serde(
1596        default,
1597        skip_serializing_if = "Option::is_none",
1598        rename = "inheritFromAzureAD"
1599    )]
1600    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1601    pub inherit_from_azure_ad: Option<bool>,
1602    /// The storage account where to upload data
1603    #[serde(
1604        default,
1605        skip_serializing_if = "Option::is_none",
1606        rename = "storageAccount"
1607    )]
1608    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1609    pub storage_account: Option<ClusterBackupBarmanObjectStoreAzureCredentialsStorageAccount>,
1610    /// The storage account key to be used in conjunction
1611    /// with the storage account name
1612    #[serde(
1613        default,
1614        skip_serializing_if = "Option::is_none",
1615        rename = "storageKey"
1616    )]
1617    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1618    pub storage_key: Option<ClusterBackupBarmanObjectStoreAzureCredentialsStorageKey>,
1619    /// A shared-access-signature to be used in conjunction with
1620    /// the storage account name
1621    #[serde(
1622        default,
1623        skip_serializing_if = "Option::is_none",
1624        rename = "storageSasToken"
1625    )]
1626    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1627    pub storage_sas_token: Option<ClusterBackupBarmanObjectStoreAzureCredentialsStorageSasToken>,
1628    /// Use the default Azure authentication flow, which includes DefaultAzureCredential.
1629    /// This allows authentication using environment variables and managed identities.
1630    #[serde(
1631        default,
1632        skip_serializing_if = "Option::is_none",
1633        rename = "useDefaultAzureCredentials"
1634    )]
1635    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1636    pub use_default_azure_credentials: Option<bool>,
1637}
1638
1639/// The connection string to be used
1640#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1641#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1642#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1643pub struct ClusterBackupBarmanObjectStoreAzureCredentialsConnectionString {
1644    /// The key to select
1645    pub key: String,
1646    /// Name of the referent.
1647    pub name: String,
1648}
1649
1650/// The storage account where to upload data
1651#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1652#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1653#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1654pub struct ClusterBackupBarmanObjectStoreAzureCredentialsStorageAccount {
1655    /// The key to select
1656    pub key: String,
1657    /// Name of the referent.
1658    pub name: String,
1659}
1660
1661/// The storage account key to be used in conjunction
1662/// with the storage account name
1663#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1664#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1665#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1666pub struct ClusterBackupBarmanObjectStoreAzureCredentialsStorageKey {
1667    /// The key to select
1668    pub key: String,
1669    /// Name of the referent.
1670    pub name: String,
1671}
1672
1673/// A shared-access-signature to be used in conjunction with
1674/// the storage account name
1675#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1676#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1677#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1678pub struct ClusterBackupBarmanObjectStoreAzureCredentialsStorageSasToken {
1679    /// The key to select
1680    pub key: String,
1681    /// Name of the referent.
1682    pub name: String,
1683}
1684
1685/// The configuration to be used to backup the data files
1686/// When not defined, base backups files will be stored uncompressed and may
1687/// be unencrypted in the object store, according to the bucket default
1688/// policy.
1689#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1690#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1691#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1692pub struct ClusterBackupBarmanObjectStoreData {
1693    /// AdditionalCommandArgs represents additional arguments that can be appended
1694    /// to the 'barman-cloud-backup' command-line invocation. These arguments
1695    /// provide flexibility to customize the backup process further according to
1696    /// specific requirements or configurations.
1697    ///
1698    /// Example:
1699    /// In a scenario where specialized backup options are required, such as setting
1700    /// a specific timeout or defining custom behavior, users can use this field
1701    /// to specify additional command arguments.
1702    ///
1703    /// Note:
1704    /// It's essential to ensure that the provided arguments are valid and supported
1705    /// by the 'barman-cloud-backup' command, to avoid potential errors or unintended
1706    /// behavior during execution.
1707    #[serde(
1708        default,
1709        skip_serializing_if = "Option::is_none",
1710        rename = "additionalCommandArgs"
1711    )]
1712    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1713    pub additional_command_args: Option<Vec<String>>,
1714    /// Compress a backup file (a tar file per tablespace) while streaming it
1715    /// to the object store. Available options are empty string (no
1716    /// compression, default), `gzip`, `bzip2`, `lz4`, and `snappy`.
1717    #[serde(default, skip_serializing_if = "Option::is_none")]
1718    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1719    pub compression: Option<ClusterBackupBarmanObjectStoreDataCompression>,
1720    /// Whenever to force the encryption of files (if the bucket is
1721    /// not already configured for that).
1722    /// Allowed options are empty string (use the bucket policy, default),
1723    /// `AES256` and `aws:kms`
1724    #[serde(default, skip_serializing_if = "Option::is_none")]
1725    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1726    pub encryption: Option<ClusterBackupBarmanObjectStoreDataEncryption>,
1727    /// Control whether the I/O workload for the backup initial checkpoint will
1728    /// be limited, according to the `checkpoint_completion_target` setting on
1729    /// the PostgreSQL server. If set to true, an immediate checkpoint will be
1730    /// used, meaning PostgreSQL will complete the checkpoint as soon as
1731    /// possible. `false` by default.
1732    #[serde(
1733        default,
1734        skip_serializing_if = "Option::is_none",
1735        rename = "immediateCheckpoint"
1736    )]
1737    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1738    pub immediate_checkpoint: Option<bool>,
1739    /// The number of parallel jobs to be used to upload the backup, defaults
1740    /// to 2
1741    #[serde(default, skip_serializing_if = "Option::is_none")]
1742    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1743    pub jobs: Option<i32>,
1744    /// Additional arguments that can be appended to the 'barman-cloud-restore'
1745    /// command-line invocation. These arguments provide flexibility to customize
1746    /// the data restore process further, according to specific requirements or
1747    /// configurations.
1748    ///
1749    /// Example:
1750    /// In a scenario where specialized restore options are required, such as setting
1751    /// a specific read timeout or defining custom behavior, users can use this field
1752    /// to specify additional command arguments.
1753    ///
1754    /// Note:
1755    /// It's essential to ensure that the provided arguments are valid and supported
1756    /// by the 'barman-cloud-restore' command, to avoid potential errors or unintended
1757    /// behavior during execution.
1758    #[serde(
1759        default,
1760        skip_serializing_if = "Option::is_none",
1761        rename = "restoreAdditionalCommandArgs"
1762    )]
1763    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1764    pub restore_additional_command_args: Option<Vec<String>>,
1765}
1766
1767/// The configuration to be used to backup the data files
1768/// When not defined, base backups files will be stored uncompressed and may
1769/// be unencrypted in the object store, according to the bucket default
1770/// policy.
1771#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
1772#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1773pub enum ClusterBackupBarmanObjectStoreDataCompression {
1774    #[serde(rename = "bzip2")]
1775    Bzip2,
1776    #[serde(rename = "gzip")]
1777    Gzip,
1778    #[serde(rename = "lz4")]
1779    Lz4,
1780    #[serde(rename = "snappy")]
1781    Snappy,
1782}
1783
1784/// The configuration to be used to backup the data files
1785/// When not defined, base backups files will be stored uncompressed and may
1786/// be unencrypted in the object store, according to the bucket default
1787/// policy.
1788#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
1789#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1790pub enum ClusterBackupBarmanObjectStoreDataEncryption {
1791    #[serde(rename = "AES256")]
1792    Aes256,
1793    #[serde(rename = "aws:kms")]
1794    AwsKms,
1795}
1796
1797/// EndpointCA store the CA bundle of the barman endpoint.
1798/// Useful when using self-signed certificates to avoid
1799/// errors with certificate issuer and barman-cloud-wal-archive
1800#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1801#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1802#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1803pub struct ClusterBackupBarmanObjectStoreEndpointCa {
1804    /// The key to select
1805    pub key: String,
1806    /// Name of the referent.
1807    pub name: String,
1808}
1809
1810/// The credentials to use to upload data to Google Cloud Storage
1811#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1812#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1813#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1814pub struct ClusterBackupBarmanObjectStoreGoogleCredentials {
1815    /// The secret containing the Google Cloud Storage JSON file with the credentials
1816    #[serde(
1817        default,
1818        skip_serializing_if = "Option::is_none",
1819        rename = "applicationCredentials"
1820    )]
1821    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1822    pub application_credentials:
1823        Option<ClusterBackupBarmanObjectStoreGoogleCredentialsApplicationCredentials>,
1824    /// If set to true, will presume that it's running inside a GKE environment,
1825    /// default to false.
1826    #[serde(
1827        default,
1828        skip_serializing_if = "Option::is_none",
1829        rename = "gkeEnvironment"
1830    )]
1831    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1832    pub gke_environment: Option<bool>,
1833}
1834
1835/// The secret containing the Google Cloud Storage JSON file with the credentials
1836#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1837#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1838#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1839pub struct ClusterBackupBarmanObjectStoreGoogleCredentialsApplicationCredentials {
1840    /// The key to select
1841    pub key: String,
1842    /// Name of the referent.
1843    pub name: String,
1844}
1845
1846/// The credentials to use to upload data to S3
1847#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1848#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1849#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1850pub struct ClusterBackupBarmanObjectStoreS3Credentials {
1851    /// The reference to the access key id
1852    #[serde(
1853        default,
1854        skip_serializing_if = "Option::is_none",
1855        rename = "accessKeyId"
1856    )]
1857    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1858    pub access_key_id: Option<ClusterBackupBarmanObjectStoreS3CredentialsAccessKeyId>,
1859    /// Use the role based authentication without providing explicitly the keys.
1860    #[serde(
1861        default,
1862        skip_serializing_if = "Option::is_none",
1863        rename = "inheritFromIAMRole"
1864    )]
1865    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1866    pub inherit_from_iam_role: Option<bool>,
1867    /// The reference to the secret containing the region name
1868    #[serde(default, skip_serializing_if = "Option::is_none")]
1869    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1870    pub region: Option<ClusterBackupBarmanObjectStoreS3CredentialsRegion>,
1871    /// The reference to the secret access key
1872    #[serde(
1873        default,
1874        skip_serializing_if = "Option::is_none",
1875        rename = "secretAccessKey"
1876    )]
1877    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1878    pub secret_access_key: Option<ClusterBackupBarmanObjectStoreS3CredentialsSecretAccessKey>,
1879    /// The references to the session key
1880    #[serde(
1881        default,
1882        skip_serializing_if = "Option::is_none",
1883        rename = "sessionToken"
1884    )]
1885    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1886    pub session_token: Option<ClusterBackupBarmanObjectStoreS3CredentialsSessionToken>,
1887}
1888
1889/// The reference to the access key id
1890#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1891#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1892#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1893pub struct ClusterBackupBarmanObjectStoreS3CredentialsAccessKeyId {
1894    /// The key to select
1895    pub key: String,
1896    /// Name of the referent.
1897    pub name: String,
1898}
1899
1900/// The reference to the secret containing the region name
1901#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1902#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1903#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1904pub struct ClusterBackupBarmanObjectStoreS3CredentialsRegion {
1905    /// The key to select
1906    pub key: String,
1907    /// Name of the referent.
1908    pub name: String,
1909}
1910
1911/// The reference to the secret access key
1912#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1913#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1914#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1915pub struct ClusterBackupBarmanObjectStoreS3CredentialsSecretAccessKey {
1916    /// The key to select
1917    pub key: String,
1918    /// Name of the referent.
1919    pub name: String,
1920}
1921
1922/// The references to the session key
1923#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1924#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1925#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1926pub struct ClusterBackupBarmanObjectStoreS3CredentialsSessionToken {
1927    /// The key to select
1928    pub key: String,
1929    /// Name of the referent.
1930    pub name: String,
1931}
1932
1933/// The configuration for the backup of the WAL stream.
1934/// When not defined, WAL files will be stored uncompressed and may be
1935/// unencrypted in the object store, according to the bucket default policy.
1936#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
1937#[cfg_attr(feature = "builder", derive(TypedBuilder))]
1938#[cfg_attr(feature = "schemars", derive(JsonSchema))]
1939pub struct ClusterBackupBarmanObjectStoreWal {
1940    /// Additional arguments that can be appended to the 'barman-cloud-wal-archive'
1941    /// command-line invocation. These arguments provide flexibility to customize
1942    /// the WAL archive process further, according to specific requirements or configurations.
1943    ///
1944    /// Example:
1945    /// In a scenario where specialized backup options are required, such as setting
1946    /// a specific timeout or defining custom behavior, users can use this field
1947    /// to specify additional command arguments.
1948    ///
1949    /// Note:
1950    /// It's essential to ensure that the provided arguments are valid and supported
1951    /// by the 'barman-cloud-wal-archive' command, to avoid potential errors or unintended
1952    /// behavior during execution.
1953    #[serde(
1954        default,
1955        skip_serializing_if = "Option::is_none",
1956        rename = "archiveAdditionalCommandArgs"
1957    )]
1958    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1959    pub archive_additional_command_args: Option<Vec<String>>,
1960    /// Compress a WAL file before sending it to the object store. Available
1961    /// options are empty string (no compression, default), `gzip`, `bzip2`,
1962    /// `lz4`, `snappy`, `xz`, and `zstd`.
1963    #[serde(default, skip_serializing_if = "Option::is_none")]
1964    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1965    pub compression: Option<ClusterBackupBarmanObjectStoreWalCompression>,
1966    /// Whenever to force the encryption of files (if the bucket is
1967    /// not already configured for that).
1968    /// Allowed options are empty string (use the bucket policy, default),
1969    /// `AES256` and `aws:kms`
1970    #[serde(default, skip_serializing_if = "Option::is_none")]
1971    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1972    pub encryption: Option<ClusterBackupBarmanObjectStoreWalEncryption>,
1973    /// Number of WAL files to be either archived in parallel (when the
1974    /// PostgreSQL instance is archiving to a backup object store) or
1975    /// restored in parallel (when a PostgreSQL standby is fetching WAL
1976    /// files from a recovery object store). If not specified, WAL files
1977    /// will be processed one at a time. It accepts a positive integer as a
1978    /// value - with 1 being the minimum accepted value.
1979    #[serde(
1980        default,
1981        skip_serializing_if = "Option::is_none",
1982        rename = "maxParallel"
1983    )]
1984    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
1985    pub max_parallel: Option<i64>,
1986    /// Additional arguments that can be appended to the 'barman-cloud-wal-restore'
1987    /// command-line invocation. These arguments provide flexibility to customize
1988    /// the WAL restore process further, according to specific requirements or configurations.
1989    ///
1990    /// Example:
1991    /// In a scenario where specialized backup options are required, such as setting
1992    /// a specific timeout or defining custom behavior, users can use this field
1993    /// to specify additional command arguments.
1994    ///
1995    /// Note:
1996    /// It's essential to ensure that the provided arguments are valid and supported
1997    /// by the 'barman-cloud-wal-restore' command, to avoid potential errors or unintended
1998    /// behavior during execution.
1999    #[serde(
2000        default,
2001        skip_serializing_if = "Option::is_none",
2002        rename = "restoreAdditionalCommandArgs"
2003    )]
2004    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2005    pub restore_additional_command_args: Option<Vec<String>>,
2006}
2007
2008/// The configuration for the backup of the WAL stream.
2009/// When not defined, WAL files will be stored uncompressed and may be
2010/// unencrypted in the object store, according to the bucket default policy.
2011#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2012#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2013pub enum ClusterBackupBarmanObjectStoreWalCompression {
2014    #[serde(rename = "bzip2")]
2015    Bzip2,
2016    #[serde(rename = "gzip")]
2017    Gzip,
2018    #[serde(rename = "lz4")]
2019    Lz4,
2020    #[serde(rename = "snappy")]
2021    Snappy,
2022    #[serde(rename = "xz")]
2023    Xz,
2024    #[serde(rename = "zstd")]
2025    Zstd,
2026}
2027
2028/// The configuration for the backup of the WAL stream.
2029/// When not defined, WAL files will be stored uncompressed and may be
2030/// unencrypted in the object store, according to the bucket default policy.
2031#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2032#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2033pub enum ClusterBackupBarmanObjectStoreWalEncryption {
2034    #[serde(rename = "AES256")]
2035    Aes256,
2036    #[serde(rename = "aws:kms")]
2037    AwsKms,
2038}
2039
2040/// The configuration to be used for backups
2041#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2042#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2043pub enum ClusterBackupTarget {
2044    #[serde(rename = "primary")]
2045    Primary,
2046    #[serde(rename = "prefer-standby")]
2047    PreferStandby,
2048}
2049
2050/// VolumeSnapshot provides the configuration for the execution of volume snapshot backups.
2051#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2052#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2053#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2054pub struct ClusterBackupVolumeSnapshot {
2055    /// Annotations key-value pairs that will be added to .metadata.annotations snapshot resources.
2056    #[serde(default, skip_serializing_if = "Option::is_none")]
2057    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2058    pub annotations: Option<BTreeMap<String, String>>,
2059    /// ClassName specifies the Snapshot Class to be used for PG_DATA PersistentVolumeClaim.
2060    /// It is the default class for the other types if no specific class is present
2061    #[serde(default, skip_serializing_if = "Option::is_none", rename = "className")]
2062    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2063    pub class_name: Option<String>,
2064    /// Labels are key-value pairs that will be added to .metadata.labels snapshot resources.
2065    #[serde(default, skip_serializing_if = "Option::is_none")]
2066    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2067    pub labels: Option<BTreeMap<String, String>>,
2068    /// Whether the default type of backup with volume snapshots is
2069    /// online/hot (`true`, default) or offline/cold (`false`)
2070    #[serde(default, skip_serializing_if = "Option::is_none")]
2071    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2072    pub online: Option<bool>,
2073    /// Configuration parameters to control the online/hot backup with volume snapshots
2074    #[serde(
2075        default,
2076        skip_serializing_if = "Option::is_none",
2077        rename = "onlineConfiguration"
2078    )]
2079    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2080    pub online_configuration: Option<ClusterBackupVolumeSnapshotOnlineConfiguration>,
2081    /// SnapshotOwnerReference indicates the type of owner reference the snapshot should have
2082    #[serde(
2083        default,
2084        skip_serializing_if = "Option::is_none",
2085        rename = "snapshotOwnerReference"
2086    )]
2087    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2088    pub snapshot_owner_reference: Option<ClusterBackupVolumeSnapshotSnapshotOwnerReference>,
2089    /// TablespaceClassName specifies the Snapshot Class to be used for the tablespaces.
2090    /// defaults to the PGDATA Snapshot Class, if set
2091    #[serde(
2092        default,
2093        skip_serializing_if = "Option::is_none",
2094        rename = "tablespaceClassName"
2095    )]
2096    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2097    pub tablespace_class_name: Option<BTreeMap<String, String>>,
2098    /// WalClassName specifies the Snapshot Class to be used for the PG_WAL PersistentVolumeClaim.
2099    #[serde(
2100        default,
2101        skip_serializing_if = "Option::is_none",
2102        rename = "walClassName"
2103    )]
2104    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2105    pub wal_class_name: Option<String>,
2106}
2107
2108/// Configuration parameters to control the online/hot backup with volume snapshots
2109#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2110#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2111#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2112pub struct ClusterBackupVolumeSnapshotOnlineConfiguration {
2113    /// Control whether the I/O workload for the backup initial checkpoint will
2114    /// be limited, according to the `checkpoint_completion_target` setting on
2115    /// the PostgreSQL server. If set to true, an immediate checkpoint will be
2116    /// used, meaning PostgreSQL will complete the checkpoint as soon as
2117    /// possible. `false` by default.
2118    #[serde(
2119        default,
2120        skip_serializing_if = "Option::is_none",
2121        rename = "immediateCheckpoint"
2122    )]
2123    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2124    pub immediate_checkpoint: Option<bool>,
2125    /// If false, the function will return immediately after the backup is completed,
2126    /// without waiting for WAL to be archived.
2127    /// This behavior is only useful with backup software that independently monitors WAL archiving.
2128    /// Otherwise, WAL required to make the backup consistent might be missing and make the backup useless.
2129    /// By default, or when this parameter is true, pg_backup_stop will wait for WAL to be archived when archiving is
2130    /// enabled.
2131    /// On a standby, this means that it will wait only when archive_mode = always.
2132    /// If write activity on the primary is low, it may be useful to run pg_switch_wal on the primary in order to trigger
2133    /// an immediate segment switch.
2134    #[serde(
2135        default,
2136        skip_serializing_if = "Option::is_none",
2137        rename = "waitForArchive"
2138    )]
2139    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2140    pub wait_for_archive: Option<bool>,
2141}
2142
2143/// VolumeSnapshot provides the configuration for the execution of volume snapshot backups.
2144#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2145#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2146pub enum ClusterBackupVolumeSnapshotSnapshotOwnerReference {
2147    #[serde(rename = "none")]
2148    None,
2149    #[serde(rename = "cluster")]
2150    Cluster,
2151    #[serde(rename = "backup")]
2152    Backup,
2153}
2154
2155/// Instructions to bootstrap this cluster
2156#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2157#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2158#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2159pub struct ClusterBootstrap {
2160    /// Bootstrap the cluster via initdb
2161    #[serde(default, skip_serializing_if = "Option::is_none")]
2162    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2163    pub initdb: Option<ClusterBootstrapInitdb>,
2164    /// Bootstrap the cluster taking a physical backup of another compatible
2165    /// PostgreSQL instance
2166    #[serde(default, skip_serializing_if = "Option::is_none")]
2167    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2168    pub pg_basebackup: Option<ClusterBootstrapPgBasebackup>,
2169    /// Bootstrap the cluster from a backup
2170    #[serde(default, skip_serializing_if = "Option::is_none")]
2171    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2172    pub recovery: Option<ClusterBootstrapRecovery>,
2173}
2174
2175/// Bootstrap the cluster via initdb
2176#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2177#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2178#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2179pub struct ClusterBootstrapInitdb {
2180    /// Specifies the locale name when the builtin provider is used.
2181    /// This option requires `localeProvider` to be set to `builtin`.
2182    /// Available from PostgreSQL 17.
2183    #[serde(
2184        default,
2185        skip_serializing_if = "Option::is_none",
2186        rename = "builtinLocale"
2187    )]
2188    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2189    pub builtin_locale: Option<String>,
2190    /// Whether data checksums are enabled on data pages, to help detect
2191    /// corruption by the I/O system that would otherwise be silent
2192    /// (default: `false` before PostgreSQL 18, `true` from PostgreSQL 18 on,
2193    /// matching the initdb default in each case).
2194    #[serde(
2195        default,
2196        skip_serializing_if = "Option::is_none",
2197        rename = "dataChecksums"
2198    )]
2199    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2200    pub data_checksums: Option<bool>,
2201    /// Name of the database used by the application. Default: `app`.
2202    #[serde(default, skip_serializing_if = "Option::is_none")]
2203    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2204    pub database: Option<String>,
2205    /// The value to be passed as option `--encoding` for initdb (default:`UTF8`)
2206    #[serde(default, skip_serializing_if = "Option::is_none")]
2207    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2208    pub encoding: Option<String>,
2209    /// Specifies the ICU locale when the ICU provider is used.
2210    /// This option requires `localeProvider` to be set to `icu`.
2211    /// Available from PostgreSQL 15.
2212    #[serde(default, skip_serializing_if = "Option::is_none", rename = "icuLocale")]
2213    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2214    pub icu_locale: Option<String>,
2215    /// Specifies additional collation rules to customize the behavior of the default collation.
2216    /// This option requires `localeProvider` to be set to `icu`.
2217    /// Available from PostgreSQL 16.
2218    #[serde(default, skip_serializing_if = "Option::is_none", rename = "icuRules")]
2219    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2220    pub icu_rules: Option<String>,
2221    /// Bootstraps the new cluster by importing data from an existing PostgreSQL
2222    /// instance using logical backup (`pg_dump` and `pg_restore`)
2223    #[serde(default, skip_serializing_if = "Option::is_none")]
2224    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2225    pub import: Option<ClusterBootstrapInitdbImport>,
2226    /// Sets the default collation order and character classification in the new database.
2227    #[serde(default, skip_serializing_if = "Option::is_none")]
2228    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2229    pub locale: Option<String>,
2230    /// The value to be passed as option `--lc-ctype` for initdb (default:`C`)
2231    #[serde(
2232        default,
2233        skip_serializing_if = "Option::is_none",
2234        rename = "localeCType"
2235    )]
2236    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2237    pub locale_c_type: Option<String>,
2238    /// The value to be passed as option `--lc-collate` for initdb (default:`C`)
2239    #[serde(
2240        default,
2241        skip_serializing_if = "Option::is_none",
2242        rename = "localeCollate"
2243    )]
2244    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2245    pub locale_collate: Option<String>,
2246    /// This option sets the locale provider for databases created in the new cluster.
2247    /// Available from PostgreSQL 16.
2248    #[serde(
2249        default,
2250        skip_serializing_if = "Option::is_none",
2251        rename = "localeProvider"
2252    )]
2253    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2254    pub locale_provider: Option<String>,
2255    /// The list of options that must be passed to initdb when creating the cluster.
2256    ///
2257    /// Deprecated: This could lead to inconsistent configurations,
2258    /// please use the explicit provided parameters instead.
2259    /// If defined, explicit values will be ignored.
2260    #[serde(default, skip_serializing_if = "Option::is_none")]
2261    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2262    pub options: Option<Vec<String>>,
2263    /// Name of the owner of the database in the instance to be used
2264    /// by applications. Defaults to the value of the `database` key.
2265    #[serde(default, skip_serializing_if = "Option::is_none")]
2266    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2267    pub owner: Option<String>,
2268    /// List of SQL queries to be executed as a superuser in the application
2269    /// database right after the cluster has been created - to be used with extreme care
2270    /// (by default empty)
2271    #[serde(
2272        default,
2273        skip_serializing_if = "Option::is_none",
2274        rename = "postInitApplicationSQL"
2275    )]
2276    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2277    pub post_init_application_sql: Option<Vec<String>>,
2278    /// List of references to ConfigMaps or Secrets containing SQL files
2279    /// to be executed as a superuser in the application database right after
2280    /// the cluster has been created. The references are processed in a specific order:
2281    /// first, all Secrets are processed, followed by all ConfigMaps.
2282    /// Within each group, the processing order follows the sequence specified
2283    /// in their respective arrays.
2284    /// (by default empty)
2285    #[serde(
2286        default,
2287        skip_serializing_if = "Option::is_none",
2288        rename = "postInitApplicationSQLRefs"
2289    )]
2290    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2291    pub post_init_application_sql_refs: Option<ClusterBootstrapInitdbPostInitApplicationSqlRefs>,
2292    /// List of SQL queries to be executed as a superuser in the `postgres`
2293    /// database right after the cluster has been created - to be used with extreme care
2294    /// (by default empty)
2295    #[serde(
2296        default,
2297        skip_serializing_if = "Option::is_none",
2298        rename = "postInitSQL"
2299    )]
2300    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2301    pub post_init_sql: Option<Vec<String>>,
2302    /// List of references to ConfigMaps or Secrets containing SQL files
2303    /// to be executed as a superuser in the `postgres` database right after
2304    /// the cluster has been created. The references are processed in a specific order:
2305    /// first, all Secrets are processed, followed by all ConfigMaps.
2306    /// Within each group, the processing order follows the sequence specified
2307    /// in their respective arrays.
2308    /// (by default empty)
2309    #[serde(
2310        default,
2311        skip_serializing_if = "Option::is_none",
2312        rename = "postInitSQLRefs"
2313    )]
2314    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2315    pub post_init_sql_refs: Option<ClusterBootstrapInitdbPostInitSqlRefs>,
2316    /// List of SQL queries to be executed as a superuser in the `template1`
2317    /// database right after the cluster has been created - to be used with extreme care
2318    /// (by default empty)
2319    #[serde(
2320        default,
2321        skip_serializing_if = "Option::is_none",
2322        rename = "postInitTemplateSQL"
2323    )]
2324    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2325    pub post_init_template_sql: Option<Vec<String>>,
2326    /// List of references to ConfigMaps or Secrets containing SQL files
2327    /// to be executed as a superuser in the `template1` database right after
2328    /// the cluster has been created. The references are processed in a specific order:
2329    /// first, all Secrets are processed, followed by all ConfigMaps.
2330    /// Within each group, the processing order follows the sequence specified
2331    /// in their respective arrays.
2332    /// (by default empty)
2333    #[serde(
2334        default,
2335        skip_serializing_if = "Option::is_none",
2336        rename = "postInitTemplateSQLRefs"
2337    )]
2338    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2339    pub post_init_template_sql_refs: Option<ClusterBootstrapInitdbPostInitTemplateSqlRefs>,
2340    /// Name of the secret containing the initial credentials for the
2341    /// owner of the user database. If empty a new secret will be
2342    /// created from scratch
2343    #[serde(default, skip_serializing_if = "Option::is_none")]
2344    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2345    pub secret: Option<ClusterBootstrapInitdbSecret>,
2346    /// The value in megabytes (1 to 1024) to be passed to the `--wal-segsize`
2347    /// option for initdb (default: empty, resulting in PostgreSQL default: 16MB)
2348    #[serde(
2349        default,
2350        skip_serializing_if = "Option::is_none",
2351        rename = "walSegmentSize"
2352    )]
2353    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2354    pub wal_segment_size: Option<i64>,
2355}
2356
2357/// Bootstraps the new cluster by importing data from an existing PostgreSQL
2358/// instance using logical backup (`pg_dump` and `pg_restore`)
2359#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2360#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2361#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2362pub struct ClusterBootstrapInitdbImport {
2363    /// The databases to import
2364    #[cfg_attr(feature = "builder", builder(default))]
2365    pub databases: Vec<String>,
2366    /// List of custom options to pass to the `pg_dump` command.
2367    ///
2368    /// IMPORTANT: Use with caution. The operator does not validate these options,
2369    /// and certain flags may interfere with its intended functionality or design.
2370    /// You are responsible for ensuring that the provided options are compatible
2371    /// with your environment and desired behavior.
2372    #[serde(
2373        default,
2374        skip_serializing_if = "Option::is_none",
2375        rename = "pgDumpExtraOptions"
2376    )]
2377    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2378    pub pg_dump_extra_options: Option<Vec<String>>,
2379    /// Custom options to pass to the `pg_restore` command during the `data`
2380    /// section. This setting overrides the generic `pgRestoreExtraOptions` value.
2381    ///
2382    /// IMPORTANT: Use with caution. The operator does not validate these options,
2383    /// and certain flags may interfere with its intended functionality or design.
2384    /// You are responsible for ensuring that the provided options are compatible
2385    /// with your environment and desired behavior.
2386    #[serde(
2387        default,
2388        skip_serializing_if = "Option::is_none",
2389        rename = "pgRestoreDataOptions"
2390    )]
2391    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2392    pub pg_restore_data_options: Option<Vec<String>>,
2393    /// List of custom options to pass to the `pg_restore` command.
2394    ///
2395    /// IMPORTANT: Use with caution. The operator does not validate these options,
2396    /// and certain flags may interfere with its intended functionality or design.
2397    /// You are responsible for ensuring that the provided options are compatible
2398    /// with your environment and desired behavior.
2399    #[serde(
2400        default,
2401        skip_serializing_if = "Option::is_none",
2402        rename = "pgRestoreExtraOptions"
2403    )]
2404    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2405    pub pg_restore_extra_options: Option<Vec<String>>,
2406    /// Custom options to pass to the `pg_restore` command during the `post-data`
2407    /// section. This setting overrides the generic `pgRestoreExtraOptions` value.
2408    ///
2409    /// IMPORTANT: Use with caution. The operator does not validate these options,
2410    /// and certain flags may interfere with its intended functionality or design.
2411    /// You are responsible for ensuring that the provided options are compatible
2412    /// with your environment and desired behavior.
2413    #[serde(
2414        default,
2415        skip_serializing_if = "Option::is_none",
2416        rename = "pgRestorePostdataOptions"
2417    )]
2418    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2419    pub pg_restore_postdata_options: Option<Vec<String>>,
2420    /// Custom options to pass to the `pg_restore` command during the `pre-data`
2421    /// section. This setting overrides the generic `pgRestoreExtraOptions` value.
2422    ///
2423    /// IMPORTANT: Use with caution. The operator does not validate these options,
2424    /// and certain flags may interfere with its intended functionality or design.
2425    /// You are responsible for ensuring that the provided options are compatible
2426    /// with your environment and desired behavior.
2427    #[serde(
2428        default,
2429        skip_serializing_if = "Option::is_none",
2430        rename = "pgRestorePredataOptions"
2431    )]
2432    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2433    pub pg_restore_predata_options: Option<Vec<String>>,
2434    /// List of SQL queries to be executed as a superuser in the application
2435    /// database right after is imported - to be used with extreme care
2436    /// (by default empty). Only available in microservice type.
2437    #[serde(
2438        default,
2439        skip_serializing_if = "Option::is_none",
2440        rename = "postImportApplicationSQL"
2441    )]
2442    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2443    pub post_import_application_sql: Option<Vec<String>>,
2444    /// The roles to import
2445    #[serde(default, skip_serializing_if = "Option::is_none")]
2446    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2447    pub roles: Option<Vec<String>>,
2448    /// When set to true, only the `pre-data` and `post-data` sections of
2449    /// `pg_restore` are invoked, avoiding data import. Default: `false`.
2450    #[serde(
2451        default,
2452        skip_serializing_if = "Option::is_none",
2453        rename = "schemaOnly"
2454    )]
2455    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2456    pub schema_only: Option<bool>,
2457    /// The source of the import
2458    pub source: ClusterBootstrapInitdbImportSource,
2459    /// The import type. Can be `microservice` or `monolith`.
2460    #[serde(rename = "type")]
2461    pub r#type: ClusterBootstrapInitdbImportType,
2462}
2463
2464/// The source of the import
2465#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2466#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2467#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2468pub struct ClusterBootstrapInitdbImportSource {
2469    /// The name of the externalCluster used for import
2470    #[serde(rename = "externalCluster")]
2471    pub external_cluster: String,
2472}
2473
2474/// Bootstraps the new cluster by importing data from an existing PostgreSQL
2475/// instance using logical backup (`pg_dump` and `pg_restore`)
2476#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
2477#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2478pub enum ClusterBootstrapInitdbImportType {
2479    #[serde(rename = "microservice")]
2480    Microservice,
2481    #[serde(rename = "monolith")]
2482    Monolith,
2483}
2484
2485/// List of references to ConfigMaps or Secrets containing SQL files
2486/// to be executed as a superuser in the application database right after
2487/// the cluster has been created. The references are processed in a specific order:
2488/// first, all Secrets are processed, followed by all ConfigMaps.
2489/// Within each group, the processing order follows the sequence specified
2490/// in their respective arrays.
2491/// (by default empty)
2492#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2493#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2494#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2495pub struct ClusterBootstrapInitdbPostInitApplicationSqlRefs {
2496    /// ConfigMapRefs holds a list of references to ConfigMaps
2497    #[serde(
2498        default,
2499        skip_serializing_if = "Option::is_none",
2500        rename = "configMapRefs"
2501    )]
2502    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2503    pub config_map_refs: Option<Vec<ClusterBootstrapInitdbPostInitApplicationSqlRefsConfigMapRefs>>,
2504    /// SecretRefs holds a list of references to Secrets
2505    #[serde(
2506        default,
2507        skip_serializing_if = "Option::is_none",
2508        rename = "secretRefs"
2509    )]
2510    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2511    pub secret_refs: Option<Vec<ClusterBootstrapInitdbPostInitApplicationSqlRefsSecretRefs>>,
2512}
2513
2514/// ConfigMapKeySelector contains enough information to let you locate
2515/// the key of a ConfigMap
2516#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2517#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2518#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2519pub struct ClusterBootstrapInitdbPostInitApplicationSqlRefsConfigMapRefs {
2520    /// The key to select
2521    pub key: String,
2522    /// Name of the referent.
2523    pub name: String,
2524}
2525
2526/// SecretKeySelector contains enough information to let you locate
2527/// the key of a Secret
2528#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2529#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2530#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2531pub struct ClusterBootstrapInitdbPostInitApplicationSqlRefsSecretRefs {
2532    /// The key to select
2533    pub key: String,
2534    /// Name of the referent.
2535    pub name: String,
2536}
2537
2538/// List of references to ConfigMaps or Secrets containing SQL files
2539/// to be executed as a superuser in the `postgres` database right after
2540/// the cluster has been created. The references are processed in a specific order:
2541/// first, all Secrets are processed, followed by all ConfigMaps.
2542/// Within each group, the processing order follows the sequence specified
2543/// in their respective arrays.
2544/// (by default empty)
2545#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2546#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2547#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2548pub struct ClusterBootstrapInitdbPostInitSqlRefs {
2549    /// ConfigMapRefs holds a list of references to ConfigMaps
2550    #[serde(
2551        default,
2552        skip_serializing_if = "Option::is_none",
2553        rename = "configMapRefs"
2554    )]
2555    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2556    pub config_map_refs: Option<Vec<ClusterBootstrapInitdbPostInitSqlRefsConfigMapRefs>>,
2557    /// SecretRefs holds a list of references to Secrets
2558    #[serde(
2559        default,
2560        skip_serializing_if = "Option::is_none",
2561        rename = "secretRefs"
2562    )]
2563    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2564    pub secret_refs: Option<Vec<ClusterBootstrapInitdbPostInitSqlRefsSecretRefs>>,
2565}
2566
2567/// ConfigMapKeySelector contains enough information to let you locate
2568/// the key of a ConfigMap
2569#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2570#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2571#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2572pub struct ClusterBootstrapInitdbPostInitSqlRefsConfigMapRefs {
2573    /// The key to select
2574    pub key: String,
2575    /// Name of the referent.
2576    pub name: String,
2577}
2578
2579/// SecretKeySelector contains enough information to let you locate
2580/// the key of a Secret
2581#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2582#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2583#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2584pub struct ClusterBootstrapInitdbPostInitSqlRefsSecretRefs {
2585    /// The key to select
2586    pub key: String,
2587    /// Name of the referent.
2588    pub name: String,
2589}
2590
2591/// List of references to ConfigMaps or Secrets containing SQL files
2592/// to be executed as a superuser in the `template1` database right after
2593/// the cluster has been created. The references are processed in a specific order:
2594/// first, all Secrets are processed, followed by all ConfigMaps.
2595/// Within each group, the processing order follows the sequence specified
2596/// in their respective arrays.
2597/// (by default empty)
2598#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2599#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2600#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2601pub struct ClusterBootstrapInitdbPostInitTemplateSqlRefs {
2602    /// ConfigMapRefs holds a list of references to ConfigMaps
2603    #[serde(
2604        default,
2605        skip_serializing_if = "Option::is_none",
2606        rename = "configMapRefs"
2607    )]
2608    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2609    pub config_map_refs: Option<Vec<ClusterBootstrapInitdbPostInitTemplateSqlRefsConfigMapRefs>>,
2610    /// SecretRefs holds a list of references to Secrets
2611    #[serde(
2612        default,
2613        skip_serializing_if = "Option::is_none",
2614        rename = "secretRefs"
2615    )]
2616    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2617    pub secret_refs: Option<Vec<ClusterBootstrapInitdbPostInitTemplateSqlRefsSecretRefs>>,
2618}
2619
2620/// ConfigMapKeySelector contains enough information to let you locate
2621/// the key of a ConfigMap
2622#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2623#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2624#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2625pub struct ClusterBootstrapInitdbPostInitTemplateSqlRefsConfigMapRefs {
2626    /// The key to select
2627    pub key: String,
2628    /// Name of the referent.
2629    pub name: String,
2630}
2631
2632/// SecretKeySelector contains enough information to let you locate
2633/// the key of a Secret
2634#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2635#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2636#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2637pub struct ClusterBootstrapInitdbPostInitTemplateSqlRefsSecretRefs {
2638    /// The key to select
2639    pub key: String,
2640    /// Name of the referent.
2641    pub name: String,
2642}
2643
2644/// Name of the secret containing the initial credentials for the
2645/// owner of the user database. If empty a new secret will be
2646/// created from scratch
2647#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2648#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2649#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2650pub struct ClusterBootstrapInitdbSecret {
2651    /// Name of the referent.
2652    pub name: String,
2653}
2654
2655/// Bootstrap the cluster taking a physical backup of another compatible
2656/// PostgreSQL instance
2657#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2658#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2659#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2660pub struct ClusterBootstrapPgBasebackup {
2661    /// Name of the database used by the application. Default: `app`.
2662    #[serde(default, skip_serializing_if = "Option::is_none")]
2663    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2664    pub database: Option<String>,
2665    /// Name of the owner of the database in the instance to be used
2666    /// by applications. Defaults to the value of the `database` key.
2667    #[serde(default, skip_serializing_if = "Option::is_none")]
2668    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2669    pub owner: Option<String>,
2670    /// Name of the secret containing the initial credentials for the
2671    /// owner of the user database. If empty a new secret will be
2672    /// created from scratch
2673    #[serde(default, skip_serializing_if = "Option::is_none")]
2674    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2675    pub secret: Option<ClusterBootstrapPgBasebackupSecret>,
2676    /// The name of the server of which we need to take a physical backup
2677    pub source: String,
2678}
2679
2680/// Name of the secret containing the initial credentials for the
2681/// owner of the user database. If empty a new secret will be
2682/// created from scratch
2683#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2684#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2685#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2686pub struct ClusterBootstrapPgBasebackupSecret {
2687    /// Name of the referent.
2688    pub name: String,
2689}
2690
2691/// Bootstrap the cluster from a backup
2692#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2693#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2694#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2695pub struct ClusterBootstrapRecovery {
2696    /// The backup object containing the physical base backup from which to
2697    /// initiate the recovery procedure.
2698    /// Mutually exclusive with `source` and `volumeSnapshots`.
2699    #[serde(default, skip_serializing_if = "Option::is_none")]
2700    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2701    pub backup: Option<ClusterBootstrapRecoveryBackup>,
2702    /// Name of the database used by the application. Default: `app`.
2703    #[serde(default, skip_serializing_if = "Option::is_none")]
2704    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2705    pub database: Option<String>,
2706    /// Name of the owner of the database in the instance to be used
2707    /// by applications. Defaults to the value of the `database` key.
2708    #[serde(default, skip_serializing_if = "Option::is_none")]
2709    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2710    pub owner: Option<String>,
2711    /// By default, the recovery process applies all the available
2712    /// WAL files in the archive (full recovery). However, you can also
2713    /// end the recovery as soon as a consistent state is reached or
2714    /// recover to a point-in-time (PITR) by specifying a `RecoveryTarget` object,
2715    /// as expected by PostgreSQL (i.e., timestamp, transaction Id, LSN, ...).
2716    /// More info: <https://www.postgresql.org/docs/current/runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET>
2717    #[serde(
2718        default,
2719        skip_serializing_if = "Option::is_none",
2720        rename = "recoveryTarget"
2721    )]
2722    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2723    pub recovery_target: Option<ClusterBootstrapRecoveryRecoveryTarget>,
2724    /// Name of the secret containing the initial credentials for the
2725    /// owner of the user database. If empty a new secret will be
2726    /// created from scratch
2727    #[serde(default, skip_serializing_if = "Option::is_none")]
2728    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2729    pub secret: Option<ClusterBootstrapRecoverySecret>,
2730    /// The external cluster whose backup we will restore. This is also
2731    /// used as the name of the folder under which the backup is stored,
2732    /// so it must be set to the name of the source cluster
2733    /// Mutually exclusive with `backup`.
2734    #[serde(default, skip_serializing_if = "Option::is_none")]
2735    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2736    pub source: Option<String>,
2737    /// The static PVC data source(s) from which to initiate the
2738    /// recovery procedure. Currently supporting `VolumeSnapshot`
2739    /// and `PersistentVolumeClaim` resources that map an existing
2740    /// PVC group, compatible with CloudNativePG, and taken with
2741    /// a cold backup copy on a fenced Postgres instance (limitation
2742    /// which will be removed in the future when online backup
2743    /// will be implemented).
2744    /// Mutually exclusive with `backup`.
2745    #[serde(
2746        default,
2747        skip_serializing_if = "Option::is_none",
2748        rename = "volumeSnapshots"
2749    )]
2750    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2751    pub volume_snapshots: Option<ClusterBootstrapRecoveryVolumeSnapshots>,
2752}
2753
2754/// The backup object containing the physical base backup from which to
2755/// initiate the recovery procedure.
2756/// Mutually exclusive with `source` and `volumeSnapshots`.
2757#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2758#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2759#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2760pub struct ClusterBootstrapRecoveryBackup {
2761    /// EndpointCA store the CA bundle of the barman endpoint.
2762    /// Useful when using self-signed certificates to avoid
2763    /// errors with certificate issuer and barman-cloud-wal-archive.
2764    #[serde(
2765        default,
2766        skip_serializing_if = "Option::is_none",
2767        rename = "endpointCA"
2768    )]
2769    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2770    pub endpoint_ca: Option<ClusterBootstrapRecoveryBackupEndpointCa>,
2771    /// Name of the referent.
2772    pub name: String,
2773}
2774
2775/// EndpointCA store the CA bundle of the barman endpoint.
2776/// Useful when using self-signed certificates to avoid
2777/// errors with certificate issuer and barman-cloud-wal-archive.
2778#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2779#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2780#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2781pub struct ClusterBootstrapRecoveryBackupEndpointCa {
2782    /// The key to select
2783    pub key: String,
2784    /// Name of the referent.
2785    pub name: String,
2786}
2787
2788/// By default, the recovery process applies all the available
2789/// WAL files in the archive (full recovery). However, you can also
2790/// end the recovery as soon as a consistent state is reached or
2791/// recover to a point-in-time (PITR) by specifying a `RecoveryTarget` object,
2792/// as expected by PostgreSQL (i.e., timestamp, transaction Id, LSN, ...).
2793/// More info: <https://www.postgresql.org/docs/current/runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET>
2794#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2795#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2796#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2797pub struct ClusterBootstrapRecoveryRecoveryTarget {
2798    /// The ID of the backup from which to start the recovery process.
2799    /// If empty (default) the operator will automatically detect the backup
2800    /// based on targetTime or targetLSN if specified. Otherwise use the
2801    /// latest available backup in chronological order.
2802    #[serde(default, skip_serializing_if = "Option::is_none", rename = "backupID")]
2803    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2804    pub backup_id: Option<String>,
2805    /// Set the target to be exclusive. If omitted, defaults to false, so that
2806    /// in Postgres, `recovery_target_inclusive` will be true
2807    #[serde(default, skip_serializing_if = "Option::is_none")]
2808    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2809    pub exclusive: Option<bool>,
2810    /// End recovery as soon as a consistent state is reached
2811    #[serde(
2812        default,
2813        skip_serializing_if = "Option::is_none",
2814        rename = "targetImmediate"
2815    )]
2816    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2817    pub target_immediate: Option<bool>,
2818    /// The target LSN (Log Sequence Number)
2819    #[serde(default, skip_serializing_if = "Option::is_none", rename = "targetLSN")]
2820    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2821    pub target_lsn: Option<String>,
2822    /// The target name (to be previously created
2823    /// with `pg_create_restore_point`)
2824    #[serde(
2825        default,
2826        skip_serializing_if = "Option::is_none",
2827        rename = "targetName"
2828    )]
2829    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2830    pub target_name: Option<String>,
2831    /// The target timeline ("latest" or a positive integer)
2832    #[serde(default, skip_serializing_if = "Option::is_none", rename = "targetTLI")]
2833    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2834    pub target_tli: Option<String>,
2835    /// The target time as a timestamp in RFC3339 format or PostgreSQL timestamp format.
2836    /// Timestamps without an explicit timezone are interpreted as UTC.
2837    #[serde(
2838        default,
2839        skip_serializing_if = "Option::is_none",
2840        rename = "targetTime"
2841    )]
2842    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2843    pub target_time: Option<String>,
2844    /// The target transaction ID
2845    #[serde(default, skip_serializing_if = "Option::is_none", rename = "targetXID")]
2846    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2847    pub target_xid: Option<String>,
2848}
2849
2850/// Name of the secret containing the initial credentials for the
2851/// owner of the user database. If empty a new secret will be
2852/// created from scratch
2853#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2854#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2855#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2856pub struct ClusterBootstrapRecoverySecret {
2857    /// Name of the referent.
2858    pub name: String,
2859}
2860
2861/// The static PVC data source(s) from which to initiate the
2862/// recovery procedure. Currently supporting `VolumeSnapshot`
2863/// and `PersistentVolumeClaim` resources that map an existing
2864/// PVC group, compatible with CloudNativePG, and taken with
2865/// a cold backup copy on a fenced Postgres instance (limitation
2866/// which will be removed in the future when online backup
2867/// will be implemented).
2868/// Mutually exclusive with `backup`.
2869#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2870#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2871#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2872pub struct ClusterBootstrapRecoveryVolumeSnapshots {
2873    /// Configuration of the storage of the instances
2874    pub storage: ClusterBootstrapRecoveryVolumeSnapshotsStorage,
2875    /// Configuration of the storage for PostgreSQL tablespaces
2876    #[serde(
2877        default,
2878        skip_serializing_if = "Option::is_none",
2879        rename = "tablespaceStorage"
2880    )]
2881    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2882    pub tablespace_storage:
2883        Option<BTreeMap<String, ClusterBootstrapRecoveryVolumeSnapshotsTablespaceStorage>>,
2884    /// Configuration of the storage for PostgreSQL WAL (Write-Ahead Log)
2885    #[serde(
2886        default,
2887        skip_serializing_if = "Option::is_none",
2888        rename = "walStorage"
2889    )]
2890    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2891    pub wal_storage: Option<ClusterBootstrapRecoveryVolumeSnapshotsWalStorage>,
2892}
2893
2894/// Configuration of the storage of the instances
2895#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2896#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2897#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2898pub struct ClusterBootstrapRecoveryVolumeSnapshotsStorage {
2899    /// APIGroup is the group for the resource being referenced.
2900    /// If APIGroup is not specified, the specified Kind must be in the core API group.
2901    /// For any other third-party types, APIGroup is required.
2902    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
2903    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2904    pub api_group: Option<String>,
2905    /// Kind is the type of resource being referenced
2906    pub kind: String,
2907    /// Name is the name of resource being referenced
2908    pub name: String,
2909}
2910
2911/// Configuration of the storage for PostgreSQL tablespaces
2912#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2913#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2914#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2915pub struct ClusterBootstrapRecoveryVolumeSnapshotsTablespaceStorage {
2916    /// APIGroup is the group for the resource being referenced.
2917    /// If APIGroup is not specified, the specified Kind must be in the core API group.
2918    /// For any other third-party types, APIGroup is required.
2919    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
2920    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2921    pub api_group: Option<String>,
2922    /// Kind is the type of resource being referenced
2923    #[serde(default, skip_serializing_if = "Option::is_none")]
2924    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2925    pub kind: Option<String>,
2926    /// Name is the name of resource being referenced
2927    #[serde(default, skip_serializing_if = "Option::is_none")]
2928    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2929    pub name: Option<String>,
2930}
2931
2932/// Configuration of the storage for PostgreSQL WAL (Write-Ahead Log)
2933#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2934#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2935#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2936pub struct ClusterBootstrapRecoveryVolumeSnapshotsWalStorage {
2937    /// APIGroup is the group for the resource being referenced.
2938    /// If APIGroup is not specified, the specified Kind must be in the core API group.
2939    /// For any other third-party types, APIGroup is required.
2940    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
2941    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2942    pub api_group: Option<String>,
2943    /// Kind is the type of resource being referenced
2944    pub kind: String,
2945    /// Name is the name of resource being referenced
2946    pub name: String,
2947}
2948
2949/// The configuration for the CA and related certificates
2950#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
2951#[cfg_attr(feature = "builder", derive(TypedBuilder))]
2952#[cfg_attr(feature = "schemars", derive(JsonSchema))]
2953pub struct ClusterCertificates {
2954    /// The secret containing the Client CA certificate. If not defined, a new secret will be created
2955    /// with a self-signed CA and will be used to generate all the client certificates.<br />
2956    /// <br />
2957    /// Contains:<br />
2958    /// <br />
2959    /// - `ca.crt`: CA that should be used to validate the client certificates,
2960    /// used as `ssl_ca_file` of all the instances.<br />
2961    /// - `ca.key`: key used to generate client certificates, if ReplicationTLSSecret is provided,
2962    /// this can be omitted.<br />
2963    #[serde(
2964        default,
2965        skip_serializing_if = "Option::is_none",
2966        rename = "clientCASecret"
2967    )]
2968    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2969    pub client_ca_secret: Option<String>,
2970    /// The secret of type kubernetes.io/tls containing the client certificate to authenticate as
2971    /// the `streaming_replica` user.
2972    /// If not defined, ClientCASecret must provide also `ca.key`, and a new secret will be
2973    /// created using the provided CA.
2974    #[serde(
2975        default,
2976        skip_serializing_if = "Option::is_none",
2977        rename = "replicationTLSSecret"
2978    )]
2979    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2980    pub replication_tls_secret: Option<String>,
2981    /// The list of the server alternative DNS names to be added to the generated server TLS certificates, when required.
2982    #[serde(
2983        default,
2984        skip_serializing_if = "Option::is_none",
2985        rename = "serverAltDNSNames"
2986    )]
2987    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
2988    pub server_alt_dns_names: Option<Vec<String>>,
2989    /// The secret containing the Server CA certificate. If not defined, a new secret will be created
2990    /// with a self-signed CA and will be used to generate the TLS certificate ServerTLSSecret.<br />
2991    /// <br />
2992    /// Contains:<br />
2993    /// <br />
2994    /// - `ca.crt`: CA that should be used to validate the server certificate,
2995    /// used as `sslrootcert` in client connection strings.<br />
2996    /// - `ca.key`: key used to generate Server SSL certs, if ServerTLSSecret is provided,
2997    /// this can be omitted.<br />
2998    #[serde(
2999        default,
3000        skip_serializing_if = "Option::is_none",
3001        rename = "serverCASecret"
3002    )]
3003    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3004    pub server_ca_secret: Option<String>,
3005    /// The secret of type kubernetes.io/tls containing the server TLS certificate and key that will be set as
3006    /// `ssl_cert_file` and `ssl_key_file` so that clients can connect to postgres securely.
3007    /// If not defined, ServerCASecret must provide also `ca.key` and a new secret will be
3008    /// created using the provided CA.
3009    #[serde(
3010        default,
3011        skip_serializing_if = "Option::is_none",
3012        rename = "serverTLSSecret"
3013    )]
3014    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3015    pub server_tls_secret: Option<String>,
3016}
3017
3018/// EnvVar represents an environment variable present in a Container.
3019#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3020#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3021#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3022pub struct ClusterEnv {
3023    /// Name of the environment variable.
3024    /// May consist of any printable ASCII characters except '='.
3025    pub name: String,
3026    /// Variable references $(VAR_NAME) are expanded
3027    /// using the previously defined environment variables in the container and
3028    /// any service environment variables. If a variable cannot be resolved,
3029    /// the reference in the input string will be unchanged. Double $$ are reduced
3030    /// to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e.
3031    /// "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)".
3032    /// Escaped references will never be expanded, regardless of whether the variable
3033    /// exists or not.
3034    /// Defaults to "".
3035    #[serde(default, skip_serializing_if = "Option::is_none")]
3036    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3037    pub value: Option<String>,
3038    /// Source for the environment variable's value. Cannot be used if value is not empty.
3039    #[serde(default, skip_serializing_if = "Option::is_none", rename = "valueFrom")]
3040    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3041    pub value_from: Option<ClusterEnvValueFrom>,
3042}
3043
3044/// Source for the environment variable's value. Cannot be used if value is not empty.
3045#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3046#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3047#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3048pub struct ClusterEnvValueFrom {
3049    /// Selects a key of a ConfigMap.
3050    #[serde(
3051        default,
3052        skip_serializing_if = "Option::is_none",
3053        rename = "configMapKeyRef"
3054    )]
3055    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3056    pub config_map_key_ref: Option<ClusterEnvValueFromConfigMapKeyRef>,
3057    /// Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`,
3058    /// spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
3059    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldRef")]
3060    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3061    pub field_ref: Option<ClusterEnvValueFromFieldRef>,
3062    /// FileKeyRef selects a key of the env file.
3063    /// Requires the EnvFiles feature gate to be enabled.
3064    #[serde(
3065        default,
3066        skip_serializing_if = "Option::is_none",
3067        rename = "fileKeyRef"
3068    )]
3069    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3070    pub file_key_ref: Option<ClusterEnvValueFromFileKeyRef>,
3071    /// Selects a resource of the container: only resources limits and requests
3072    /// (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.
3073    #[serde(
3074        default,
3075        skip_serializing_if = "Option::is_none",
3076        rename = "resourceFieldRef"
3077    )]
3078    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3079    pub resource_field_ref: Option<ClusterEnvValueFromResourceFieldRef>,
3080    /// Selects a key of a secret in the pod's namespace
3081    #[serde(
3082        default,
3083        skip_serializing_if = "Option::is_none",
3084        rename = "secretKeyRef"
3085    )]
3086    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3087    pub secret_key_ref: Option<ClusterEnvValueFromSecretKeyRef>,
3088}
3089
3090/// Selects a key of a ConfigMap.
3091#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3092#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3093#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3094pub struct ClusterEnvValueFromConfigMapKeyRef {
3095    /// The key to select from the ConfigMap's Data field.
3096    /// Keys in the BinaryData field are not currently propagated to container env vars.
3097    pub key: String,
3098    /// Name of the referent.
3099    /// This field is effectively required, but due to backwards compatibility is
3100    /// allowed to be empty. Instances of this type with an empty value here are
3101    /// almost certainly wrong.
3102    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
3103    #[serde(default, skip_serializing_if = "Option::is_none")]
3104    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3105    pub name: Option<String>,
3106    /// Specify whether the ConfigMap or its key must be defined
3107    #[serde(default, skip_serializing_if = "Option::is_none")]
3108    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3109    pub optional: Option<bool>,
3110}
3111
3112/// Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`,
3113/// spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
3114#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3115#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3116#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3117pub struct ClusterEnvValueFromFieldRef {
3118    /// Version of the schema the FieldPath is written in terms of, defaults to "v1".
3119    #[serde(
3120        default,
3121        skip_serializing_if = "Option::is_none",
3122        rename = "apiVersion"
3123    )]
3124    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3125    pub api_version: Option<String>,
3126    /// Path of the field to select in the specified API version.
3127    #[serde(rename = "fieldPath")]
3128    pub field_path: String,
3129}
3130
3131/// FileKeyRef selects a key of the env file.
3132/// Requires the EnvFiles feature gate to be enabled.
3133#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3134#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3135#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3136pub struct ClusterEnvValueFromFileKeyRef {
3137    /// The key within the env file. An invalid key will prevent the pod from starting.
3138    /// The keys defined within a source may consist of any printable ASCII characters except '='.
3139    /// During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
3140    pub key: String,
3141    /// Specify whether the file or its key must be defined. If the file or key
3142    /// does not exist, then the env var is not published.
3143    /// If optional is set to true and the specified key does not exist,
3144    /// the environment variable will not be set in the Pod's containers.
3145    ///
3146    /// If optional is set to false and the specified key does not exist,
3147    /// an error will be returned during Pod creation.
3148    #[serde(default, skip_serializing_if = "Option::is_none")]
3149    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3150    pub optional: Option<bool>,
3151    /// The path within the volume from which to select the file.
3152    /// Must be relative and may not contain the '..' path or start with '..'.
3153    pub path: String,
3154    /// The name of the volume mount containing the env file.
3155    #[serde(rename = "volumeName")]
3156    pub volume_name: String,
3157}
3158
3159/// Selects a resource of the container: only resources limits and requests
3160/// (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.
3161#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3162#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3163#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3164pub struct ClusterEnvValueFromResourceFieldRef {
3165    /// Container name: required for volumes, optional for env vars
3166    #[serde(
3167        default,
3168        skip_serializing_if = "Option::is_none",
3169        rename = "containerName"
3170    )]
3171    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3172    pub container_name: Option<String>,
3173    /// Specifies the output format of the exposed resources, defaults to "1"
3174    #[serde(default, skip_serializing_if = "Option::is_none")]
3175    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3176    pub divisor: Option<IntOrString>,
3177    /// Required: resource to select
3178    pub resource: String,
3179}
3180
3181/// Selects a key of a secret in the pod's namespace
3182#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3183#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3184#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3185pub struct ClusterEnvValueFromSecretKeyRef {
3186    /// The key of the secret to select from.  Must be a valid secret key.
3187    pub key: String,
3188    /// Name of the referent.
3189    /// This field is effectively required, but due to backwards compatibility is
3190    /// allowed to be empty. Instances of this type with an empty value here are
3191    /// almost certainly wrong.
3192    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
3193    #[serde(default, skip_serializing_if = "Option::is_none")]
3194    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3195    pub name: Option<String>,
3196    /// Specify whether the Secret or its key must be defined
3197    #[serde(default, skip_serializing_if = "Option::is_none")]
3198    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3199    pub optional: Option<bool>,
3200}
3201
3202/// EnvFromSource represents the source of a set of ConfigMaps or Secrets
3203#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3204#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3205#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3206pub struct ClusterEnvFrom {
3207    /// The ConfigMap to select from
3208    #[serde(
3209        default,
3210        skip_serializing_if = "Option::is_none",
3211        rename = "configMapRef"
3212    )]
3213    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3214    pub config_map_ref: Option<ClusterEnvFromConfigMapRef>,
3215    /// Optional text to prepend to the name of each environment variable.
3216    /// May consist of any printable ASCII characters except '='.
3217    #[serde(default, skip_serializing_if = "Option::is_none")]
3218    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3219    pub prefix: Option<String>,
3220    /// The Secret to select from
3221    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")]
3222    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3223    pub secret_ref: Option<ClusterEnvFromSecretRef>,
3224}
3225
3226/// The ConfigMap to select from
3227#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3228#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3229#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3230pub struct ClusterEnvFromConfigMapRef {
3231    /// Name of the referent.
3232    /// This field is effectively required, but due to backwards compatibility is
3233    /// allowed to be empty. Instances of this type with an empty value here are
3234    /// almost certainly wrong.
3235    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
3236    #[serde(default, skip_serializing_if = "Option::is_none")]
3237    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3238    pub name: Option<String>,
3239    /// Specify whether the ConfigMap must be defined
3240    #[serde(default, skip_serializing_if = "Option::is_none")]
3241    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3242    pub optional: Option<bool>,
3243}
3244
3245/// The Secret to select from
3246#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3247#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3248#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3249pub struct ClusterEnvFromSecretRef {
3250    /// Name of the referent.
3251    /// This field is effectively required, but due to backwards compatibility is
3252    /// allowed to be empty. Instances of this type with an empty value here are
3253    /// almost certainly wrong.
3254    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
3255    #[serde(default, skip_serializing_if = "Option::is_none")]
3256    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3257    pub name: Option<String>,
3258    /// Specify whether the Secret must be defined
3259    #[serde(default, skip_serializing_if = "Option::is_none")]
3260    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3261    pub optional: Option<bool>,
3262}
3263
3264/// EphemeralVolumeSource allows the user to configure the source of ephemeral volumes.
3265#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3266#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3267#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3268pub struct ClusterEphemeralVolumeSource {
3269    /// Will be used to create a stand-alone PVC to provision the volume.
3270    /// The pod in which this EphemeralVolumeSource is embedded will be the
3271    /// owner of the PVC, i.e. the PVC will be deleted together with the
3272    /// pod.  The name of the PVC will be `<pod name>-<volume name>` where
3273    /// `<volume name>` is the name from the `PodSpec.Volumes` array
3274    /// entry. Pod validation will reject the pod if the concatenated name
3275    /// is not valid for a PVC (for example, too long).
3276    ///
3277    /// An existing PVC with that name that is not owned by the pod
3278    /// will *not* be used for the pod to avoid using an unrelated
3279    /// volume by mistake. Starting the pod is then blocked until
3280    /// the unrelated PVC is removed. If such a pre-created PVC is
3281    /// meant to be used by the pod, the PVC has to updated with an
3282    /// owner reference to the pod once the pod exists. Normally
3283    /// this should not be necessary, but it may be useful when
3284    /// manually reconstructing a broken cluster.
3285    ///
3286    /// This field is read-only and no changes will be made by Kubernetes
3287    /// to the PVC after it has been created.
3288    ///
3289    /// Required, must not be nil.
3290    #[serde(
3291        default,
3292        skip_serializing_if = "Option::is_none",
3293        rename = "volumeClaimTemplate"
3294    )]
3295    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3296    pub volume_claim_template: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplate>,
3297}
3298
3299/// Will be used to create a stand-alone PVC to provision the volume.
3300/// The pod in which this EphemeralVolumeSource is embedded will be the
3301/// owner of the PVC, i.e. the PVC will be deleted together with the
3302/// pod.  The name of the PVC will be `<pod name>-<volume name>` where
3303/// `<volume name>` is the name from the `PodSpec.Volumes` array
3304/// entry. Pod validation will reject the pod if the concatenated name
3305/// is not valid for a PVC (for example, too long).
3306///
3307/// An existing PVC with that name that is not owned by the pod
3308/// will *not* be used for the pod to avoid using an unrelated
3309/// volume by mistake. Starting the pod is then blocked until
3310/// the unrelated PVC is removed. If such a pre-created PVC is
3311/// meant to be used by the pod, the PVC has to updated with an
3312/// owner reference to the pod once the pod exists. Normally
3313/// this should not be necessary, but it may be useful when
3314/// manually reconstructing a broken cluster.
3315///
3316/// This field is read-only and no changes will be made by Kubernetes
3317/// to the PVC after it has been created.
3318///
3319/// Required, must not be nil.
3320#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3321#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3322#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3323pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplate {
3324    /// May contain labels and annotations that will be copied into the PVC
3325    /// when creating it. No other fields are allowed and will be rejected during
3326    /// validation.
3327    #[serde(default, skip_serializing_if = "Option::is_none")]
3328    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3329    pub metadata: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplateMetadata>,
3330    /// The specification for the PersistentVolumeClaim. The entire content is
3331    /// copied unchanged into the PVC that gets created from this
3332    /// template. The same fields as in a PersistentVolumeClaim
3333    /// are also valid here.
3334    pub spec: ClusterEphemeralVolumeSourceVolumeClaimTemplateSpec,
3335}
3336
3337/// May contain labels and annotations that will be copied into the PVC
3338/// when creating it. No other fields are allowed and will be rejected during
3339/// validation.
3340#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3341#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3342#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3343pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateMetadata {}
3344
3345/// The specification for the PersistentVolumeClaim. The entire content is
3346/// copied unchanged into the PVC that gets created from this
3347/// template. The same fields as in a PersistentVolumeClaim
3348/// are also valid here.
3349#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3350#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3351#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3352pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpec {
3353    /// accessModes contains the desired access modes the volume should have.
3354    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1>
3355    #[serde(
3356        default,
3357        skip_serializing_if = "Option::is_none",
3358        rename = "accessModes"
3359    )]
3360    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3361    pub access_modes: Option<Vec<String>>,
3362    /// dataSource field can be used to specify either:
3363    /// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
3364    /// * An existing PVC (PersistentVolumeClaim)
3365    /// If the provisioner or an external controller can support the specified data source,
3366    /// it will create a new volume based on the contents of the specified data source.
3367    /// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
3368    /// copied to dataSource when dataSourceRef.namespace is not specified.
3369    /// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
3370    #[serde(
3371        default,
3372        skip_serializing_if = "Option::is_none",
3373        rename = "dataSource"
3374    )]
3375    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3376    pub data_source: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecDataSource>,
3377    /// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
3378    /// volume is desired. This may be any object from a non-empty API group (non
3379    /// core object) or a PersistentVolumeClaim object.
3380    /// When this field is specified, volume binding will only succeed if the type of
3381    /// the specified object matches some installed volume populator or dynamic
3382    /// provisioner.
3383    /// This field will replace the functionality of the dataSource field and as such
3384    /// if both fields are non-empty, they must have the same value. For backwards
3385    /// compatibility, when namespace isn't specified in dataSourceRef,
3386    /// both fields (dataSource and dataSourceRef) will be set to the same
3387    /// value automatically if one of them is empty and the other is non-empty.
3388    /// When namespace is specified in dataSourceRef,
3389    /// dataSource isn't set to the same value and must be empty.
3390    /// There are three important differences between dataSource and dataSourceRef:
3391    /// * While dataSource only allows two specific types of objects, dataSourceRef
3392    ///   allows any non-core object, as well as PersistentVolumeClaim objects.
3393    /// * While dataSource ignores disallowed values (dropping them), dataSourceRef
3394    ///   preserves all values, and generates an error if a disallowed value is
3395    ///   specified.
3396    /// * While dataSource only allows local objects, dataSourceRef allows objects
3397    ///   in any namespaces.
3398    /// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
3399    #[serde(
3400        default,
3401        skip_serializing_if = "Option::is_none",
3402        rename = "dataSourceRef"
3403    )]
3404    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3405    pub data_source_ref: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecDataSourceRef>,
3406    /// resources represents the minimum resources the volume should have.
3407    /// Users are allowed to specify resource requirements
3408    /// that are lower than previous value but must still be higher than capacity recorded in the
3409    /// status field of the claim.
3410    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
3411    #[serde(default, skip_serializing_if = "Option::is_none")]
3412    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3413    pub resources: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecResources>,
3414    /// selector is a label query over volumes to consider for binding.
3415    #[serde(default, skip_serializing_if = "Option::is_none")]
3416    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3417    pub selector: Option<ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecSelector>,
3418    /// storageClassName is the name of the StorageClass required by the claim.
3419    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1>
3420    #[serde(
3421        default,
3422        skip_serializing_if = "Option::is_none",
3423        rename = "storageClassName"
3424    )]
3425    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3426    pub storage_class_name: Option<String>,
3427    /// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
3428    /// If specified, the CSI driver will create or update the volume with the attributes defined
3429    /// in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName,
3430    /// it can be changed after the claim is created. An empty string or nil value indicates that no
3431    /// VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state,
3432    /// this field can be reset to its previous value (including nil) to cancel the modification.
3433    /// If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be
3434    /// set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource
3435    /// exists.
3436    /// More info: <https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/>
3437    #[serde(
3438        default,
3439        skip_serializing_if = "Option::is_none",
3440        rename = "volumeAttributesClassName"
3441    )]
3442    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3443    pub volume_attributes_class_name: Option<String>,
3444    /// volumeMode defines what type of volume is required by the claim.
3445    /// Value of Filesystem is implied when not included in claim spec.
3446    #[serde(
3447        default,
3448        skip_serializing_if = "Option::is_none",
3449        rename = "volumeMode"
3450    )]
3451    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3452    pub volume_mode: Option<String>,
3453    /// volumeName is the binding reference to the PersistentVolume backing this claim.
3454    #[serde(
3455        default,
3456        skip_serializing_if = "Option::is_none",
3457        rename = "volumeName"
3458    )]
3459    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3460    pub volume_name: Option<String>,
3461}
3462
3463/// dataSource field can be used to specify either:
3464/// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
3465/// * An existing PVC (PersistentVolumeClaim)
3466/// If the provisioner or an external controller can support the specified data source,
3467/// it will create a new volume based on the contents of the specified data source.
3468/// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
3469/// copied to dataSource when dataSourceRef.namespace is not specified.
3470/// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
3471#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3472#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3473#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3474pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecDataSource {
3475    /// APIGroup is the group for the resource being referenced.
3476    /// If APIGroup is not specified, the specified Kind must be in the core API group.
3477    /// For any other third-party types, APIGroup is required.
3478    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
3479    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3480    pub api_group: Option<String>,
3481    /// Kind is the type of resource being referenced
3482    pub kind: String,
3483    /// Name is the name of resource being referenced
3484    pub name: String,
3485}
3486
3487/// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
3488/// volume is desired. This may be any object from a non-empty API group (non
3489/// core object) or a PersistentVolumeClaim object.
3490/// When this field is specified, volume binding will only succeed if the type of
3491/// the specified object matches some installed volume populator or dynamic
3492/// provisioner.
3493/// This field will replace the functionality of the dataSource field and as such
3494/// if both fields are non-empty, they must have the same value. For backwards
3495/// compatibility, when namespace isn't specified in dataSourceRef,
3496/// both fields (dataSource and dataSourceRef) will be set to the same
3497/// value automatically if one of them is empty and the other is non-empty.
3498/// When namespace is specified in dataSourceRef,
3499/// dataSource isn't set to the same value and must be empty.
3500/// There are three important differences between dataSource and dataSourceRef:
3501/// * While dataSource only allows two specific types of objects, dataSourceRef
3502///   allows any non-core object, as well as PersistentVolumeClaim objects.
3503/// * While dataSource ignores disallowed values (dropping them), dataSourceRef
3504///   preserves all values, and generates an error if a disallowed value is
3505///   specified.
3506/// * While dataSource only allows local objects, dataSourceRef allows objects
3507///   in any namespaces.
3508/// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
3509#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3510#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3511#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3512pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecDataSourceRef {
3513    /// APIGroup is the group for the resource being referenced.
3514    /// If APIGroup is not specified, the specified Kind must be in the core API group.
3515    /// For any other third-party types, APIGroup is required.
3516    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
3517    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3518    pub api_group: Option<String>,
3519    /// Kind is the type of resource being referenced
3520    pub kind: String,
3521    /// Name is the name of resource being referenced
3522    pub name: String,
3523    /// Namespace is the namespace of resource being referenced
3524    /// Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details.
3525    /// (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
3526    #[serde(default, skip_serializing_if = "Option::is_none")]
3527    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3528    pub namespace: Option<String>,
3529}
3530
3531/// resources represents the minimum resources the volume should have.
3532/// Users are allowed to specify resource requirements
3533/// that are lower than previous value but must still be higher than capacity recorded in the
3534/// status field of the claim.
3535/// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
3536#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3537#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3538#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3539pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecResources {
3540    /// Limits describes the maximum amount of compute resources allowed.
3541    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
3542    #[serde(default, skip_serializing_if = "Option::is_none")]
3543    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3544    pub limits: Option<BTreeMap<String, IntOrString>>,
3545    /// Requests describes the minimum amount of compute resources required.
3546    /// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
3547    /// otherwise to an implementation-defined value. Requests cannot exceed Limits.
3548    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
3549    #[serde(default, skip_serializing_if = "Option::is_none")]
3550    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3551    pub requests: Option<BTreeMap<String, IntOrString>>,
3552}
3553
3554/// selector is a label query over volumes to consider for binding.
3555#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3556#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3557#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3558pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecSelector {
3559    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
3560    #[serde(
3561        default,
3562        skip_serializing_if = "Option::is_none",
3563        rename = "matchExpressions"
3564    )]
3565    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3566    pub match_expressions:
3567        Option<Vec<ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecSelectorMatchExpressions>>,
3568    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3569    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
3570    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
3571    #[serde(
3572        default,
3573        skip_serializing_if = "Option::is_none",
3574        rename = "matchLabels"
3575    )]
3576    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3577    pub match_labels: Option<BTreeMap<String, String>>,
3578}
3579
3580/// A label selector requirement is a selector that contains values, a key, and an operator that
3581/// relates the key and values.
3582#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3583#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3584#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3585pub struct ClusterEphemeralVolumeSourceVolumeClaimTemplateSpecSelectorMatchExpressions {
3586    /// key is the label key that the selector applies to.
3587    pub key: String,
3588    /// operator represents a key's relationship to a set of values.
3589    /// Valid operators are In, NotIn, Exists and DoesNotExist.
3590    pub operator: String,
3591    /// values is an array of string values. If the operator is In or NotIn,
3592    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
3593    /// the values array must be empty. This array is replaced during a strategic
3594    /// merge patch.
3595    #[serde(default, skip_serializing_if = "Option::is_none")]
3596    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3597    pub values: Option<Vec<String>>,
3598}
3599
3600/// EphemeralVolumesSizeLimit allows the user to set the limits for the ephemeral
3601/// volumes
3602#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3603#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3604#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3605pub struct ClusterEphemeralVolumesSizeLimit {
3606    /// Shm is the size limit of the shared memory volume
3607    #[serde(default, skip_serializing_if = "Option::is_none")]
3608    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3609    pub shm: Option<IntOrString>,
3610    /// TemporaryData is the size limit of the temporary data volume
3611    #[serde(
3612        default,
3613        skip_serializing_if = "Option::is_none",
3614        rename = "temporaryData"
3615    )]
3616    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3617    pub temporary_data: Option<IntOrString>,
3618}
3619
3620/// ExternalCluster represents the connection parameters to an
3621/// external cluster which is used in the other sections of the configuration
3622#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3623#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3624#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3625pub struct ClusterExternalClusters {
3626    /// The configuration for the barman-cloud tool suite
3627    #[serde(
3628        default,
3629        skip_serializing_if = "Option::is_none",
3630        rename = "barmanObjectStore"
3631    )]
3632    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3633    pub barman_object_store: Option<ClusterExternalClustersBarmanObjectStore>,
3634    /// The list of connection parameters, such as dbname, host, username, etc
3635    #[serde(
3636        default,
3637        skip_serializing_if = "Option::is_none",
3638        rename = "connectionParameters"
3639    )]
3640    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3641    pub connection_parameters: Option<BTreeMap<String, String>>,
3642    /// The server name, required
3643    pub name: String,
3644    /// The reference to the password to be used to connect to the server.
3645    /// If a password is provided, CloudNativePG creates a PostgreSQL
3646    /// passfile at `/controller/external/NAME/pass` (where "NAME" is the
3647    /// cluster's name). This passfile is automatically referenced in the
3648    /// connection string when establishing a connection to the remote
3649    /// PostgreSQL server from the current PostgreSQL `Cluster`. This ensures
3650    /// secure and efficient password management for external clusters.
3651    #[serde(default, skip_serializing_if = "Option::is_none")]
3652    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3653    pub password: Option<ClusterExternalClustersPassword>,
3654    /// The configuration of the plugin that is taking care
3655    /// of WAL archiving and backups for this external cluster
3656    #[serde(default, skip_serializing_if = "Option::is_none")]
3657    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3658    pub plugin: Option<ClusterExternalClustersPlugin>,
3659    /// The reference to an SSL certificate to be used to connect to this
3660    /// instance
3661    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslCert")]
3662    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3663    pub ssl_cert: Option<ClusterExternalClustersSslCert>,
3664    /// The reference to an SSL private key to be used to connect to this
3665    /// instance
3666    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslKey")]
3667    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3668    pub ssl_key: Option<ClusterExternalClustersSslKey>,
3669    /// The reference to an SSL CA public key to be used to connect to this
3670    /// instance
3671    #[serde(
3672        default,
3673        skip_serializing_if = "Option::is_none",
3674        rename = "sslRootCert"
3675    )]
3676    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3677    pub ssl_root_cert: Option<ClusterExternalClustersSslRootCert>,
3678}
3679
3680/// The configuration for the barman-cloud tool suite
3681#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3682#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3683#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3684pub struct ClusterExternalClustersBarmanObjectStore {
3685    /// The credentials to use to upload data to Azure Blob Storage
3686    #[serde(
3687        default,
3688        skip_serializing_if = "Option::is_none",
3689        rename = "azureCredentials"
3690    )]
3691    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3692    pub azure_credentials: Option<ClusterExternalClustersBarmanObjectStoreAzureCredentials>,
3693    /// The configuration to be used to backup the data files
3694    /// When not defined, base backups files will be stored uncompressed and may
3695    /// be unencrypted in the object store, according to the bucket default
3696    /// policy.
3697    #[serde(default, skip_serializing_if = "Option::is_none")]
3698    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3699    pub data: Option<ClusterExternalClustersBarmanObjectStoreData>,
3700    /// The path where to store the backup (i.e. s3://bucket/path/to/folder)
3701    /// this path, with different destination folders, will be used for WALs
3702    /// and for data
3703    #[serde(rename = "destinationPath")]
3704    pub destination_path: String,
3705    /// EndpointCA store the CA bundle of the barman endpoint.
3706    /// Useful when using self-signed certificates to avoid
3707    /// errors with certificate issuer and barman-cloud-wal-archive
3708    #[serde(
3709        default,
3710        skip_serializing_if = "Option::is_none",
3711        rename = "endpointCA"
3712    )]
3713    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3714    pub endpoint_ca: Option<ClusterExternalClustersBarmanObjectStoreEndpointCa>,
3715    /// Endpoint to be used to upload data to the cloud,
3716    /// overriding the automatic endpoint discovery
3717    #[serde(
3718        default,
3719        skip_serializing_if = "Option::is_none",
3720        rename = "endpointURL"
3721    )]
3722    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3723    pub endpoint_url: Option<String>,
3724    /// The credentials to use to upload data to Google Cloud Storage
3725    #[serde(
3726        default,
3727        skip_serializing_if = "Option::is_none",
3728        rename = "googleCredentials"
3729    )]
3730    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3731    pub google_credentials: Option<ClusterExternalClustersBarmanObjectStoreGoogleCredentials>,
3732    /// HistoryTags is a list of key value pairs that will be passed to the
3733    /// Barman --history-tags option.
3734    #[serde(
3735        default,
3736        skip_serializing_if = "Option::is_none",
3737        rename = "historyTags"
3738    )]
3739    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3740    pub history_tags: Option<BTreeMap<String, String>>,
3741    /// The credentials to use to upload data to S3
3742    #[serde(
3743        default,
3744        skip_serializing_if = "Option::is_none",
3745        rename = "s3Credentials"
3746    )]
3747    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3748    pub s3_credentials: Option<ClusterExternalClustersBarmanObjectStoreS3Credentials>,
3749    /// The server name on S3, the cluster name is used if this
3750    /// parameter is omitted
3751    #[serde(
3752        default,
3753        skip_serializing_if = "Option::is_none",
3754        rename = "serverName"
3755    )]
3756    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3757    pub server_name: Option<String>,
3758    /// Tags is a list of key value pairs that will be passed to the
3759    /// Barman --tags option.
3760    #[serde(default, skip_serializing_if = "Option::is_none")]
3761    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3762    pub tags: Option<BTreeMap<String, String>>,
3763    /// The configuration for the backup of the WAL stream.
3764    /// When not defined, WAL files will be stored uncompressed and may be
3765    /// unencrypted in the object store, according to the bucket default policy.
3766    #[serde(default, skip_serializing_if = "Option::is_none")]
3767    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3768    pub wal: Option<ClusterExternalClustersBarmanObjectStoreWal>,
3769}
3770
3771/// The credentials to use to upload data to Azure Blob Storage
3772#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3773#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3774#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3775pub struct ClusterExternalClustersBarmanObjectStoreAzureCredentials {
3776    /// The connection string to be used
3777    #[serde(
3778        default,
3779        skip_serializing_if = "Option::is_none",
3780        rename = "connectionString"
3781    )]
3782    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3783    pub connection_string:
3784        Option<ClusterExternalClustersBarmanObjectStoreAzureCredentialsConnectionString>,
3785    /// Use the Azure AD based authentication without providing explicitly the keys.
3786    #[serde(
3787        default,
3788        skip_serializing_if = "Option::is_none",
3789        rename = "inheritFromAzureAD"
3790    )]
3791    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3792    pub inherit_from_azure_ad: Option<bool>,
3793    /// The storage account where to upload data
3794    #[serde(
3795        default,
3796        skip_serializing_if = "Option::is_none",
3797        rename = "storageAccount"
3798    )]
3799    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3800    pub storage_account:
3801        Option<ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageAccount>,
3802    /// The storage account key to be used in conjunction
3803    /// with the storage account name
3804    #[serde(
3805        default,
3806        skip_serializing_if = "Option::is_none",
3807        rename = "storageKey"
3808    )]
3809    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3810    pub storage_key: Option<ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageKey>,
3811    /// A shared-access-signature to be used in conjunction with
3812    /// the storage account name
3813    #[serde(
3814        default,
3815        skip_serializing_if = "Option::is_none",
3816        rename = "storageSasToken"
3817    )]
3818    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3819    pub storage_sas_token:
3820        Option<ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageSasToken>,
3821    /// Use the default Azure authentication flow, which includes DefaultAzureCredential.
3822    /// This allows authentication using environment variables and managed identities.
3823    #[serde(
3824        default,
3825        skip_serializing_if = "Option::is_none",
3826        rename = "useDefaultAzureCredentials"
3827    )]
3828    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3829    pub use_default_azure_credentials: Option<bool>,
3830}
3831
3832/// The connection string to be used
3833#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3834#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3835#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3836pub struct ClusterExternalClustersBarmanObjectStoreAzureCredentialsConnectionString {
3837    /// The key to select
3838    pub key: String,
3839    /// Name of the referent.
3840    pub name: String,
3841}
3842
3843/// The storage account where to upload data
3844#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3845#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3846#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3847pub struct ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageAccount {
3848    /// The key to select
3849    pub key: String,
3850    /// Name of the referent.
3851    pub name: String,
3852}
3853
3854/// The storage account key to be used in conjunction
3855/// with the storage account name
3856#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3857#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3858#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3859pub struct ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageKey {
3860    /// The key to select
3861    pub key: String,
3862    /// Name of the referent.
3863    pub name: String,
3864}
3865
3866/// A shared-access-signature to be used in conjunction with
3867/// the storage account name
3868#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3869#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3870#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3871pub struct ClusterExternalClustersBarmanObjectStoreAzureCredentialsStorageSasToken {
3872    /// The key to select
3873    pub key: String,
3874    /// Name of the referent.
3875    pub name: String,
3876}
3877
3878/// The configuration to be used to backup the data files
3879/// When not defined, base backups files will be stored uncompressed and may
3880/// be unencrypted in the object store, according to the bucket default
3881/// policy.
3882#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3883#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3884#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3885pub struct ClusterExternalClustersBarmanObjectStoreData {
3886    /// AdditionalCommandArgs represents additional arguments that can be appended
3887    /// to the 'barman-cloud-backup' command-line invocation. These arguments
3888    /// provide flexibility to customize the backup process further according to
3889    /// specific requirements or configurations.
3890    ///
3891    /// Example:
3892    /// In a scenario where specialized backup options are required, such as setting
3893    /// a specific timeout or defining custom behavior, users can use this field
3894    /// to specify additional command arguments.
3895    ///
3896    /// Note:
3897    /// It's essential to ensure that the provided arguments are valid and supported
3898    /// by the 'barman-cloud-backup' command, to avoid potential errors or unintended
3899    /// behavior during execution.
3900    #[serde(
3901        default,
3902        skip_serializing_if = "Option::is_none",
3903        rename = "additionalCommandArgs"
3904    )]
3905    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3906    pub additional_command_args: Option<Vec<String>>,
3907    /// Compress a backup file (a tar file per tablespace) while streaming it
3908    /// to the object store. Available options are empty string (no
3909    /// compression, default), `gzip`, `bzip2`, `lz4`, and `snappy`.
3910    #[serde(default, skip_serializing_if = "Option::is_none")]
3911    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3912    pub compression: Option<ClusterExternalClustersBarmanObjectStoreDataCompression>,
3913    /// Whenever to force the encryption of files (if the bucket is
3914    /// not already configured for that).
3915    /// Allowed options are empty string (use the bucket policy, default),
3916    /// `AES256` and `aws:kms`
3917    #[serde(default, skip_serializing_if = "Option::is_none")]
3918    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3919    pub encryption: Option<ClusterExternalClustersBarmanObjectStoreDataEncryption>,
3920    /// Control whether the I/O workload for the backup initial checkpoint will
3921    /// be limited, according to the `checkpoint_completion_target` setting on
3922    /// the PostgreSQL server. If set to true, an immediate checkpoint will be
3923    /// used, meaning PostgreSQL will complete the checkpoint as soon as
3924    /// possible. `false` by default.
3925    #[serde(
3926        default,
3927        skip_serializing_if = "Option::is_none",
3928        rename = "immediateCheckpoint"
3929    )]
3930    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3931    pub immediate_checkpoint: Option<bool>,
3932    /// The number of parallel jobs to be used to upload the backup, defaults
3933    /// to 2
3934    #[serde(default, skip_serializing_if = "Option::is_none")]
3935    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3936    pub jobs: Option<i32>,
3937    /// Additional arguments that can be appended to the 'barman-cloud-restore'
3938    /// command-line invocation. These arguments provide flexibility to customize
3939    /// the data restore process further, according to specific requirements or
3940    /// configurations.
3941    ///
3942    /// Example:
3943    /// In a scenario where specialized restore options are required, such as setting
3944    /// a specific read timeout or defining custom behavior, users can use this field
3945    /// to specify additional command arguments.
3946    ///
3947    /// Note:
3948    /// It's essential to ensure that the provided arguments are valid and supported
3949    /// by the 'barman-cloud-restore' command, to avoid potential errors or unintended
3950    /// behavior during execution.
3951    #[serde(
3952        default,
3953        skip_serializing_if = "Option::is_none",
3954        rename = "restoreAdditionalCommandArgs"
3955    )]
3956    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
3957    pub restore_additional_command_args: Option<Vec<String>>,
3958}
3959
3960/// The configuration to be used to backup the data files
3961/// When not defined, base backups files will be stored uncompressed and may
3962/// be unencrypted in the object store, according to the bucket default
3963/// policy.
3964#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
3965#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3966pub enum ClusterExternalClustersBarmanObjectStoreDataCompression {
3967    #[serde(rename = "bzip2")]
3968    Bzip2,
3969    #[serde(rename = "gzip")]
3970    Gzip,
3971    #[serde(rename = "lz4")]
3972    Lz4,
3973    #[serde(rename = "snappy")]
3974    Snappy,
3975}
3976
3977/// The configuration to be used to backup the data files
3978/// When not defined, base backups files will be stored uncompressed and may
3979/// be unencrypted in the object store, according to the bucket default
3980/// policy.
3981#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
3982#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3983pub enum ClusterExternalClustersBarmanObjectStoreDataEncryption {
3984    #[serde(rename = "AES256")]
3985    Aes256,
3986    #[serde(rename = "aws:kms")]
3987    AwsKms,
3988}
3989
3990/// EndpointCA store the CA bundle of the barman endpoint.
3991/// Useful when using self-signed certificates to avoid
3992/// errors with certificate issuer and barman-cloud-wal-archive
3993#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
3994#[cfg_attr(feature = "builder", derive(TypedBuilder))]
3995#[cfg_attr(feature = "schemars", derive(JsonSchema))]
3996pub struct ClusterExternalClustersBarmanObjectStoreEndpointCa {
3997    /// The key to select
3998    pub key: String,
3999    /// Name of the referent.
4000    pub name: String,
4001}
4002
4003/// The credentials to use to upload data to Google Cloud Storage
4004#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4005#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4006#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4007pub struct ClusterExternalClustersBarmanObjectStoreGoogleCredentials {
4008    /// The secret containing the Google Cloud Storage JSON file with the credentials
4009    #[serde(
4010        default,
4011        skip_serializing_if = "Option::is_none",
4012        rename = "applicationCredentials"
4013    )]
4014    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4015    pub application_credentials:
4016        Option<ClusterExternalClustersBarmanObjectStoreGoogleCredentialsApplicationCredentials>,
4017    /// If set to true, will presume that it's running inside a GKE environment,
4018    /// default to false.
4019    #[serde(
4020        default,
4021        skip_serializing_if = "Option::is_none",
4022        rename = "gkeEnvironment"
4023    )]
4024    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4025    pub gke_environment: Option<bool>,
4026}
4027
4028/// The secret containing the Google Cloud Storage JSON file with the credentials
4029#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4030#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4031#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4032pub struct ClusterExternalClustersBarmanObjectStoreGoogleCredentialsApplicationCredentials {
4033    /// The key to select
4034    pub key: String,
4035    /// Name of the referent.
4036    pub name: String,
4037}
4038
4039/// The credentials to use to upload data to S3
4040#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4041#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4042#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4043pub struct ClusterExternalClustersBarmanObjectStoreS3Credentials {
4044    /// The reference to the access key id
4045    #[serde(
4046        default,
4047        skip_serializing_if = "Option::is_none",
4048        rename = "accessKeyId"
4049    )]
4050    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4051    pub access_key_id: Option<ClusterExternalClustersBarmanObjectStoreS3CredentialsAccessKeyId>,
4052    /// Use the role based authentication without providing explicitly the keys.
4053    #[serde(
4054        default,
4055        skip_serializing_if = "Option::is_none",
4056        rename = "inheritFromIAMRole"
4057    )]
4058    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4059    pub inherit_from_iam_role: Option<bool>,
4060    /// The reference to the secret containing the region name
4061    #[serde(default, skip_serializing_if = "Option::is_none")]
4062    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4063    pub region: Option<ClusterExternalClustersBarmanObjectStoreS3CredentialsRegion>,
4064    /// The reference to the secret access key
4065    #[serde(
4066        default,
4067        skip_serializing_if = "Option::is_none",
4068        rename = "secretAccessKey"
4069    )]
4070    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4071    pub secret_access_key:
4072        Option<ClusterExternalClustersBarmanObjectStoreS3CredentialsSecretAccessKey>,
4073    /// The references to the session key
4074    #[serde(
4075        default,
4076        skip_serializing_if = "Option::is_none",
4077        rename = "sessionToken"
4078    )]
4079    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4080    pub session_token: Option<ClusterExternalClustersBarmanObjectStoreS3CredentialsSessionToken>,
4081}
4082
4083/// The reference to the access key id
4084#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4085#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4086#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4087pub struct ClusterExternalClustersBarmanObjectStoreS3CredentialsAccessKeyId {
4088    /// The key to select
4089    pub key: String,
4090    /// Name of the referent.
4091    pub name: String,
4092}
4093
4094/// The reference to the secret containing the region name
4095#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4096#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4097#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4098pub struct ClusterExternalClustersBarmanObjectStoreS3CredentialsRegion {
4099    /// The key to select
4100    pub key: String,
4101    /// Name of the referent.
4102    pub name: String,
4103}
4104
4105/// The reference to the secret access key
4106#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4107#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4108#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4109pub struct ClusterExternalClustersBarmanObjectStoreS3CredentialsSecretAccessKey {
4110    /// The key to select
4111    pub key: String,
4112    /// Name of the referent.
4113    pub name: String,
4114}
4115
4116/// The references to the session key
4117#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4118#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4119#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4120pub struct ClusterExternalClustersBarmanObjectStoreS3CredentialsSessionToken {
4121    /// The key to select
4122    pub key: String,
4123    /// Name of the referent.
4124    pub name: String,
4125}
4126
4127/// The configuration for the backup of the WAL stream.
4128/// When not defined, WAL files will be stored uncompressed and may be
4129/// unencrypted in the object store, according to the bucket default policy.
4130#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4131#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4132#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4133pub struct ClusterExternalClustersBarmanObjectStoreWal {
4134    /// Additional arguments that can be appended to the 'barman-cloud-wal-archive'
4135    /// command-line invocation. These arguments provide flexibility to customize
4136    /// the WAL archive process further, according to specific requirements or configurations.
4137    ///
4138    /// Example:
4139    /// In a scenario where specialized backup options are required, such as setting
4140    /// a specific timeout or defining custom behavior, users can use this field
4141    /// to specify additional command arguments.
4142    ///
4143    /// Note:
4144    /// It's essential to ensure that the provided arguments are valid and supported
4145    /// by the 'barman-cloud-wal-archive' command, to avoid potential errors or unintended
4146    /// behavior during execution.
4147    #[serde(
4148        default,
4149        skip_serializing_if = "Option::is_none",
4150        rename = "archiveAdditionalCommandArgs"
4151    )]
4152    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4153    pub archive_additional_command_args: Option<Vec<String>>,
4154    /// Compress a WAL file before sending it to the object store. Available
4155    /// options are empty string (no compression, default), `gzip`, `bzip2`,
4156    /// `lz4`, `snappy`, `xz`, and `zstd`.
4157    #[serde(default, skip_serializing_if = "Option::is_none")]
4158    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4159    pub compression: Option<ClusterExternalClustersBarmanObjectStoreWalCompression>,
4160    /// Whenever to force the encryption of files (if the bucket is
4161    /// not already configured for that).
4162    /// Allowed options are empty string (use the bucket policy, default),
4163    /// `AES256` and `aws:kms`
4164    #[serde(default, skip_serializing_if = "Option::is_none")]
4165    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4166    pub encryption: Option<ClusterExternalClustersBarmanObjectStoreWalEncryption>,
4167    /// Number of WAL files to be either archived in parallel (when the
4168    /// PostgreSQL instance is archiving to a backup object store) or
4169    /// restored in parallel (when a PostgreSQL standby is fetching WAL
4170    /// files from a recovery object store). If not specified, WAL files
4171    /// will be processed one at a time. It accepts a positive integer as a
4172    /// value - with 1 being the minimum accepted value.
4173    #[serde(
4174        default,
4175        skip_serializing_if = "Option::is_none",
4176        rename = "maxParallel"
4177    )]
4178    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4179    pub max_parallel: Option<i64>,
4180    /// Additional arguments that can be appended to the 'barman-cloud-wal-restore'
4181    /// command-line invocation. These arguments provide flexibility to customize
4182    /// the WAL restore process further, according to specific requirements or configurations.
4183    ///
4184    /// Example:
4185    /// In a scenario where specialized backup options are required, such as setting
4186    /// a specific timeout or defining custom behavior, users can use this field
4187    /// to specify additional command arguments.
4188    ///
4189    /// Note:
4190    /// It's essential to ensure that the provided arguments are valid and supported
4191    /// by the 'barman-cloud-wal-restore' command, to avoid potential errors or unintended
4192    /// behavior during execution.
4193    #[serde(
4194        default,
4195        skip_serializing_if = "Option::is_none",
4196        rename = "restoreAdditionalCommandArgs"
4197    )]
4198    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4199    pub restore_additional_command_args: Option<Vec<String>>,
4200}
4201
4202/// The configuration for the backup of the WAL stream.
4203/// When not defined, WAL files will be stored uncompressed and may be
4204/// unencrypted in the object store, according to the bucket default policy.
4205#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4206#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4207pub enum ClusterExternalClustersBarmanObjectStoreWalCompression {
4208    #[serde(rename = "bzip2")]
4209    Bzip2,
4210    #[serde(rename = "gzip")]
4211    Gzip,
4212    #[serde(rename = "lz4")]
4213    Lz4,
4214    #[serde(rename = "snappy")]
4215    Snappy,
4216    #[serde(rename = "xz")]
4217    Xz,
4218    #[serde(rename = "zstd")]
4219    Zstd,
4220}
4221
4222/// The configuration for the backup of the WAL stream.
4223/// When not defined, WAL files will be stored uncompressed and may be
4224/// unencrypted in the object store, according to the bucket default policy.
4225#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4226#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4227pub enum ClusterExternalClustersBarmanObjectStoreWalEncryption {
4228    #[serde(rename = "AES256")]
4229    Aes256,
4230    #[serde(rename = "aws:kms")]
4231    AwsKms,
4232}
4233
4234/// The reference to the password to be used to connect to the server.
4235/// If a password is provided, CloudNativePG creates a PostgreSQL
4236/// passfile at `/controller/external/NAME/pass` (where "NAME" is the
4237/// cluster's name). This passfile is automatically referenced in the
4238/// connection string when establishing a connection to the remote
4239/// PostgreSQL server from the current PostgreSQL `Cluster`. This ensures
4240/// secure and efficient password management for external clusters.
4241#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4242#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4243#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4244pub struct ClusterExternalClustersPassword {
4245    /// The key of the secret to select from.  Must be a valid secret key.
4246    pub key: String,
4247    /// Name of the referent.
4248    /// This field is effectively required, but due to backwards compatibility is
4249    /// allowed to be empty. Instances of this type with an empty value here are
4250    /// almost certainly wrong.
4251    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
4252    #[serde(default, skip_serializing_if = "Option::is_none")]
4253    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4254    pub name: Option<String>,
4255    /// Specify whether the Secret or its key must be defined
4256    #[serde(default, skip_serializing_if = "Option::is_none")]
4257    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4258    pub optional: Option<bool>,
4259}
4260
4261/// The configuration of the plugin that is taking care
4262/// of WAL archiving and backups for this external cluster
4263#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4264#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4265#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4266pub struct ClusterExternalClustersPlugin {
4267    /// Enabled is true if this plugin will be used
4268    #[serde(default, skip_serializing_if = "Option::is_none")]
4269    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4270    pub enabled: Option<bool>,
4271    /// Marks the plugin as the WAL archiver. At most one plugin can be
4272    /// designated as a WAL archiver. This cannot be enabled if the
4273    /// `.spec.backup.barmanObjectStore` configuration is present.
4274    #[serde(
4275        default,
4276        skip_serializing_if = "Option::is_none",
4277        rename = "isWALArchiver"
4278    )]
4279    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4280    pub is_wal_archiver: Option<bool>,
4281    /// Name is the plugin name
4282    pub name: String,
4283    /// Parameters is the configuration of the plugin
4284    #[serde(default, skip_serializing_if = "Option::is_none")]
4285    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4286    pub parameters: Option<BTreeMap<String, String>>,
4287}
4288
4289/// The reference to an SSL certificate to be used to connect to this
4290/// instance
4291#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4292#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4293#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4294pub struct ClusterExternalClustersSslCert {
4295    /// The key of the secret to select from.  Must be a valid secret key.
4296    pub key: String,
4297    /// Name of the referent.
4298    /// This field is effectively required, but due to backwards compatibility is
4299    /// allowed to be empty. Instances of this type with an empty value here are
4300    /// almost certainly wrong.
4301    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
4302    #[serde(default, skip_serializing_if = "Option::is_none")]
4303    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4304    pub name: Option<String>,
4305    /// Specify whether the Secret or its key must be defined
4306    #[serde(default, skip_serializing_if = "Option::is_none")]
4307    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4308    pub optional: Option<bool>,
4309}
4310
4311/// The reference to an SSL private key to be used to connect to this
4312/// instance
4313#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4314#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4315#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4316pub struct ClusterExternalClustersSslKey {
4317    /// The key of the secret to select from.  Must be a valid secret key.
4318    pub key: String,
4319    /// Name of the referent.
4320    /// This field is effectively required, but due to backwards compatibility is
4321    /// allowed to be empty. Instances of this type with an empty value here are
4322    /// almost certainly wrong.
4323    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
4324    #[serde(default, skip_serializing_if = "Option::is_none")]
4325    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4326    pub name: Option<String>,
4327    /// Specify whether the Secret or its key must be defined
4328    #[serde(default, skip_serializing_if = "Option::is_none")]
4329    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4330    pub optional: Option<bool>,
4331}
4332
4333/// The reference to an SSL CA public key to be used to connect to this
4334/// instance
4335#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4336#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4337#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4338pub struct ClusterExternalClustersSslRootCert {
4339    /// The key of the secret to select from.  Must be a valid secret key.
4340    pub key: String,
4341    /// Name of the referent.
4342    /// This field is effectively required, but due to backwards compatibility is
4343    /// allowed to be empty. Instances of this type with an empty value here are
4344    /// almost certainly wrong.
4345    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
4346    #[serde(default, skip_serializing_if = "Option::is_none")]
4347    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4348    pub name: Option<String>,
4349    /// Specify whether the Secret or its key must be defined
4350    #[serde(default, skip_serializing_if = "Option::is_none")]
4351    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4352    pub optional: Option<bool>,
4353}
4354
4355/// Defines the major PostgreSQL version we want to use within an ImageCatalog
4356#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4357#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4358#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4359pub struct ClusterImageCatalogRef {
4360    /// APIGroup is the group for the resource being referenced.
4361    /// If APIGroup is not specified, the specified Kind must be in the core API group.
4362    /// For any other third-party types, APIGroup is required.
4363    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
4364    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4365    pub api_group: Option<String>,
4366    /// Kind is the type of resource being referenced
4367    pub kind: String,
4368    /// The major version of PostgreSQL we want to use from the ImageCatalog
4369    pub major: i64,
4370    /// Name is the name of resource being referenced
4371    pub name: String,
4372}
4373
4374/// LocalObjectReference contains enough information to let you locate a
4375/// local object with a known type inside the same namespace
4376#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4377#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4378#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4379pub struct ClusterImagePullSecrets {
4380    /// Name of the referent.
4381    pub name: String,
4382}
4383
4384/// Metadata that will be inherited by all objects related to the Cluster
4385#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4386#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4387#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4388pub struct ClusterInheritedMetadata {
4389    #[serde(default, skip_serializing_if = "Option::is_none")]
4390    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4391    pub annotations: Option<BTreeMap<String, String>>,
4392    #[serde(default, skip_serializing_if = "Option::is_none")]
4393    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4394    pub labels: Option<BTreeMap<String, String>>,
4395}
4396
4397/// Specification of the desired behavior of the cluster.
4398/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
4399#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4400#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4401pub enum ClusterLogLevel {
4402    #[serde(rename = "error")]
4403    Error,
4404    #[serde(rename = "warning")]
4405    Warning,
4406    #[serde(rename = "info")]
4407    Info,
4408    #[serde(rename = "debug")]
4409    Debug,
4410    #[serde(rename = "trace")]
4411    Trace,
4412}
4413
4414/// The configuration that is used by the portions of PostgreSQL that are managed by the instance manager
4415#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4416#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4417#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4418pub struct ClusterManaged {
4419    /// Database roles managed by the `Cluster`
4420    #[serde(default, skip_serializing_if = "Option::is_none")]
4421    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4422    pub roles: Option<Vec<ClusterManagedRoles>>,
4423    /// Services roles managed by the `Cluster`
4424    #[serde(default, skip_serializing_if = "Option::is_none")]
4425    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4426    pub services: Option<ClusterManagedServices>,
4427}
4428
4429/// RoleConfiguration is the representation, in Kubernetes, of a PostgreSQL role
4430/// with the additional field Ensure specifying whether to ensure the presence or
4431/// absence of the role in the database
4432///
4433/// The defaults of the CREATE ROLE command are applied
4434/// Reference: <https://www.postgresql.org/docs/current/sql-createrole.html>
4435#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4436#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4437#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4438pub struct ClusterManagedRoles {
4439    /// Whether a role bypasses every row-level security (RLS) policy.
4440    /// Default is `false`.
4441    #[serde(default, skip_serializing_if = "Option::is_none")]
4442    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4443    pub bypassrls: Option<bool>,
4444    /// Description of the role
4445    #[serde(default, skip_serializing_if = "Option::is_none")]
4446    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4447    pub comment: Option<String>,
4448    /// If the role can log in, this specifies how many concurrent
4449    /// connections the role can make. `-1` (the default) means no limit.
4450    #[serde(
4451        default,
4452        skip_serializing_if = "Option::is_none",
4453        rename = "connectionLimit"
4454    )]
4455    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4456    pub connection_limit: Option<i64>,
4457    /// When set to `true`, the role being defined will be allowed to create
4458    /// new databases. Specifying `false` (default) will deny a role the
4459    /// ability to create databases.
4460    #[serde(default, skip_serializing_if = "Option::is_none")]
4461    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4462    pub createdb: Option<bool>,
4463    /// Whether the role will be permitted to create, alter, drop, comment
4464    /// on, change the security label for, and grant or revoke membership in
4465    /// other roles. Default is `false`.
4466    #[serde(default, skip_serializing_if = "Option::is_none")]
4467    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4468    pub createrole: Option<bool>,
4469    /// DisablePassword indicates that a role's password should be set to NULL in Postgres
4470    #[serde(
4471        default,
4472        skip_serializing_if = "Option::is_none",
4473        rename = "disablePassword"
4474    )]
4475    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4476    pub disable_password: Option<bool>,
4477    /// Ensure the role is `present` or `absent` - defaults to "present"
4478    #[serde(default, skip_serializing_if = "Option::is_none")]
4479    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4480    pub ensure: Option<ClusterManagedRolesEnsure>,
4481    /// List of one or more existing roles to which this role will be
4482    /// immediately added as a new member. Default empty.
4483    /// Changes to the list are applied to an existing role through
4484    /// `GRANT` and `REVOKE` statements, not only at role creation.
4485    #[serde(default, skip_serializing_if = "Option::is_none", rename = "inRoles")]
4486    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4487    pub in_roles: Option<Vec<String>>,
4488    /// Whether a role "inherits" the privileges of roles it is a member of.
4489    /// Default is `true`.
4490    #[serde(default, skip_serializing_if = "Option::is_none")]
4491    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4492    pub inherit: Option<bool>,
4493    /// Whether the role is allowed to log in. A role having the `login`
4494    /// attribute can be thought of as a user. Roles without this attribute
4495    /// are useful for managing database privileges, but are not users in
4496    /// the usual sense of the word. Default is `false`.
4497    #[serde(default, skip_serializing_if = "Option::is_none")]
4498    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4499    pub login: Option<bool>,
4500    /// Name of the role
4501    pub name: String,
4502    /// Secret containing the password of the role (if present).
4503    /// If null, the password will be ignored unless DisablePassword is set.
4504    /// When set, the secret must follow the `kubernetes.io/basic-auth` format
4505    /// and contain both a `username` and a `password` field.
4506    #[serde(
4507        default,
4508        skip_serializing_if = "Option::is_none",
4509        rename = "passwordSecret"
4510    )]
4511    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4512    pub password_secret: Option<ClusterManagedRolesPasswordSecret>,
4513    /// Whether a role is a replication role. A role must have this
4514    /// attribute (or be a superuser) in order to be able to connect to the
4515    /// server in replication mode (physical or logical replication) and in
4516    /// order to be able to create or drop replication slots. A role having
4517    /// the `replication` attribute is a very highly privileged role, and
4518    /// should only be used on roles actually used for replication. Default
4519    /// is `false`.
4520    #[serde(default, skip_serializing_if = "Option::is_none")]
4521    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4522    pub replication: Option<bool>,
4523    /// Whether the role is a `superuser` who can override all access
4524    /// restrictions within the database - superuser status is dangerous and
4525    /// should be used only when really needed. You must yourself be a
4526    /// superuser to create a new superuser. Defaults is `false`.
4527    #[serde(default, skip_serializing_if = "Option::is_none")]
4528    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4529    pub superuser: Option<bool>,
4530    /// Date and time after which the role's password is no longer valid.
4531    /// When omitted, the password will never expire (default).
4532    #[serde(
4533        default,
4534        skip_serializing_if = "Option::is_none",
4535        rename = "validUntil"
4536    )]
4537    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4538    pub valid_until: Option<String>,
4539}
4540
4541/// RoleConfiguration is the representation, in Kubernetes, of a PostgreSQL role
4542/// with the additional field Ensure specifying whether to ensure the presence or
4543/// absence of the role in the database
4544///
4545/// The defaults of the CREATE ROLE command are applied
4546/// Reference: <https://www.postgresql.org/docs/current/sql-createrole.html>
4547#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4548#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4549pub enum ClusterManagedRolesEnsure {
4550    #[serde(rename = "present")]
4551    Present,
4552    #[serde(rename = "absent")]
4553    Absent,
4554}
4555
4556/// Secret containing the password of the role (if present).
4557/// If null, the password will be ignored unless DisablePassword is set.
4558/// When set, the secret must follow the `kubernetes.io/basic-auth` format
4559/// and contain both a `username` and a `password` field.
4560#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4561#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4562#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4563pub struct ClusterManagedRolesPasswordSecret {
4564    /// Name of the referent.
4565    pub name: String,
4566}
4567
4568/// Services roles managed by the `Cluster`
4569#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4570#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4571#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4572pub struct ClusterManagedServices {
4573    /// Additional is a list of additional managed services specified by the user.
4574    #[serde(default, skip_serializing_if = "Option::is_none")]
4575    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4576    pub additional: Option<Vec<ClusterManagedServicesAdditional>>,
4577    /// DisabledDefaultServices is a list of service types that are disabled by default.
4578    /// Valid values are "r", and "ro", representing read, and read-only services.
4579    #[serde(
4580        default,
4581        skip_serializing_if = "Option::is_none",
4582        rename = "disabledDefaultServices"
4583    )]
4584    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4585    pub disabled_default_services: Option<Vec<String>>,
4586}
4587
4588/// ManagedService represents a specific service managed by the cluster.
4589/// It includes the type of service and its associated template specification.
4590#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4591#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4592#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4593pub struct ClusterManagedServicesAdditional {
4594    /// SelectorType specifies the type of selectors that the service will have.
4595    /// Valid values are "rw", "r", and "ro", representing read-write, read, and read-only services.
4596    #[serde(rename = "selectorType")]
4597    pub selector_type: ClusterManagedServicesAdditionalSelectorType,
4598    /// ServiceTemplate is the template specification for the service.
4599    #[serde(rename = "serviceTemplate")]
4600    pub service_template: ClusterManagedServicesAdditionalServiceTemplate,
4601    /// UpdateStrategy describes how the service differences should be reconciled
4602    #[serde(
4603        default,
4604        skip_serializing_if = "Option::is_none",
4605        rename = "updateStrategy"
4606    )]
4607    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4608    pub update_strategy: Option<ClusterManagedServicesAdditionalUpdateStrategy>,
4609}
4610
4611/// ManagedService represents a specific service managed by the cluster.
4612/// It includes the type of service and its associated template specification.
4613#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
4614#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4615pub enum ClusterManagedServicesAdditionalSelectorType {
4616    #[serde(rename = "rw")]
4617    Rw,
4618    #[serde(rename = "r")]
4619    R,
4620    #[serde(rename = "ro")]
4621    Ro,
4622}
4623
4624/// ServiceTemplate is the template specification for the service.
4625#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4626#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4627#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4628pub struct ClusterManagedServicesAdditionalServiceTemplate {
4629    /// Standard object's metadata.
4630    /// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata>
4631    #[serde(default, skip_serializing_if = "Option::is_none")]
4632    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4633    pub metadata: Option<ClusterManagedServicesAdditionalServiceTemplateMetadata>,
4634    /// Specification of the desired behavior of the service.
4635    /// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
4636    #[serde(default, skip_serializing_if = "Option::is_none")]
4637    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4638    pub spec: Option<ClusterManagedServicesAdditionalServiceTemplateSpec>,
4639}
4640
4641/// Standard object's metadata.
4642/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata>
4643#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4644#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4645#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4646pub struct ClusterManagedServicesAdditionalServiceTemplateMetadata {
4647    /// Annotations is an unstructured key value map stored with a resource that may be
4648    /// set by external tools to store and retrieve arbitrary metadata. They are not
4649    /// queryable and should be preserved when modifying objects.
4650    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
4651    #[serde(default, skip_serializing_if = "Option::is_none")]
4652    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4653    pub annotations: Option<BTreeMap<String, String>>,
4654    /// Map of string keys and values that can be used to organize and categorize
4655    /// (scope and select) objects. May match selectors of replication controllers
4656    /// and services.
4657    /// More info: <http://kubernetes.io/docs/user-guide/labels>
4658    #[serde(default, skip_serializing_if = "Option::is_none")]
4659    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4660    pub labels: Option<BTreeMap<String, String>>,
4661    /// The name of the resource. Only supported for certain types
4662    #[serde(default, skip_serializing_if = "Option::is_none")]
4663    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4664    pub name: Option<String>,
4665}
4666
4667/// Specification of the desired behavior of the service.
4668/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
4669#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4670#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4671#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4672pub struct ClusterManagedServicesAdditionalServiceTemplateSpec {
4673    /// allocateLoadBalancerNodePorts defines if NodePorts will be automatically
4674    /// allocated for services with type LoadBalancer.  Default is "true". It
4675    /// may be set to "false" if the cluster load-balancer does not rely on
4676    /// NodePorts.  If the caller requests specific NodePorts (by specifying a
4677    /// value), those requests will be respected, regardless of this field.
4678    /// This field may only be set for services with type LoadBalancer and will
4679    /// be cleared if the type is changed to any other type.
4680    #[serde(
4681        default,
4682        skip_serializing_if = "Option::is_none",
4683        rename = "allocateLoadBalancerNodePorts"
4684    )]
4685    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4686    pub allocate_load_balancer_node_ports: Option<bool>,
4687    /// clusterIP is the IP address of the service and is usually assigned
4688    /// randomly. If an address is specified manually, is in-range (as per
4689    /// system configuration), and is not in use, it will be allocated to the
4690    /// service; otherwise creation of the service will fail. This field may not
4691    /// be changed through updates unless the type field is also being changed
4692    /// to ExternalName (which requires this field to be blank) or the type
4693    /// field is being changed from ExternalName (in which case this field may
4694    /// optionally be specified, as describe above).  Valid values are "None",
4695    /// empty string (""), or a valid IP address. Setting this to "None" makes a
4696    /// "headless service" (no virtual IP), which is useful when direct endpoint
4697    /// connections are preferred and proxying is not required.  Only applies to
4698    /// types ClusterIP, NodePort, and LoadBalancer. If this field is specified
4699    /// when creating a Service of type ExternalName, creation will fail. This
4700    /// field will be wiped when updating a Service to type ExternalName.
4701    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies>
4702    #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterIP")]
4703    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4704    pub cluster_ip: Option<String>,
4705    /// ClusterIPs is a list of IP addresses assigned to this service, and are
4706    /// usually assigned randomly.  If an address is specified manually, is
4707    /// in-range (as per system configuration), and is not in use, it will be
4708    /// allocated to the service; otherwise creation of the service will fail.
4709    /// This field may not be changed through updates unless the type field is
4710    /// also being changed to ExternalName (which requires this field to be
4711    /// empty) or the type field is being changed from ExternalName (in which
4712    /// case this field may optionally be specified, as describe above).  Valid
4713    /// values are "None", empty string (""), or a valid IP address.  Setting
4714    /// this to "None" makes a "headless service" (no virtual IP), which is
4715    /// useful when direct endpoint connections are preferred and proxying is
4716    /// not required.  Only applies to types ClusterIP, NodePort, and
4717    /// LoadBalancer. If this field is specified when creating a Service of type
4718    /// ExternalName, creation will fail. This field will be wiped when updating
4719    /// a Service to type ExternalName.  If this field is not specified, it will
4720    /// be initialized from the clusterIP field.  If this field is specified,
4721    /// clients must ensure that clusterIPs[0] and clusterIP have the same
4722    /// value.
4723    ///
4724    /// This field may hold a maximum of two entries (dual-stack IPs, in either order).
4725    /// These IPs must correspond to the values of the ipFamilies field. Both
4726    /// clusterIPs and ipFamilies are governed by the ipFamilyPolicy field.
4727    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies>
4728    #[serde(
4729        default,
4730        skip_serializing_if = "Option::is_none",
4731        rename = "clusterIPs"
4732    )]
4733    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4734    pub cluster_i_ps: Option<Vec<String>>,
4735    /// externalIPs is a list of IP addresses for which nodes in the cluster
4736    /// will also accept traffic for this service.  These IPs are not managed by
4737    /// Kubernetes.  The user is responsible for ensuring that traffic arrives
4738    /// at a node with this IP.  A common example is external load-balancers
4739    /// that are not part of the Kubernetes system.
4740    #[serde(
4741        default,
4742        skip_serializing_if = "Option::is_none",
4743        rename = "externalIPs"
4744    )]
4745    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4746    pub external_i_ps: Option<Vec<String>>,
4747    /// externalName is the external reference that discovery mechanisms will
4748    /// return as an alias for this service (e.g. a DNS CNAME record). No
4749    /// proxying will be involved.  Must be a lowercase RFC-1123 hostname
4750    /// (<https://tools.ietf.org/html/rfc1123)> and requires `type` to be "ExternalName".
4751    #[serde(
4752        default,
4753        skip_serializing_if = "Option::is_none",
4754        rename = "externalName"
4755    )]
4756    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4757    pub external_name: Option<String>,
4758    /// externalTrafficPolicy describes how nodes distribute service traffic they
4759    /// receive on one of the Service's "externally-facing" addresses (NodePorts,
4760    /// ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure
4761    /// the service in a way that assumes that external load balancers will take care
4762    /// of balancing the service traffic between nodes, and so each node will deliver
4763    /// traffic only to the node-local endpoints of the service, without masquerading
4764    /// the client source IP. (Traffic mistakenly sent to a node with no endpoints will
4765    /// be dropped.) The default value, "Cluster", uses the standard behavior of
4766    /// routing to all endpoints evenly (possibly modified by topology and other
4767    /// features). Note that traffic sent to an External IP or LoadBalancer IP from
4768    /// within the cluster will always get "Cluster" semantics, but clients sending to
4769    /// a NodePort from within the cluster may need to take traffic policy into account
4770    /// when picking a node.
4771    #[serde(
4772        default,
4773        skip_serializing_if = "Option::is_none",
4774        rename = "externalTrafficPolicy"
4775    )]
4776    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4777    pub external_traffic_policy: Option<String>,
4778    /// healthCheckNodePort specifies the healthcheck nodePort for the service.
4779    /// This only applies when type is set to LoadBalancer and
4780    /// externalTrafficPolicy is set to Local. If a value is specified, is
4781    /// in-range, and is not in use, it will be used.  If not specified, a value
4782    /// will be automatically allocated.  External systems (e.g. load-balancers)
4783    /// can use this port to determine if a given node holds endpoints for this
4784    /// service or not.  If this field is specified when creating a Service
4785    /// which does not need it, creation will fail. This field will be wiped
4786    /// when updating a Service to no longer need it (e.g. changing type).
4787    /// This field cannot be updated once set.
4788    #[serde(
4789        default,
4790        skip_serializing_if = "Option::is_none",
4791        rename = "healthCheckNodePort"
4792    )]
4793    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4794    pub health_check_node_port: Option<i32>,
4795    /// InternalTrafficPolicy describes how nodes distribute service traffic they
4796    /// receive on the ClusterIP. If set to "Local", the proxy will assume that pods
4797    /// only want to talk to endpoints of the service on the same node as the pod,
4798    /// dropping the traffic if there are no local endpoints. The default value,
4799    /// "Cluster", uses the standard behavior of routing to all endpoints evenly
4800    /// (possibly modified by topology and other features).
4801    #[serde(
4802        default,
4803        skip_serializing_if = "Option::is_none",
4804        rename = "internalTrafficPolicy"
4805    )]
4806    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4807    pub internal_traffic_policy: Option<String>,
4808    /// IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this
4809    /// service. This field is usually assigned automatically based on cluster
4810    /// configuration and the ipFamilyPolicy field. If this field is specified
4811    /// manually, the requested family is available in the cluster,
4812    /// and ipFamilyPolicy allows it, it will be used; otherwise creation of
4813    /// the service will fail. This field is conditionally mutable: it allows
4814    /// for adding or removing a secondary IP family, but it does not allow
4815    /// changing the primary IP family of the Service. Valid values are "IPv4"
4816    /// and "IPv6".  This field only applies to Services of types ClusterIP,
4817    /// NodePort, and LoadBalancer, and does apply to "headless" services.
4818    /// This field will be wiped when updating a Service to type ExternalName.
4819    ///
4820    /// This field may hold a maximum of two entries (dual-stack families, in
4821    /// either order).  These families must correspond to the values of the
4822    /// clusterIPs field, if specified. Both clusterIPs and ipFamilies are
4823    /// governed by the ipFamilyPolicy field.
4824    #[serde(
4825        default,
4826        skip_serializing_if = "Option::is_none",
4827        rename = "ipFamilies"
4828    )]
4829    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4830    pub ip_families: Option<Vec<String>>,
4831    /// IPFamilyPolicy represents the dual-stack-ness requested or required by
4832    /// this Service. If there is no value provided, then this field will be set
4833    /// to SingleStack. Services can be "SingleStack" (a single IP family),
4834    /// "PreferDualStack" (two IP families on dual-stack configured clusters or
4835    /// a single IP family on single-stack clusters), or "RequireDualStack"
4836    /// (two IP families on dual-stack configured clusters, otherwise fail). The
4837    /// ipFamilies and clusterIPs fields depend on the value of this field. This
4838    /// field will be wiped when updating a service to type ExternalName.
4839    #[serde(
4840        default,
4841        skip_serializing_if = "Option::is_none",
4842        rename = "ipFamilyPolicy"
4843    )]
4844    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4845    pub ip_family_policy: Option<String>,
4846    /// loadBalancerClass is the class of the load balancer implementation this Service belongs to.
4847    /// If specified, the value of this field must be a label-style identifier, with an optional prefix,
4848    /// e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users.
4849    /// This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load
4850    /// balancer implementation is used, today this is typically done through the cloud provider integration,
4851    /// but should apply for any default implementation. If set, it is assumed that a load balancer
4852    /// implementation is watching for Services with a matching class. Any default load balancer
4853    /// implementation (e.g. cloud providers) should ignore Services that set this field.
4854    /// This field can only be set when creating or updating a Service to type 'LoadBalancer'.
4855    /// Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type.
4856    #[serde(
4857        default,
4858        skip_serializing_if = "Option::is_none",
4859        rename = "loadBalancerClass"
4860    )]
4861    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4862    pub load_balancer_class: Option<String>,
4863    /// Only applies to Service Type: LoadBalancer.
4864    /// This feature depends on whether the underlying cloud-provider supports specifying
4865    /// the loadBalancerIP when a load balancer is created.
4866    /// This field will be ignored if the cloud-provider does not support the feature.
4867    /// Deprecated: This field was under-specified and its meaning varies across implementations.
4868    /// Using it is non-portable and it may not support dual-stack.
4869    /// Users are encouraged to use implementation-specific annotations when available.
4870    #[serde(
4871        default,
4872        skip_serializing_if = "Option::is_none",
4873        rename = "loadBalancerIP"
4874    )]
4875    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4876    pub load_balancer_ip: Option<String>,
4877    /// If specified and supported by the platform, this will restrict traffic through the cloud-provider
4878    /// load-balancer will be restricted to the specified client IPs. This field will be ignored if the
4879    /// cloud-provider does not support the feature."
4880    /// More info: <https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/>
4881    #[serde(
4882        default,
4883        skip_serializing_if = "Option::is_none",
4884        rename = "loadBalancerSourceRanges"
4885    )]
4886    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4887    pub load_balancer_source_ranges: Option<Vec<String>>,
4888    /// The list of ports that are exposed by this service.
4889    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies>
4890    #[serde(default, skip_serializing_if = "Option::is_none")]
4891    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4892    pub ports: Option<Vec<ClusterManagedServicesAdditionalServiceTemplateSpecPorts>>,
4893    /// publishNotReadyAddresses indicates that any agent which deals with endpoints for this
4894    /// Service should disregard any indications of ready/not-ready.
4895    /// The primary use case for setting this field is for a StatefulSet's Headless Service to
4896    /// propagate SRV DNS records for its Pods for the purpose of peer discovery.
4897    /// The Kubernetes controllers that generate Endpoints and EndpointSlice resources for
4898    /// Services interpret this to mean that all endpoints are considered "ready" even if the
4899    /// Pods themselves are not. Agents which consume only Kubernetes generated endpoints
4900    /// through the Endpoints or EndpointSlice resources can safely assume this behavior.
4901    #[serde(
4902        default,
4903        skip_serializing_if = "Option::is_none",
4904        rename = "publishNotReadyAddresses"
4905    )]
4906    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4907    pub publish_not_ready_addresses: Option<bool>,
4908    /// Route service traffic to pods with label keys and values matching this
4909    /// selector. If empty or not present, the service is assumed to have an
4910    /// external process managing its endpoints, which Kubernetes will not
4911    /// modify. Only applies to types ClusterIP, NodePort, and LoadBalancer.
4912    /// Ignored if type is ExternalName.
4913    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/>
4914    #[serde(default, skip_serializing_if = "Option::is_none")]
4915    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4916    pub selector: Option<BTreeMap<String, String>>,
4917    /// Supports "ClientIP" and "None". Used to maintain session affinity.
4918    /// Enable client IP based session affinity.
4919    /// Must be ClientIP or None.
4920    /// Defaults to None.
4921    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies>
4922    #[serde(
4923        default,
4924        skip_serializing_if = "Option::is_none",
4925        rename = "sessionAffinity"
4926    )]
4927    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4928    pub session_affinity: Option<String>,
4929    /// sessionAffinityConfig contains the configurations of session affinity.
4930    #[serde(
4931        default,
4932        skip_serializing_if = "Option::is_none",
4933        rename = "sessionAffinityConfig"
4934    )]
4935    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4936    pub session_affinity_config:
4937        Option<ClusterManagedServicesAdditionalServiceTemplateSpecSessionAffinityConfig>,
4938    /// TrafficDistribution offers a way to express preferences for how traffic
4939    /// is distributed to Service endpoints. Implementations can use this field
4940    /// as a hint, but are not required to guarantee strict adherence. If the
4941    /// field is not set, the implementation will apply its default routing
4942    /// strategy. If set to "PreferClose", implementations should prioritize
4943    /// endpoints that are in the same zone.
4944    #[serde(
4945        default,
4946        skip_serializing_if = "Option::is_none",
4947        rename = "trafficDistribution"
4948    )]
4949    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4950    pub traffic_distribution: Option<String>,
4951    /// type determines how the Service is exposed. Defaults to ClusterIP. Valid
4952    /// options are ExternalName, ClusterIP, NodePort, and LoadBalancer.
4953    /// "ClusterIP" allocates a cluster-internal IP address for load-balancing
4954    /// to endpoints. Endpoints are determined by the selector or if that is not
4955    /// specified, by manual construction of an Endpoints object or
4956    /// EndpointSlice objects. If clusterIP is "None", no virtual IP is
4957    /// allocated and the endpoints are published as a set of endpoints rather
4958    /// than a virtual IP.
4959    /// "NodePort" builds on ClusterIP and allocates a port on every node which
4960    /// routes to the same endpoints as the clusterIP.
4961    /// "LoadBalancer" builds on NodePort and creates an external load-balancer
4962    /// (if supported in the current cloud) which routes to the same endpoints
4963    /// as the clusterIP.
4964    /// "ExternalName" aliases this service to the specified externalName.
4965    /// Several other fields do not apply to ExternalName services.
4966    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types>
4967    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
4968    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4969    pub r#type: Option<String>,
4970}
4971
4972/// ServicePort contains information on service's port.
4973#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
4974#[cfg_attr(feature = "builder", derive(TypedBuilder))]
4975#[cfg_attr(feature = "schemars", derive(JsonSchema))]
4976pub struct ClusterManagedServicesAdditionalServiceTemplateSpecPorts {
4977    /// The application protocol for this port.
4978    /// This is used as a hint for implementations to offer richer behavior for protocols that they understand.
4979    /// This field follows standard Kubernetes label syntax.
4980    /// Valid values are either:
4981    ///
4982    /// * Un-prefixed protocol names - reserved for IANA standard service names (as per
4983    /// RFC-6335 and <https://www.iana.org/assignments/service-names).>
4984    ///
4985    /// * Kubernetes-defined prefixed names:
4986    ///   * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in <https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior->
4987    ///   * 'kubernetes.io/ws'  - WebSocket over cleartext as described in <https://www.rfc-editor.org/rfc/rfc6455>
4988    ///   * 'kubernetes.io/wss' - WebSocket over TLS as described in <https://www.rfc-editor.org/rfc/rfc6455>
4989    ///
4990    /// * Other protocols should use implementation-defined prefixed names such as
4991    /// mycompany.com/my-custom-protocol.
4992    #[serde(
4993        default,
4994        skip_serializing_if = "Option::is_none",
4995        rename = "appProtocol"
4996    )]
4997    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
4998    pub app_protocol: Option<String>,
4999    /// The name of this port within the service. This must be a DNS_LABEL.
5000    /// All ports within a ServiceSpec must have unique names. When considering
5001    /// the endpoints for a Service, this must match the 'name' field in the
5002    /// EndpointPort.
5003    /// Optional if only one ServicePort is defined on this service.
5004    #[serde(default, skip_serializing_if = "Option::is_none")]
5005    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5006    pub name: Option<String>,
5007    /// The port on each node on which this service is exposed when type is
5008    /// NodePort or LoadBalancer.  Usually assigned by the system. If a value is
5009    /// specified, in-range, and not in use it will be used, otherwise the
5010    /// operation will fail.  If not specified, a port will be allocated if this
5011    /// Service requires one.  If this field is specified when creating a
5012    /// Service which does not need it, creation will fail. This field will be
5013    /// wiped when updating a Service to no longer need it (e.g. changing type
5014    /// from NodePort to ClusterIP).
5015    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport>
5016    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodePort")]
5017    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5018    pub node_port: Option<i32>,
5019    /// The port that will be exposed by this service.
5020    pub port: i32,
5021    /// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
5022    /// Default is TCP.
5023    #[serde(default, skip_serializing_if = "Option::is_none")]
5024    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5025    pub protocol: Option<String>,
5026    /// Number or name of the port to access on the pods targeted by the service.
5027    /// Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
5028    /// If this is a string, it will be looked up as a named port in the
5029    /// target Pod's container ports. If this is not specified, the value
5030    /// of the 'port' field is used (an identity map).
5031    /// This field is ignored for services with clusterIP=None, and should be
5032    /// omitted or set equal to the 'port' field.
5033    /// More info: <https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service>
5034    #[serde(
5035        default,
5036        skip_serializing_if = "Option::is_none",
5037        rename = "targetPort"
5038    )]
5039    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5040    pub target_port: Option<IntOrString>,
5041}
5042
5043/// sessionAffinityConfig contains the configurations of session affinity.
5044#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5045#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5046#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5047pub struct ClusterManagedServicesAdditionalServiceTemplateSpecSessionAffinityConfig {
5048    /// clientIP contains the configurations of Client IP based session affinity.
5049    #[serde(default, skip_serializing_if = "Option::is_none", rename = "clientIP")]
5050    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5051    pub client_ip:
5052        Option<ClusterManagedServicesAdditionalServiceTemplateSpecSessionAffinityConfigClientIp>,
5053}
5054
5055/// clientIP contains the configurations of Client IP based session affinity.
5056#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5057#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5058#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5059pub struct ClusterManagedServicesAdditionalServiceTemplateSpecSessionAffinityConfigClientIp {
5060    /// timeoutSeconds specifies the seconds of ClientIP type session sticky time.
5061    /// The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP".
5062    /// Default value is 10800(for 3 hours).
5063    #[serde(
5064        default,
5065        skip_serializing_if = "Option::is_none",
5066        rename = "timeoutSeconds"
5067    )]
5068    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5069    pub timeout_seconds: Option<i32>,
5070}
5071
5072/// ManagedService represents a specific service managed by the cluster.
5073/// It includes the type of service and its associated template specification.
5074#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
5075#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5076pub enum ClusterManagedServicesAdditionalUpdateStrategy {
5077    #[serde(rename = "patch")]
5078    Patch,
5079    #[serde(rename = "replace")]
5080    Replace,
5081}
5082
5083/// The configuration of the monitoring infrastructure of this cluster
5084#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5085#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5086#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5087pub struct ClusterMonitoring {
5088    /// The list of config maps containing the custom queries
5089    #[serde(
5090        default,
5091        skip_serializing_if = "Option::is_none",
5092        rename = "customQueriesConfigMap"
5093    )]
5094    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5095    pub custom_queries_config_map: Option<Vec<ClusterMonitoringCustomQueriesConfigMap>>,
5096    /// The list of secrets containing the custom queries
5097    #[serde(
5098        default,
5099        skip_serializing_if = "Option::is_none",
5100        rename = "customQueriesSecret"
5101    )]
5102    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5103    pub custom_queries_secret: Option<Vec<ClusterMonitoringCustomQueriesSecret>>,
5104    /// Whether the default queries should be injected.
5105    /// Set it to `true` if you don't want to inject default queries into the cluster.
5106    /// Default: false.
5107    #[serde(
5108        default,
5109        skip_serializing_if = "Option::is_none",
5110        rename = "disableDefaultQueries"
5111    )]
5112    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5113    pub disable_default_queries: Option<bool>,
5114    /// Enable or disable the `PodMonitor`
5115    ///
5116    /// Deprecated: This feature will be removed in an upcoming release. If
5117    /// you need this functionality, you can create a PodMonitor manually.
5118    #[serde(
5119        default,
5120        skip_serializing_if = "Option::is_none",
5121        rename = "enablePodMonitor"
5122    )]
5123    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5124    pub enable_pod_monitor: Option<bool>,
5125    /// The interval during which metrics computed from queries are considered current.
5126    /// Once it is exceeded, a new scrape will trigger a rerun
5127    /// of the queries.
5128    /// If not set, defaults to 30 seconds, in line with Prometheus scraping defaults.
5129    /// Setting this to zero disables the caching mechanism and can cause heavy load on the PostgreSQL server.
5130    #[serde(
5131        default,
5132        skip_serializing_if = "Option::is_none",
5133        rename = "metricsQueriesTTL"
5134    )]
5135    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5136    pub metrics_queries_ttl: Option<String>,
5137    /// The list of metric relabelings for the `PodMonitor`. Applied to samples before ingestion.
5138    ///
5139    /// Deprecated: This feature will be removed in an upcoming release. If
5140    /// you need this functionality, you can create a PodMonitor manually.
5141    #[serde(
5142        default,
5143        skip_serializing_if = "Option::is_none",
5144        rename = "podMonitorMetricRelabelings"
5145    )]
5146    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5147    pub pod_monitor_metric_relabelings: Option<Vec<ClusterMonitoringPodMonitorMetricRelabelings>>,
5148    /// The list of relabelings for the `PodMonitor`. Applied to samples before scraping.
5149    ///
5150    /// Deprecated: This feature will be removed in an upcoming release. If
5151    /// you need this functionality, you can create a PodMonitor manually.
5152    #[serde(
5153        default,
5154        skip_serializing_if = "Option::is_none",
5155        rename = "podMonitorRelabelings"
5156    )]
5157    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5158    pub pod_monitor_relabelings: Option<Vec<ClusterMonitoringPodMonitorRelabelings>>,
5159    /// Configure TLS communication for the metrics endpoint.
5160    /// Changing tls.enabled option will force a rollout of all instances.
5161    #[serde(default, skip_serializing_if = "Option::is_none")]
5162    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5163    pub tls: Option<ClusterMonitoringTls>,
5164}
5165
5166/// ConfigMapKeySelector contains enough information to let you locate
5167/// the key of a ConfigMap
5168#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5169#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5170#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5171pub struct ClusterMonitoringCustomQueriesConfigMap {
5172    /// The key to select
5173    pub key: String,
5174    /// Name of the referent.
5175    pub name: String,
5176}
5177
5178/// SecretKeySelector contains enough information to let you locate
5179/// the key of a Secret
5180#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5181#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5182#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5183pub struct ClusterMonitoringCustomQueriesSecret {
5184    /// The key to select
5185    pub key: String,
5186    /// Name of the referent.
5187    pub name: String,
5188}
5189
5190/// RelabelConfig allows dynamic rewriting of the label set for targets, alerts,
5191/// scraped samples and remote write samples.
5192///
5193/// More info: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config>
5194#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5195#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5196#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5197pub struct ClusterMonitoringPodMonitorMetricRelabelings {
5198    /// action to perform based on the regex matching.
5199    ///
5200    /// `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
5201    /// `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
5202    ///
5203    /// Default: "Replace"
5204    #[serde(default, skip_serializing_if = "Option::is_none")]
5205    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5206    pub action: Option<ClusterMonitoringPodMonitorMetricRelabelingsAction>,
5207    /// modulus to take of the hash of the source label values.
5208    ///
5209    /// Only applicable when the action is `HashMod`.
5210    #[serde(default, skip_serializing_if = "Option::is_none")]
5211    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5212    pub modulus: Option<i64>,
5213    /// regex defines the regular expression against which the extracted value is matched.
5214    #[serde(default, skip_serializing_if = "Option::is_none")]
5215    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5216    pub regex: Option<String>,
5217    /// replacement value against which a Replace action is performed if the
5218    /// regular expression matches.
5219    ///
5220    /// Regex capture groups are available.
5221    #[serde(default, skip_serializing_if = "Option::is_none")]
5222    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5223    pub replacement: Option<String>,
5224    /// separator defines the string between concatenated SourceLabels.
5225    #[serde(default, skip_serializing_if = "Option::is_none")]
5226    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5227    pub separator: Option<String>,
5228    /// sourceLabels defines the source labels select values from existing labels. Their content is
5229    /// concatenated using the configured Separator and matched against the
5230    /// configured regular expression.
5231    #[serde(
5232        default,
5233        skip_serializing_if = "Option::is_none",
5234        rename = "sourceLabels"
5235    )]
5236    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5237    pub source_labels: Option<Vec<String>>,
5238    /// targetLabel defines the label to which the resulting string is written in a replacement.
5239    ///
5240    /// It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
5241    /// `KeepEqual` and `DropEqual` actions.
5242    ///
5243    /// Regex capture groups are available.
5244    #[serde(
5245        default,
5246        skip_serializing_if = "Option::is_none",
5247        rename = "targetLabel"
5248    )]
5249    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5250    pub target_label: Option<String>,
5251}
5252
5253/// RelabelConfig allows dynamic rewriting of the label set for targets, alerts,
5254/// scraped samples and remote write samples.
5255///
5256/// More info: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config>
5257#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
5258#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5259pub enum ClusterMonitoringPodMonitorMetricRelabelingsAction {
5260    #[serde(rename = "replace")]
5261    Replace,
5262    #[serde(rename = "Replace")]
5263    ReplaceX,
5264    #[serde(rename = "keep")]
5265    Keep,
5266    #[serde(rename = "Keep")]
5267    KeepX,
5268    #[serde(rename = "drop")]
5269    Drop,
5270    #[serde(rename = "Drop")]
5271    DropX,
5272    #[serde(rename = "hashmod")]
5273    Hashmod,
5274    HashMod,
5275    #[serde(rename = "labelmap")]
5276    Labelmap,
5277    LabelMap,
5278    #[serde(rename = "labeldrop")]
5279    Labeldrop,
5280    LabelDrop,
5281    #[serde(rename = "labelkeep")]
5282    Labelkeep,
5283    LabelKeep,
5284    #[serde(rename = "lowercase")]
5285    Lowercase,
5286    #[serde(rename = "Lowercase")]
5287    LowercaseX,
5288    #[serde(rename = "uppercase")]
5289    Uppercase,
5290    #[serde(rename = "Uppercase")]
5291    UppercaseX,
5292    #[serde(rename = "keepequal")]
5293    Keepequal,
5294    KeepEqual,
5295    #[serde(rename = "dropequal")]
5296    Dropequal,
5297    DropEqual,
5298}
5299
5300/// RelabelConfig allows dynamic rewriting of the label set for targets, alerts,
5301/// scraped samples and remote write samples.
5302///
5303/// More info: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config>
5304#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5305#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5306#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5307pub struct ClusterMonitoringPodMonitorRelabelings {
5308    /// action to perform based on the regex matching.
5309    ///
5310    /// `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
5311    /// `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
5312    ///
5313    /// Default: "Replace"
5314    #[serde(default, skip_serializing_if = "Option::is_none")]
5315    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5316    pub action: Option<ClusterMonitoringPodMonitorRelabelingsAction>,
5317    /// modulus to take of the hash of the source label values.
5318    ///
5319    /// Only applicable when the action is `HashMod`.
5320    #[serde(default, skip_serializing_if = "Option::is_none")]
5321    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5322    pub modulus: Option<i64>,
5323    /// regex defines the regular expression against which the extracted value is matched.
5324    #[serde(default, skip_serializing_if = "Option::is_none")]
5325    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5326    pub regex: Option<String>,
5327    /// replacement value against which a Replace action is performed if the
5328    /// regular expression matches.
5329    ///
5330    /// Regex capture groups are available.
5331    #[serde(default, skip_serializing_if = "Option::is_none")]
5332    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5333    pub replacement: Option<String>,
5334    /// separator defines the string between concatenated SourceLabels.
5335    #[serde(default, skip_serializing_if = "Option::is_none")]
5336    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5337    pub separator: Option<String>,
5338    /// sourceLabels defines the source labels select values from existing labels. Their content is
5339    /// concatenated using the configured Separator and matched against the
5340    /// configured regular expression.
5341    #[serde(
5342        default,
5343        skip_serializing_if = "Option::is_none",
5344        rename = "sourceLabels"
5345    )]
5346    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5347    pub source_labels: Option<Vec<String>>,
5348    /// targetLabel defines the label to which the resulting string is written in a replacement.
5349    ///
5350    /// It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
5351    /// `KeepEqual` and `DropEqual` actions.
5352    ///
5353    /// Regex capture groups are available.
5354    #[serde(
5355        default,
5356        skip_serializing_if = "Option::is_none",
5357        rename = "targetLabel"
5358    )]
5359    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5360    pub target_label: Option<String>,
5361}
5362
5363/// RelabelConfig allows dynamic rewriting of the label set for targets, alerts,
5364/// scraped samples and remote write samples.
5365///
5366/// More info: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config>
5367#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
5368#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5369pub enum ClusterMonitoringPodMonitorRelabelingsAction {
5370    #[serde(rename = "replace")]
5371    Replace,
5372    #[serde(rename = "Replace")]
5373    ReplaceX,
5374    #[serde(rename = "keep")]
5375    Keep,
5376    #[serde(rename = "Keep")]
5377    KeepX,
5378    #[serde(rename = "drop")]
5379    Drop,
5380    #[serde(rename = "Drop")]
5381    DropX,
5382    #[serde(rename = "hashmod")]
5383    Hashmod,
5384    HashMod,
5385    #[serde(rename = "labelmap")]
5386    Labelmap,
5387    LabelMap,
5388    #[serde(rename = "labeldrop")]
5389    Labeldrop,
5390    LabelDrop,
5391    #[serde(rename = "labelkeep")]
5392    Labelkeep,
5393    LabelKeep,
5394    #[serde(rename = "lowercase")]
5395    Lowercase,
5396    #[serde(rename = "Lowercase")]
5397    LowercaseX,
5398    #[serde(rename = "uppercase")]
5399    Uppercase,
5400    #[serde(rename = "Uppercase")]
5401    UppercaseX,
5402    #[serde(rename = "keepequal")]
5403    Keepequal,
5404    KeepEqual,
5405    #[serde(rename = "dropequal")]
5406    Dropequal,
5407    DropEqual,
5408}
5409
5410/// Configure TLS communication for the metrics endpoint.
5411/// Changing tls.enabled option will force a rollout of all instances.
5412#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5413#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5414#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5415pub struct ClusterMonitoringTls {
5416    /// Enable TLS for the monitoring endpoint.
5417    /// Changing this option will force a rollout of all instances.
5418    #[serde(default, skip_serializing_if = "Option::is_none")]
5419    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5420    pub enabled: Option<bool>,
5421}
5422
5423/// Define a maintenance window for the Kubernetes nodes
5424#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5425#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5426#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5427pub struct ClusterNodeMaintenanceWindow {
5428    /// Is there a node maintenance activity in progress?
5429    #[serde(
5430        default,
5431        skip_serializing_if = "Option::is_none",
5432        rename = "inProgress"
5433    )]
5434    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5435    pub in_progress: Option<bool>,
5436    /// Reuse the existing PVC (wait for the node to come
5437    /// up again) or not (recreate it elsewhere - when `instances` >1)
5438    #[serde(default, skip_serializing_if = "Option::is_none", rename = "reusePVC")]
5439    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5440    pub reuse_pvc: Option<bool>,
5441}
5442
5443/// PluginConfiguration specifies a plugin that need to be loaded for this
5444/// cluster to be reconciled
5445#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5446#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5447#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5448pub struct ClusterPlugins {
5449    /// Enabled is true if this plugin will be used
5450    #[serde(default, skip_serializing_if = "Option::is_none")]
5451    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5452    pub enabled: Option<bool>,
5453    /// Marks the plugin as the WAL archiver. At most one plugin can be
5454    /// designated as a WAL archiver. This cannot be enabled if the
5455    /// `.spec.backup.barmanObjectStore` configuration is present.
5456    #[serde(
5457        default,
5458        skip_serializing_if = "Option::is_none",
5459        rename = "isWALArchiver"
5460    )]
5461    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5462    pub is_wal_archiver: Option<bool>,
5463    /// Name is the plugin name
5464    pub name: String,
5465    /// Parameters is the configuration of the plugin
5466    #[serde(default, skip_serializing_if = "Option::is_none")]
5467    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5468    pub parameters: Option<BTreeMap<String, String>>,
5469}
5470
5471/// Override the PodSecurityContext applied to every Pod of the cluster.
5472/// When set, this overrides the operator's default PodSecurityContext for the cluster.
5473/// If omitted, the operator defaults are used.
5474/// This field doesn't have any effect if SecurityContextConstraints are present.
5475#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5476#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5477#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5478pub struct ClusterPodSecurityContext {
5479    /// appArmorProfile is the AppArmor options to use by the containers in this pod.
5480    /// Note that this field cannot be set when spec.os.name is windows.
5481    #[serde(
5482        default,
5483        skip_serializing_if = "Option::is_none",
5484        rename = "appArmorProfile"
5485    )]
5486    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5487    pub app_armor_profile: Option<ClusterPodSecurityContextAppArmorProfile>,
5488    /// A special supplemental group that applies to all containers in a pod.
5489    /// Some volume types allow the Kubelet to change the ownership of that volume
5490    /// to be owned by the pod:
5491    ///
5492    /// 1. The owning GID will be the FSGroup
5493    /// 2. The setgid bit is set (new files created in the volume will be owned by FSGroup)
5494    /// 3. The permission bits are OR'd with rw-rw----
5495    ///
5496    /// If unset, the Kubelet will not modify the ownership and permissions of any volume.
5497    /// Note that this field cannot be set when spec.os.name is windows.
5498    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fsGroup")]
5499    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5500    pub fs_group: Option<i64>,
5501    /// fsGroupChangePolicy defines behavior of changing ownership and permission of the volume
5502    /// before being exposed inside Pod. This field will only apply to
5503    /// volume types which support fsGroup based ownership(and permissions).
5504    /// It will have no effect on ephemeral volume types such as: secret, configmaps
5505    /// and emptydir.
5506    /// Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used.
5507    /// Note that this field cannot be set when spec.os.name is windows.
5508    #[serde(
5509        default,
5510        skip_serializing_if = "Option::is_none",
5511        rename = "fsGroupChangePolicy"
5512    )]
5513    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5514    pub fs_group_change_policy: Option<String>,
5515    /// The GID to run the entrypoint of the container process.
5516    /// Uses runtime default if unset.
5517    /// May also be set in SecurityContext.  If set in both SecurityContext and
5518    /// PodSecurityContext, the value specified in SecurityContext takes precedence
5519    /// for that container.
5520    /// Note that this field cannot be set when spec.os.name is windows.
5521    #[serde(
5522        default,
5523        skip_serializing_if = "Option::is_none",
5524        rename = "runAsGroup"
5525    )]
5526    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5527    pub run_as_group: Option<i64>,
5528    /// Indicates that the container must run as a non-root user.
5529    /// If true, the Kubelet will validate the image at runtime to ensure that it
5530    /// does not run as UID 0 (root) and fail to start the container if it does.
5531    /// If unset or false, no such validation will be performed.
5532    /// May also be set in SecurityContext.  If set in both SecurityContext and
5533    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
5534    #[serde(
5535        default,
5536        skip_serializing_if = "Option::is_none",
5537        rename = "runAsNonRoot"
5538    )]
5539    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5540    pub run_as_non_root: Option<bool>,
5541    /// The UID to run the entrypoint of the container process.
5542    /// Defaults to user specified in image metadata if unspecified.
5543    /// May also be set in SecurityContext.  If set in both SecurityContext and
5544    /// PodSecurityContext, the value specified in SecurityContext takes precedence
5545    /// for that container.
5546    /// Note that this field cannot be set when spec.os.name is windows.
5547    #[serde(default, skip_serializing_if = "Option::is_none", rename = "runAsUser")]
5548    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5549    pub run_as_user: Option<i64>,
5550    /// seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod.
5551    /// It has no effect on nodes that do not support SELinux or to volumes does not support SELinux.
5552    /// Valid values are "MountOption" and "Recursive".
5553    ///
5554    /// "Recursive" means relabeling of all files on all Pod volumes by the container runtime.
5555    /// This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node.
5556    ///
5557    /// "MountOption" mounts all eligible Pod volumes with `-o context` mount option.
5558    /// This requires all Pods that share the same volume to use the same SELinux label.
5559    /// It is not possible to share the same volume among privileged and unprivileged Pods.
5560    /// Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes
5561    /// whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their
5562    /// CSIDriver instance. Other volumes are always re-labelled recursively.
5563    ///
5564    /// If not specified, "MountOption" is used.
5565    ///
5566    /// This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers.
5567    ///
5568    /// All Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state.
5569    /// Note that this field cannot be set when spec.os.name is windows.
5570    #[serde(
5571        default,
5572        skip_serializing_if = "Option::is_none",
5573        rename = "seLinuxChangePolicy"
5574    )]
5575    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5576    pub se_linux_change_policy: Option<String>,
5577    /// The SELinux context to be applied to all containers.
5578    /// If unspecified, the container runtime will allocate a random SELinux context for each
5579    /// container.  May also be set in SecurityContext.  If set in
5580    /// both SecurityContext and PodSecurityContext, the value specified in SecurityContext
5581    /// takes precedence for that container.
5582    /// Note that this field cannot be set when spec.os.name is windows.
5583    #[serde(
5584        default,
5585        skip_serializing_if = "Option::is_none",
5586        rename = "seLinuxOptions"
5587    )]
5588    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5589    pub se_linux_options: Option<ClusterPodSecurityContextSeLinuxOptions>,
5590    /// The seccomp options to use by the containers in this pod.
5591    /// Note that this field cannot be set when spec.os.name is windows.
5592    #[serde(
5593        default,
5594        skip_serializing_if = "Option::is_none",
5595        rename = "seccompProfile"
5596    )]
5597    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5598    pub seccomp_profile: Option<ClusterPodSecurityContextSeccompProfile>,
5599    /// A list of groups applied to the first process run in each container, in
5600    /// addition to the container's primary GID and fsGroup (if specified).  If
5601    /// the SupplementalGroupsPolicy feature is enabled, the
5602    /// supplementalGroupsPolicy field determines whether these are in addition
5603    /// to or instead of any group memberships defined in the container image.
5604    /// If unspecified, no additional groups are added, though group memberships
5605    /// defined in the container image may still be used, depending on the
5606    /// supplementalGroupsPolicy field.
5607    /// Note that this field cannot be set when spec.os.name is windows.
5608    #[serde(
5609        default,
5610        skip_serializing_if = "Option::is_none",
5611        rename = "supplementalGroups"
5612    )]
5613    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5614    pub supplemental_groups: Option<Vec<i64>>,
5615    /// Defines how supplemental groups of the first container processes are calculated.
5616    /// Valid values are "Merge" and "Strict". If not specified, "Merge" is used.
5617    /// (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled
5618    /// and the container runtime must implement support for this feature.
5619    /// Note that this field cannot be set when spec.os.name is windows.
5620    #[serde(
5621        default,
5622        skip_serializing_if = "Option::is_none",
5623        rename = "supplementalGroupsPolicy"
5624    )]
5625    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5626    pub supplemental_groups_policy: Option<String>,
5627    /// Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported
5628    /// sysctls (by the container runtime) might fail to launch.
5629    /// Note that this field cannot be set when spec.os.name is windows.
5630    #[serde(default, skip_serializing_if = "Option::is_none")]
5631    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5632    pub sysctls: Option<Vec<ClusterPodSecurityContextSysctls>>,
5633    /// The Windows specific settings applied to all containers.
5634    /// If unspecified, the options within a container's SecurityContext will be used.
5635    /// If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
5636    /// Note that this field cannot be set when spec.os.name is linux.
5637    #[serde(
5638        default,
5639        skip_serializing_if = "Option::is_none",
5640        rename = "windowsOptions"
5641    )]
5642    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5643    pub windows_options: Option<ClusterPodSecurityContextWindowsOptions>,
5644}
5645
5646/// appArmorProfile is the AppArmor options to use by the containers in this pod.
5647/// Note that this field cannot be set when spec.os.name is windows.
5648#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5649#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5650#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5651pub struct ClusterPodSecurityContextAppArmorProfile {
5652    /// localhostProfile indicates a profile loaded on the node that should be used.
5653    /// The profile must be preconfigured on the node to work.
5654    /// Must match the loaded name of the profile.
5655    /// Must be set if and only if type is "Localhost".
5656    #[serde(
5657        default,
5658        skip_serializing_if = "Option::is_none",
5659        rename = "localhostProfile"
5660    )]
5661    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5662    pub localhost_profile: Option<String>,
5663    /// type indicates which kind of AppArmor profile will be applied.
5664    /// Valid options are:
5665    ///   Localhost - a profile pre-loaded on the node.
5666    ///   RuntimeDefault - the container runtime's default profile.
5667    ///   Unconfined - no AppArmor enforcement.
5668    #[serde(rename = "type")]
5669    pub r#type: String,
5670}
5671
5672/// The SELinux context to be applied to all containers.
5673/// If unspecified, the container runtime will allocate a random SELinux context for each
5674/// container.  May also be set in SecurityContext.  If set in
5675/// both SecurityContext and PodSecurityContext, the value specified in SecurityContext
5676/// takes precedence for that container.
5677/// Note that this field cannot be set when spec.os.name is windows.
5678#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5679#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5680#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5681pub struct ClusterPodSecurityContextSeLinuxOptions {
5682    /// Level is SELinux level label that applies to the container.
5683    #[serde(default, skip_serializing_if = "Option::is_none")]
5684    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5685    pub level: Option<String>,
5686    /// Role is a SELinux role label that applies to the container.
5687    #[serde(default, skip_serializing_if = "Option::is_none")]
5688    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5689    pub role: Option<String>,
5690    /// Type is a SELinux type label that applies to the container.
5691    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
5692    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5693    pub r#type: Option<String>,
5694    /// User is a SELinux user label that applies to the container.
5695    #[serde(default, skip_serializing_if = "Option::is_none")]
5696    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5697    pub user: Option<String>,
5698}
5699
5700/// The seccomp options to use by the containers in this pod.
5701/// Note that this field cannot be set when spec.os.name is windows.
5702#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5703#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5704#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5705pub struct ClusterPodSecurityContextSeccompProfile {
5706    /// localhostProfile indicates a profile defined in a file on the node should be used.
5707    /// The profile must be preconfigured on the node to work.
5708    /// Must be a descending path, relative to the kubelet's configured seccomp profile location.
5709    /// Must be set if type is "Localhost". Must NOT be set for any other type.
5710    #[serde(
5711        default,
5712        skip_serializing_if = "Option::is_none",
5713        rename = "localhostProfile"
5714    )]
5715    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5716    pub localhost_profile: Option<String>,
5717    /// type indicates which kind of seccomp profile will be applied.
5718    /// Valid options are:
5719    ///
5720    /// Localhost - a profile defined in a file on the node should be used.
5721    /// RuntimeDefault - the container runtime default profile should be used.
5722    /// Unconfined - no profile should be applied.
5723    #[serde(rename = "type")]
5724    pub r#type: String,
5725}
5726
5727/// Sysctl defines a kernel parameter to be set
5728#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5729#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5730#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5731pub struct ClusterPodSecurityContextSysctls {
5732    /// Name of a property to set
5733    pub name: String,
5734    /// Value of a property to set
5735    pub value: String,
5736}
5737
5738/// The Windows specific settings applied to all containers.
5739/// If unspecified, the options within a container's SecurityContext will be used.
5740/// If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
5741/// Note that this field cannot be set when spec.os.name is linux.
5742#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5743#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5744#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5745pub struct ClusterPodSecurityContextWindowsOptions {
5746    /// GMSACredentialSpec is where the GMSA admission webhook
5747    /// (<https://github.com/kubernetes-sigs/windows-gmsa)> inlines the contents of the
5748    /// GMSA credential spec named by the GMSACredentialSpecName field.
5749    #[serde(
5750        default,
5751        skip_serializing_if = "Option::is_none",
5752        rename = "gmsaCredentialSpec"
5753    )]
5754    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5755    pub gmsa_credential_spec: Option<String>,
5756    /// GMSACredentialSpecName is the name of the GMSA credential spec to use.
5757    #[serde(
5758        default,
5759        skip_serializing_if = "Option::is_none",
5760        rename = "gmsaCredentialSpecName"
5761    )]
5762    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5763    pub gmsa_credential_spec_name: Option<String>,
5764    /// HostProcess determines if a container should be run as a 'Host Process' container.
5765    /// All of a Pod's containers must have the same effective HostProcess value
5766    /// (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers).
5767    /// In addition, if HostProcess is true then HostNetwork must also be set to true.
5768    #[serde(
5769        default,
5770        skip_serializing_if = "Option::is_none",
5771        rename = "hostProcess"
5772    )]
5773    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5774    pub host_process: Option<bool>,
5775    /// The UserName in Windows to run the entrypoint of the container process.
5776    /// Defaults to the user specified in image metadata if unspecified.
5777    /// May also be set in PodSecurityContext. If set in both SecurityContext and
5778    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
5779    #[serde(
5780        default,
5781        skip_serializing_if = "Option::is_none",
5782        rename = "runAsUserName"
5783    )]
5784    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5785    pub run_as_user_name: Option<String>,
5786}
5787
5788/// PodSelectorRef defines a named pod label selector for use in pg_hba rules.
5789/// Pods matching the selector in the Cluster's namespace will have their IPs
5790/// resolved and made available for pg_hba address expansion via the
5791/// `${podselector:NAME}` syntax.
5792#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5793#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5794#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5795pub struct ClusterPodSelectorRefs {
5796    /// Name is the identifier used to reference this selector in pg_hba rules
5797    /// via the ${podselector:NAME} syntax in the address field.
5798    pub name: String,
5799    /// Selector is a label selector that identifies the pods whose IPs
5800    /// should be resolved. Only pods in the Cluster's namespace are considered.
5801    pub selector: ClusterPodSelectorRefsSelector,
5802}
5803
5804/// Selector is a label selector that identifies the pods whose IPs
5805/// should be resolved. Only pods in the Cluster's namespace are considered.
5806#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5807#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5808#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5809pub struct ClusterPodSelectorRefsSelector {
5810    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
5811    #[serde(
5812        default,
5813        skip_serializing_if = "Option::is_none",
5814        rename = "matchExpressions"
5815    )]
5816    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5817    pub match_expressions: Option<Vec<ClusterPodSelectorRefsSelectorMatchExpressions>>,
5818    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
5819    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
5820    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
5821    #[serde(
5822        default,
5823        skip_serializing_if = "Option::is_none",
5824        rename = "matchLabels"
5825    )]
5826    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5827    pub match_labels: Option<BTreeMap<String, String>>,
5828}
5829
5830/// A label selector requirement is a selector that contains values, a key, and an operator that
5831/// relates the key and values.
5832#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5833#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5834#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5835pub struct ClusterPodSelectorRefsSelectorMatchExpressions {
5836    /// key is the label key that the selector applies to.
5837    pub key: String,
5838    /// operator represents a key's relationship to a set of values.
5839    /// Valid operators are In, NotIn, Exists and DoesNotExist.
5840    pub operator: String,
5841    /// values is an array of string values. If the operator is In or NotIn,
5842    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
5843    /// the values array must be empty. This array is replaced during a strategic
5844    /// merge patch.
5845    #[serde(default, skip_serializing_if = "Option::is_none")]
5846    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5847    pub values: Option<Vec<String>>,
5848}
5849
5850/// Configuration of the PostgreSQL server
5851#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5852#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5853#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5854pub struct ClusterPostgresql {
5855    /// If this parameter is true, the user will be able to invoke `ALTER SYSTEM`
5856    /// on this CloudNativePG Cluster.
5857    /// This should only be used for debugging and troubleshooting.
5858    /// Defaults to false.
5859    #[serde(
5860        default,
5861        skip_serializing_if = "Option::is_none",
5862        rename = "enableAlterSystem"
5863    )]
5864    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5865    pub enable_alter_system: Option<bool>,
5866    /// The configuration of the extensions to be added
5867    #[serde(default, skip_serializing_if = "Option::is_none")]
5868    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5869    pub extensions: Option<Vec<ClusterPostgresqlExtensions>>,
5870    /// Options to specify LDAP configuration
5871    #[serde(default, skip_serializing_if = "Option::is_none")]
5872    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5873    pub ldap: Option<ClusterPostgresqlLdap>,
5874    /// PostgreSQL configuration options (postgresql.conf)
5875    #[serde(default, skip_serializing_if = "Option::is_none")]
5876    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5877    pub parameters: Option<BTreeMap<String, String>>,
5878    /// PostgreSQL Host Based Authentication rules (lines to be appended
5879    /// to the pg_hba.conf file).
5880    /// Use the ${podselector:NAME} syntax to reference a pod selector;
5881    /// the rule will be expanded for each Pod IP matching that selector.
5882    #[serde(default, skip_serializing_if = "Option::is_none")]
5883    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5884    pub pg_hba: Option<Vec<String>>,
5885    /// PostgreSQL User Name Maps rules (lines to be appended
5886    /// to the pg_ident.conf file)
5887    #[serde(default, skip_serializing_if = "Option::is_none")]
5888    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5889    pub pg_ident: Option<Vec<String>>,
5890    /// Specifies the maximum number of seconds to wait when promoting an instance to primary.
5891    /// Default value is 40000000, greater than one year in seconds,
5892    /// big enough to simulate an infinite timeout
5893    #[serde(
5894        default,
5895        skip_serializing_if = "Option::is_none",
5896        rename = "promotionTimeout"
5897    )]
5898    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5899    pub promotion_timeout: Option<i32>,
5900    /// Lists of shared preload libraries to add to the default ones
5901    #[serde(default, skip_serializing_if = "Option::is_none")]
5902    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5903    pub shared_preload_libraries: Option<Vec<String>>,
5904    /// Requirements to be met by sync replicas. This will affect how the "synchronous_standby_names" parameter will be
5905    /// set up.
5906    #[serde(
5907        default,
5908        skip_serializing_if = "Option::is_none",
5909        rename = "syncReplicaElectionConstraint"
5910    )]
5911    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5912    pub sync_replica_election_constraint: Option<ClusterPostgresqlSyncReplicaElectionConstraint>,
5913    /// Configuration of the PostgreSQL synchronous replication feature
5914    #[serde(default, skip_serializing_if = "Option::is_none")]
5915    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5916    pub synchronous: Option<ClusterPostgresqlSynchronous>,
5917}
5918
5919/// ExtensionConfiguration is the configuration used to add
5920/// PostgreSQL extensions to the Cluster.
5921#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5922#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5923#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5924pub struct ClusterPostgresqlExtensions {
5925    /// A list of directories within the image to be appended to the
5926    /// PostgreSQL process's `PATH` environment variable.
5927    #[serde(default, skip_serializing_if = "Option::is_none")]
5928    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5929    pub bin_path: Option<Vec<String>>,
5930    /// The list of directories inside the image which should be added to dynamic_library_path.
5931    /// If not defined, defaults to "/lib".
5932    #[serde(default, skip_serializing_if = "Option::is_none")]
5933    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5934    pub dynamic_library_path: Option<Vec<String>>,
5935    /// Env is a list of custom environment variables to be set in the
5936    /// PostgreSQL process for this extension. It is the responsibility of the
5937    /// cluster administrator to ensure the variables are correct for the
5938    /// specific extension. Note that changes to these variables require
5939    /// a manual cluster restart to take effect.
5940    #[serde(default, skip_serializing_if = "Option::is_none")]
5941    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5942    pub env: Option<Vec<ClusterPostgresqlExtensionsEnv>>,
5943    /// The list of directories inside the image which should be added to extension_control_path.
5944    /// If not defined, defaults to "/share".
5945    #[serde(default, skip_serializing_if = "Option::is_none")]
5946    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5947    pub extension_control_path: Option<Vec<String>>,
5948    /// The image containing the extension.
5949    #[serde(default, skip_serializing_if = "Option::is_none")]
5950    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5951    pub image: Option<ClusterPostgresqlExtensionsImage>,
5952    /// The list of directories inside the image which should be added to ld_library_path.
5953    #[serde(default, skip_serializing_if = "Option::is_none")]
5954    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5955    pub ld_library_path: Option<Vec<String>>,
5956    /// The name of the extension, required. The limit of 59 characters
5957    /// leaves room for the prefix the operator adds when deriving the
5958    /// extension's Kubernetes Volume name (capped at 63 characters).
5959    pub name: String,
5960}
5961
5962/// ExtensionEnvVar defines an environment variable for a specific extension
5963/// image volume.
5964#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5965#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5966#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5967pub struct ClusterPostgresqlExtensionsEnv {
5968    /// Name of the environment variable to be injected into the
5969    /// PostgreSQL process.
5970    pub name: String,
5971    /// Value of the environment variable. CloudNativePG performs a direct
5972    /// replacement of this value, with support for placeholder expansion.
5973    /// The ${`image_root`} placeholder resolves to the absolute mount path
5974    /// of the extension's volume (e.g., `/extensions/my-extension`). This
5975    /// is particularly useful for allowing applications or libraries to
5976    /// locate specific directories within the mounted image.
5977    /// Unrecognized placeholders are rejected. To include a literal ${...}
5978    /// in the value, escape it as $${...}.
5979    pub value: String,
5980}
5981
5982/// The image containing the extension.
5983#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
5984#[cfg_attr(feature = "builder", derive(TypedBuilder))]
5985#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5986pub struct ClusterPostgresqlExtensionsImage {
5987    /// Policy for pulling OCI objects. Possible values are:
5988    /// Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails.
5989    /// Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present.
5990    /// IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.
5991    /// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
5992    #[serde(
5993        default,
5994        skip_serializing_if = "Option::is_none",
5995        rename = "pullPolicy"
5996    )]
5997    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
5998    pub pull_policy: Option<String>,
5999    /// Required: Image or artifact reference to be used.
6000    /// Behaves in the same way as pod.spec.containers[*].image.
6001    /// Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets.
6002    /// More info: <https://kubernetes.io/docs/concepts/containers/images>
6003    /// This field is optional to allow higher level config management to default or override
6004    /// container images in workload controllers like Deployments and StatefulSets.
6005    #[serde(default, skip_serializing_if = "Option::is_none")]
6006    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6007    pub reference: Option<String>,
6008}
6009
6010/// Options to specify LDAP configuration
6011#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6012#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6013#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6014pub struct ClusterPostgresqlLdap {
6015    /// Bind as authentication configuration
6016    #[serde(
6017        default,
6018        skip_serializing_if = "Option::is_none",
6019        rename = "bindAsAuth"
6020    )]
6021    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6022    pub bind_as_auth: Option<ClusterPostgresqlLdapBindAsAuth>,
6023    /// Bind+Search authentication configuration
6024    #[serde(
6025        default,
6026        skip_serializing_if = "Option::is_none",
6027        rename = "bindSearchAuth"
6028    )]
6029    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6030    pub bind_search_auth: Option<ClusterPostgresqlLdapBindSearchAuth>,
6031    /// LDAP server port
6032    #[serde(default, skip_serializing_if = "Option::is_none")]
6033    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6034    pub port: Option<i64>,
6035    /// LDAP schema to be used, possible options are `ldap` and `ldaps`
6036    #[serde(default, skip_serializing_if = "Option::is_none")]
6037    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6038    pub scheme: Option<ClusterPostgresqlLdapScheme>,
6039    /// LDAP hostname or IP address
6040    #[serde(default, skip_serializing_if = "Option::is_none")]
6041    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6042    pub server: Option<String>,
6043    /// Set to 'true' to enable LDAP over TLS. 'false' is default
6044    #[serde(default, skip_serializing_if = "Option::is_none")]
6045    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6046    pub tls: Option<bool>,
6047}
6048
6049/// Bind as authentication configuration
6050#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6051#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6052#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6053pub struct ClusterPostgresqlLdapBindAsAuth {
6054    /// Prefix for the bind authentication option
6055    #[serde(default, skip_serializing_if = "Option::is_none")]
6056    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6057    pub prefix: Option<String>,
6058    /// Suffix for the bind authentication option
6059    #[serde(default, skip_serializing_if = "Option::is_none")]
6060    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6061    pub suffix: Option<String>,
6062}
6063
6064/// Bind+Search authentication configuration
6065#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6066#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6067#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6068pub struct ClusterPostgresqlLdapBindSearchAuth {
6069    /// Root DN to begin the user search
6070    #[serde(default, skip_serializing_if = "Option::is_none", rename = "baseDN")]
6071    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6072    pub base_dn: Option<String>,
6073    /// DN of the user to bind to the directory
6074    #[serde(default, skip_serializing_if = "Option::is_none", rename = "bindDN")]
6075    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6076    pub bind_dn: Option<String>,
6077    /// Secret with the password for the user to bind to the directory
6078    #[serde(
6079        default,
6080        skip_serializing_if = "Option::is_none",
6081        rename = "bindPassword"
6082    )]
6083    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6084    pub bind_password: Option<ClusterPostgresqlLdapBindSearchAuthBindPassword>,
6085    /// Attribute to match against the username
6086    #[serde(
6087        default,
6088        skip_serializing_if = "Option::is_none",
6089        rename = "searchAttribute"
6090    )]
6091    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6092    pub search_attribute: Option<String>,
6093    /// Search filter to use when doing the search+bind authentication
6094    #[serde(
6095        default,
6096        skip_serializing_if = "Option::is_none",
6097        rename = "searchFilter"
6098    )]
6099    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6100    pub search_filter: Option<String>,
6101}
6102
6103/// Secret with the password for the user to bind to the directory
6104#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6105#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6106#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6107pub struct ClusterPostgresqlLdapBindSearchAuthBindPassword {
6108    /// The key of the secret to select from.  Must be a valid secret key.
6109    pub key: String,
6110    /// Name of the referent.
6111    /// This field is effectively required, but due to backwards compatibility is
6112    /// allowed to be empty. Instances of this type with an empty value here are
6113    /// almost certainly wrong.
6114    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
6115    #[serde(default, skip_serializing_if = "Option::is_none")]
6116    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6117    pub name: Option<String>,
6118    /// Specify whether the Secret or its key must be defined
6119    #[serde(default, skip_serializing_if = "Option::is_none")]
6120    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6121    pub optional: Option<bool>,
6122}
6123
6124/// Options to specify LDAP configuration
6125#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6126#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6127pub enum ClusterPostgresqlLdapScheme {
6128    #[serde(rename = "ldap")]
6129    Ldap,
6130    #[serde(rename = "ldaps")]
6131    Ldaps,
6132}
6133
6134/// Requirements to be met by sync replicas. This will affect how the "synchronous_standby_names" parameter will be
6135/// set up.
6136#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6137#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6138#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6139pub struct ClusterPostgresqlSyncReplicaElectionConstraint {
6140    /// This flag enables the constraints for sync replicas
6141    pub enabled: bool,
6142    /// A list of node labels values to extract and compare to evaluate if the pods reside in the same topology or not
6143    #[serde(
6144        default,
6145        skip_serializing_if = "Option::is_none",
6146        rename = "nodeLabelsAntiAffinity"
6147    )]
6148    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6149    pub node_labels_anti_affinity: Option<Vec<String>>,
6150}
6151
6152/// Configuration of the PostgreSQL synchronous replication feature
6153#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6154#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6155#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6156pub struct ClusterPostgresqlSynchronous {
6157    /// If set to "required", data durability is strictly enforced. Write operations
6158    /// with synchronous commit settings (`on`, `remote_write`, or `remote_apply`) will
6159    /// block if there are insufficient healthy replicas, ensuring data persistence.
6160    /// If set to "preferred", data durability is maintained when healthy replicas
6161    /// are available, but the required number of instances will adjust dynamically
6162    /// if replicas become unavailable. This setting relaxes strict durability enforcement
6163    /// to allow for operational continuity. This setting is only applicable if both
6164    /// `standbyNamesPre` and `standbyNamesPost` are unset (empty).
6165    #[serde(
6166        default,
6167        skip_serializing_if = "Option::is_none",
6168        rename = "dataDurability"
6169    )]
6170    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6171    pub data_durability: Option<ClusterPostgresqlSynchronousDataDurability>,
6172    /// FailoverQuorum enables a quorum-based check before failover, improving
6173    /// data durability and safety during failover events in CloudNativePG-managed
6174    /// PostgreSQL clusters.
6175    #[serde(
6176        default,
6177        skip_serializing_if = "Option::is_none",
6178        rename = "failoverQuorum"
6179    )]
6180    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6181    pub failover_quorum: Option<bool>,
6182    /// Specifies the maximum number of local cluster pods that can be
6183    /// automatically included in the `synchronous_standby_names` option in
6184    /// PostgreSQL.
6185    #[serde(
6186        default,
6187        skip_serializing_if = "Option::is_none",
6188        rename = "maxStandbyNamesFromCluster"
6189    )]
6190    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6191    pub max_standby_names_from_cluster: Option<i64>,
6192    /// Method to select synchronous replication standbys from the listed
6193    /// servers, accepting 'any' (quorum-based synchronous replication) or
6194    /// 'first' (priority-based synchronous replication) as values.
6195    pub method: ClusterPostgresqlSynchronousMethod,
6196    /// Specifies the number of synchronous standby servers that
6197    /// transactions must wait for responses from.
6198    pub number: i64,
6199    /// A user-defined list of application names to be added to
6200    /// `synchronous_standby_names` after local cluster pods (the order is
6201    /// only useful for priority-based synchronous replication).
6202    #[serde(
6203        default,
6204        skip_serializing_if = "Option::is_none",
6205        rename = "standbyNamesPost"
6206    )]
6207    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6208    pub standby_names_post: Option<Vec<String>>,
6209    /// A user-defined list of application names to be added to
6210    /// `synchronous_standby_names` before local cluster pods (the order is
6211    /// only useful for priority-based synchronous replication).
6212    #[serde(
6213        default,
6214        skip_serializing_if = "Option::is_none",
6215        rename = "standbyNamesPre"
6216    )]
6217    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6218    pub standby_names_pre: Option<Vec<String>>,
6219}
6220
6221/// Configuration of the PostgreSQL synchronous replication feature
6222#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6223#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6224pub enum ClusterPostgresqlSynchronousDataDurability {
6225    #[serde(rename = "required")]
6226    Required,
6227    #[serde(rename = "preferred")]
6228    Preferred,
6229}
6230
6231/// Configuration of the PostgreSQL synchronous replication feature
6232#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6233#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6234pub enum ClusterPostgresqlSynchronousMethod {
6235    #[serde(rename = "any")]
6236    Any,
6237    #[serde(rename = "first")]
6238    First,
6239}
6240
6241/// Configuration of the Kubernetes `Lease` used to coordinate safe primary
6242/// election within the cluster. When omitted, the operator applies built-in
6243/// defaults; tune these values only if you understand the consequences for
6244/// failover timing.
6245#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6246#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6247#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6248pub struct ClusterPrimaryLease {
6249    /// How long, in seconds, the primary lease is considered valid before it
6250    /// expires and another instance may acquire it. It must be greater than
6251    /// `renewDeadlineSeconds`.
6252    /// Defaults to 15.
6253    #[serde(
6254        default,
6255        skip_serializing_if = "Option::is_none",
6256        rename = "leaseDurationSeconds"
6257    )]
6258    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6259    pub lease_duration_seconds: Option<i32>,
6260    /// The TTL, in seconds, written when the primary explicitly releases the
6261    /// lease on a clean shutdown, allowing a replica to promote without waiting
6262    /// for the full lease duration to expire.
6263    /// Defaults to 1.
6264    #[serde(
6265        default,
6266        skip_serializing_if = "Option::is_none",
6267        rename = "releasedLeaseDurationSeconds"
6268    )]
6269    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6270    pub released_lease_duration_seconds: Option<i32>,
6271    /// How long, in seconds, the current primary keeps retrying to renew the
6272    /// lease before giving up and stopping. It must be smaller than
6273    /// `leaseDurationSeconds`.
6274    /// Defaults to 10.
6275    #[serde(
6276        default,
6277        skip_serializing_if = "Option::is_none",
6278        rename = "renewDeadlineSeconds"
6279    )]
6280    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6281    pub renew_deadline_seconds: Option<i32>,
6282    /// How frequently, in seconds, a non-holder instance retries acquiring or
6283    /// renewing the lease.
6284    /// Defaults to 2.
6285    #[serde(
6286        default,
6287        skip_serializing_if = "Option::is_none",
6288        rename = "retryPeriodSeconds"
6289    )]
6290    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6291    pub retry_period_seconds: Option<i32>,
6292}
6293
6294/// Specification of the desired behavior of the cluster.
6295/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
6296#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6297#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6298pub enum ClusterPrimaryUpdateMethod {
6299    #[serde(rename = "switchover")]
6300    Switchover,
6301    #[serde(rename = "restart")]
6302    Restart,
6303}
6304
6305/// Specification of the desired behavior of the cluster.
6306/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
6307#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6308#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6309pub enum ClusterPrimaryUpdateStrategy {
6310    #[serde(rename = "unsupervised")]
6311    Unsupervised,
6312    #[serde(rename = "supervised")]
6313    Supervised,
6314}
6315
6316/// The configuration of the probes to be injected
6317/// in the PostgreSQL Pods.
6318#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6319#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6320#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6321pub struct ClusterProbes {
6322    /// The liveness probe configuration
6323    #[serde(default, skip_serializing_if = "Option::is_none")]
6324    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6325    pub liveness: Option<ClusterProbesLiveness>,
6326    /// The readiness probe configuration
6327    #[serde(default, skip_serializing_if = "Option::is_none")]
6328    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6329    pub readiness: Option<ClusterProbesReadiness>,
6330    /// The startup probe configuration
6331    #[serde(default, skip_serializing_if = "Option::is_none")]
6332    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6333    pub startup: Option<ClusterProbesStartup>,
6334}
6335
6336/// The liveness probe configuration
6337#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6338#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6339#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6340pub struct ClusterProbesLiveness {
6341    /// Minimum consecutive failures for the probe to be considered failed after having succeeded.
6342    /// Defaults to 3. Minimum value is 1.
6343    #[serde(
6344        default,
6345        skip_serializing_if = "Option::is_none",
6346        rename = "failureThreshold"
6347    )]
6348    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6349    pub failure_threshold: Option<i32>,
6350    /// Number of seconds after the container has started before liveness probes are initiated.
6351    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6352    #[serde(
6353        default,
6354        skip_serializing_if = "Option::is_none",
6355        rename = "initialDelaySeconds"
6356    )]
6357    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6358    pub initial_delay_seconds: Option<i32>,
6359    /// Configure the feature that extends the liveness probe for a primary
6360    /// instance. In addition to the basic checks, this reports whether the
6361    /// primary is isolated from the Kubernetes API server and from its
6362    /// replicas, so the kubelet restarts it through the normal
6363    /// container-termination path (a smart shutdown, bounded by
6364    /// `.spec.smartShutdownTimeout`) when a network partition or API
6365    /// unavailability is detected. Enabled by default.
6366    #[serde(
6367        default,
6368        skip_serializing_if = "Option::is_none",
6369        rename = "isolationCheck"
6370    )]
6371    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6372    pub isolation_check: Option<ClusterProbesLivenessIsolationCheck>,
6373    /// How often (in seconds) to perform the probe.
6374    /// Default to 10 seconds. Minimum value is 1.
6375    #[serde(
6376        default,
6377        skip_serializing_if = "Option::is_none",
6378        rename = "periodSeconds"
6379    )]
6380    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6381    pub period_seconds: Option<i32>,
6382    /// Minimum consecutive successes for the probe to be considered successful after having failed.
6383    /// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
6384    #[serde(
6385        default,
6386        skip_serializing_if = "Option::is_none",
6387        rename = "successThreshold"
6388    )]
6389    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6390    pub success_threshold: Option<i32>,
6391    /// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
6392    /// The grace period is the duration in seconds after the processes running in the pod are sent
6393    /// a termination signal and the time when the processes are forcibly halted with a kill signal.
6394    /// Set this value longer than the expected cleanup time for your process.
6395    /// If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this
6396    /// value overrides the value provided by the pod spec.
6397    /// Value must be non-negative integer. The value zero indicates stop immediately via
6398    /// the kill signal (no opportunity to shut down).
6399    /// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
6400    /// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
6401    #[serde(
6402        default,
6403        skip_serializing_if = "Option::is_none",
6404        rename = "terminationGracePeriodSeconds"
6405    )]
6406    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6407    pub termination_grace_period_seconds: Option<i64>,
6408    /// Number of seconds after which the probe times out.
6409    /// Defaults to 1 second. Minimum value is 1.
6410    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6411    #[serde(
6412        default,
6413        skip_serializing_if = "Option::is_none",
6414        rename = "timeoutSeconds"
6415    )]
6416    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6417    pub timeout_seconds: Option<i32>,
6418}
6419
6420/// Configure the feature that extends the liveness probe for a primary
6421/// instance. In addition to the basic checks, this reports whether the
6422/// primary is isolated from the Kubernetes API server and from its
6423/// replicas, so the kubelet restarts it through the normal
6424/// container-termination path (a smart shutdown, bounded by
6425/// `.spec.smartShutdownTimeout`) when a network partition or API
6426/// unavailability is detected. Enabled by default.
6427#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6428#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6429#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6430pub struct ClusterProbesLivenessIsolationCheck {
6431    /// Timeout in milliseconds for connections during the primary isolation check
6432    #[serde(
6433        default,
6434        skip_serializing_if = "Option::is_none",
6435        rename = "connectionTimeout"
6436    )]
6437    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6438    pub connection_timeout: Option<i64>,
6439    /// Whether primary isolation checking is enabled for the liveness probe
6440    #[serde(default, skip_serializing_if = "Option::is_none")]
6441    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6442    pub enabled: Option<bool>,
6443    /// Timeout in milliseconds for requests during the primary isolation check
6444    #[serde(
6445        default,
6446        skip_serializing_if = "Option::is_none",
6447        rename = "requestTimeout"
6448    )]
6449    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6450    pub request_timeout: Option<i64>,
6451}
6452
6453/// The readiness probe configuration
6454#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6455#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6456#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6457pub struct ClusterProbesReadiness {
6458    /// Minimum consecutive failures for the probe to be considered failed after having succeeded.
6459    /// Defaults to 3. Minimum value is 1.
6460    #[serde(
6461        default,
6462        skip_serializing_if = "Option::is_none",
6463        rename = "failureThreshold"
6464    )]
6465    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6466    pub failure_threshold: Option<i32>,
6467    /// Number of seconds after the container has started before liveness probes are initiated.
6468    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6469    #[serde(
6470        default,
6471        skip_serializing_if = "Option::is_none",
6472        rename = "initialDelaySeconds"
6473    )]
6474    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6475    pub initial_delay_seconds: Option<i32>,
6476    /// Lag limit. Used only for `streaming` strategy
6477    #[serde(
6478        default,
6479        skip_serializing_if = "Option::is_none",
6480        rename = "maximumLag"
6481    )]
6482    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6483    pub maximum_lag: Option<IntOrString>,
6484    /// How often (in seconds) to perform the probe.
6485    /// Default to 10 seconds. Minimum value is 1.
6486    #[serde(
6487        default,
6488        skip_serializing_if = "Option::is_none",
6489        rename = "periodSeconds"
6490    )]
6491    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6492    pub period_seconds: Option<i32>,
6493    /// Minimum consecutive successes for the probe to be considered successful after having failed.
6494    /// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
6495    #[serde(
6496        default,
6497        skip_serializing_if = "Option::is_none",
6498        rename = "successThreshold"
6499    )]
6500    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6501    pub success_threshold: Option<i32>,
6502    /// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
6503    /// The grace period is the duration in seconds after the processes running in the pod are sent
6504    /// a termination signal and the time when the processes are forcibly halted with a kill signal.
6505    /// Set this value longer than the expected cleanup time for your process.
6506    /// If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this
6507    /// value overrides the value provided by the pod spec.
6508    /// Value must be non-negative integer. The value zero indicates stop immediately via
6509    /// the kill signal (no opportunity to shut down).
6510    /// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
6511    /// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
6512    #[serde(
6513        default,
6514        skip_serializing_if = "Option::is_none",
6515        rename = "terminationGracePeriodSeconds"
6516    )]
6517    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6518    pub termination_grace_period_seconds: Option<i64>,
6519    /// Number of seconds after which the probe times out.
6520    /// Defaults to 1 second. Minimum value is 1.
6521    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6522    #[serde(
6523        default,
6524        skip_serializing_if = "Option::is_none",
6525        rename = "timeoutSeconds"
6526    )]
6527    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6528    pub timeout_seconds: Option<i32>,
6529    /// The probe strategy
6530    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
6531    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6532    pub r#type: Option<ClusterProbesReadinessType>,
6533}
6534
6535/// The readiness probe configuration
6536#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6537#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6538pub enum ClusterProbesReadinessType {
6539    #[serde(rename = "pg_isready")]
6540    PgIsready,
6541    #[serde(rename = "streaming")]
6542    Streaming,
6543    #[serde(rename = "query")]
6544    Query,
6545}
6546
6547/// The startup probe configuration
6548#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6549#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6550#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6551pub struct ClusterProbesStartup {
6552    /// Minimum consecutive failures for the probe to be considered failed after having succeeded.
6553    /// Defaults to 3. Minimum value is 1.
6554    #[serde(
6555        default,
6556        skip_serializing_if = "Option::is_none",
6557        rename = "failureThreshold"
6558    )]
6559    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6560    pub failure_threshold: Option<i32>,
6561    /// Number of seconds after the container has started before liveness probes are initiated.
6562    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6563    #[serde(
6564        default,
6565        skip_serializing_if = "Option::is_none",
6566        rename = "initialDelaySeconds"
6567    )]
6568    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6569    pub initial_delay_seconds: Option<i32>,
6570    /// Lag limit. Used only for `streaming` strategy
6571    #[serde(
6572        default,
6573        skip_serializing_if = "Option::is_none",
6574        rename = "maximumLag"
6575    )]
6576    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6577    pub maximum_lag: Option<IntOrString>,
6578    /// How often (in seconds) to perform the probe.
6579    /// Default to 10 seconds. Minimum value is 1.
6580    #[serde(
6581        default,
6582        skip_serializing_if = "Option::is_none",
6583        rename = "periodSeconds"
6584    )]
6585    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6586    pub period_seconds: Option<i32>,
6587    /// Minimum consecutive successes for the probe to be considered successful after having failed.
6588    /// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
6589    #[serde(
6590        default,
6591        skip_serializing_if = "Option::is_none",
6592        rename = "successThreshold"
6593    )]
6594    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6595    pub success_threshold: Option<i32>,
6596    /// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
6597    /// The grace period is the duration in seconds after the processes running in the pod are sent
6598    /// a termination signal and the time when the processes are forcibly halted with a kill signal.
6599    /// Set this value longer than the expected cleanup time for your process.
6600    /// If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this
6601    /// value overrides the value provided by the pod spec.
6602    /// Value must be non-negative integer. The value zero indicates stop immediately via
6603    /// the kill signal (no opportunity to shut down).
6604    /// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
6605    /// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
6606    #[serde(
6607        default,
6608        skip_serializing_if = "Option::is_none",
6609        rename = "terminationGracePeriodSeconds"
6610    )]
6611    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6612    pub termination_grace_period_seconds: Option<i64>,
6613    /// Number of seconds after which the probe times out.
6614    /// Defaults to 1 second. Minimum value is 1.
6615    /// More info: <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes>
6616    #[serde(
6617        default,
6618        skip_serializing_if = "Option::is_none",
6619        rename = "timeoutSeconds"
6620    )]
6621    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6622    pub timeout_seconds: Option<i32>,
6623    /// The probe strategy
6624    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
6625    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6626    pub r#type: Option<ClusterProbesStartupType>,
6627}
6628
6629/// The startup probe configuration
6630#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
6631#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6632pub enum ClusterProbesStartupType {
6633    #[serde(rename = "pg_isready")]
6634    PgIsready,
6635    #[serde(rename = "streaming")]
6636    Streaming,
6637    #[serde(rename = "query")]
6638    Query,
6639}
6640
6641/// Template to be used to define projected volumes, projected volumes will be mounted
6642/// under `/projected` base folder
6643#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6644#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6645#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6646pub struct ClusterProjectedVolumeTemplate {
6647    /// defaultMode are the mode bits used to set permissions on created files by default.
6648    /// Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511.
6649    /// YAML accepts both octal and decimal values, JSON requires decimal values for mode bits.
6650    /// Directories within the path are not affected by this setting.
6651    /// This might be in conflict with other options that affect the file
6652    /// mode, like fsGroup, and the result can be other mode bits set.
6653    #[serde(
6654        default,
6655        skip_serializing_if = "Option::is_none",
6656        rename = "defaultMode"
6657    )]
6658    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6659    pub default_mode: Option<i32>,
6660    /// defaultUser is Optional: The owner UID of the created files by default.
6661    /// The defaultUser field is only used as a fallback when the item-level user field is unset.
6662    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
6663    #[serde(
6664        default,
6665        skip_serializing_if = "Option::is_none",
6666        rename = "defaultUser"
6667    )]
6668    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6669    pub default_user: Option<i64>,
6670    /// sources is the list of volume projections. Each entry in this list
6671    /// handles one source.
6672    #[serde(default, skip_serializing_if = "Option::is_none")]
6673    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6674    pub sources: Option<Vec<ClusterProjectedVolumeTemplateSources>>,
6675}
6676
6677/// Projection that may be projected along with other supported volume types.
6678/// Exactly one of these fields must be set.
6679#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6680#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6681#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6682pub struct ClusterProjectedVolumeTemplateSources {
6683    /// ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field
6684    /// of ClusterTrustBundle objects in an auto-updating file.
6685    ///
6686    /// Alpha, gated by the ClusterTrustBundleProjection feature gate.
6687    ///
6688    /// ClusterTrustBundle objects can either be selected by name, or by the
6689    /// combination of signer name and a label selector.
6690    ///
6691    /// Kubelet performs aggressive normalization of the PEM contents written
6692    /// into the pod filesystem.  Esoteric PEM features such as inter-block
6693    /// comments and block headers are stripped.  Certificates are deduplicated.
6694    /// The ordering of certificates within the file is arbitrary, and Kubelet
6695    /// may change the order over time.
6696    #[serde(
6697        default,
6698        skip_serializing_if = "Option::is_none",
6699        rename = "clusterTrustBundle"
6700    )]
6701    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6702    pub cluster_trust_bundle: Option<ClusterProjectedVolumeTemplateSourcesClusterTrustBundle>,
6703    /// configMap information about the configMap data to project
6704    #[serde(default, skip_serializing_if = "Option::is_none", rename = "configMap")]
6705    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6706    pub config_map: Option<ClusterProjectedVolumeTemplateSourcesConfigMap>,
6707    /// downwardAPI information about the downwardAPI data to project
6708    #[serde(
6709        default,
6710        skip_serializing_if = "Option::is_none",
6711        rename = "downwardAPI"
6712    )]
6713    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6714    pub downward_api: Option<ClusterProjectedVolumeTemplateSourcesDownwardApi>,
6715    /// Projects an auto-rotating credential bundle (private key and certificate
6716    /// chain) that the pod can use either as a TLS client or server.
6717    ///
6718    /// Kubelet generates a private key and uses it to send a
6719    /// PodCertificateRequest to the named signer.  Once the signer approves the
6720    /// request and issues a certificate chain, Kubelet writes the key and
6721    /// certificate chain to the pod filesystem.  The pod does not start until
6722    /// certificates have been issued for each podCertificate projected volume
6723    /// source in its spec.
6724    ///
6725    /// Kubelet will begin trying to rotate the certificate at the time indicated
6726    /// by the signer using the PodCertificateRequest.Status.BeginRefreshAt
6727    /// timestamp.
6728    ///
6729    /// Kubelet can write a single file, indicated by the credentialBundlePath
6730    /// field, or separate files, indicated by the keyPath and
6731    /// certificateChainPath fields.
6732    ///
6733    /// The credential bundle is a single file in PEM format.  The first PEM
6734    /// entry is the private key (in PKCS#8 format), and the remaining PEM
6735    /// entries are the certificate chain issued by the signer (typically,
6736    /// signers will return their certificate chain in leaf-to-root order).
6737    ///
6738    /// Prefer using the credential bundle format, since your application code
6739    /// can read it atomically.  If you use keyPath and certificateChainPath,
6740    /// your application must make two separate file reads. If these coincide
6741    /// with a certificate rotation, it is possible that the private key and leaf
6742    /// certificate you read may not correspond to each other.  Your application
6743    /// will need to check for this condition, and re-read until they are
6744    /// consistent.
6745    ///
6746    /// The named signer controls chooses the format of the certificate it
6747    /// issues; consult the signer implementation's documentation to learn how to
6748    /// use the certificates it issues.
6749    #[serde(
6750        default,
6751        skip_serializing_if = "Option::is_none",
6752        rename = "podCertificate"
6753    )]
6754    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6755    pub pod_certificate: Option<ClusterProjectedVolumeTemplateSourcesPodCertificate>,
6756    /// secret information about the secret data to project
6757    #[serde(default, skip_serializing_if = "Option::is_none")]
6758    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6759    pub secret: Option<ClusterProjectedVolumeTemplateSourcesSecret>,
6760    /// serviceAccountToken is information about the serviceAccountToken data to project
6761    #[serde(
6762        default,
6763        skip_serializing_if = "Option::is_none",
6764        rename = "serviceAccountToken"
6765    )]
6766    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6767    pub service_account_token: Option<ClusterProjectedVolumeTemplateSourcesServiceAccountToken>,
6768}
6769
6770/// ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field
6771/// of ClusterTrustBundle objects in an auto-updating file.
6772///
6773/// Alpha, gated by the ClusterTrustBundleProjection feature gate.
6774///
6775/// ClusterTrustBundle objects can either be selected by name, or by the
6776/// combination of signer name and a label selector.
6777///
6778/// Kubelet performs aggressive normalization of the PEM contents written
6779/// into the pod filesystem.  Esoteric PEM features such as inter-block
6780/// comments and block headers are stripped.  Certificates are deduplicated.
6781/// The ordering of certificates within the file is arbitrary, and Kubelet
6782/// may change the order over time.
6783#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6784#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6785#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6786pub struct ClusterProjectedVolumeTemplateSourcesClusterTrustBundle {
6787    /// Select all ClusterTrustBundles that match this label selector.  Only has
6788    /// effect if signerName is set.  Mutually-exclusive with name.  If unset,
6789    /// interpreted as "match nothing".  If set but empty, interpreted as "match
6790    /// everything".
6791    #[serde(
6792        default,
6793        skip_serializing_if = "Option::is_none",
6794        rename = "labelSelector"
6795    )]
6796    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6797    pub label_selector:
6798        Option<ClusterProjectedVolumeTemplateSourcesClusterTrustBundleLabelSelector>,
6799    /// Select a single ClusterTrustBundle by object name.  Mutually-exclusive
6800    /// with signerName and labelSelector.
6801    #[serde(default, skip_serializing_if = "Option::is_none")]
6802    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6803    pub name: Option<String>,
6804    /// If true, don't block pod startup if the referenced ClusterTrustBundle(s)
6805    /// aren't available.  If using name, then the named ClusterTrustBundle is
6806    /// allowed not to exist.  If using signerName, then the combination of
6807    /// signerName and labelSelector is allowed to match zero
6808    /// ClusterTrustBundles.
6809    #[serde(default, skip_serializing_if = "Option::is_none")]
6810    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6811    pub optional: Option<bool>,
6812    /// Relative path from the volume root to write the bundle.
6813    pub path: String,
6814    /// Select all ClusterTrustBundles that match this signer name.
6815    /// Mutually-exclusive with name.  The contents of all selected
6816    /// ClusterTrustBundles will be unified and deduplicated.
6817    #[serde(
6818        default,
6819        skip_serializing_if = "Option::is_none",
6820        rename = "signerName"
6821    )]
6822    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6823    pub signer_name: Option<String>,
6824    /// user is Optional: The owner UID of the created file.
6825    /// If specified, the item-level user field takes precedence over defaultUser.
6826    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
6827    #[serde(default, skip_serializing_if = "Option::is_none")]
6828    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6829    pub user: Option<i64>,
6830}
6831
6832/// Select all ClusterTrustBundles that match this label selector.  Only has
6833/// effect if signerName is set.  Mutually-exclusive with name.  If unset,
6834/// interpreted as "match nothing".  If set but empty, interpreted as "match
6835/// everything".
6836#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6837#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6838#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6839pub struct ClusterProjectedVolumeTemplateSourcesClusterTrustBundleLabelSelector {
6840    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
6841    #[serde(
6842        default,
6843        skip_serializing_if = "Option::is_none",
6844        rename = "matchExpressions"
6845    )]
6846    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6847    pub match_expressions: Option<
6848        Vec<ClusterProjectedVolumeTemplateSourcesClusterTrustBundleLabelSelectorMatchExpressions>,
6849    >,
6850    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
6851    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
6852    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
6853    #[serde(
6854        default,
6855        skip_serializing_if = "Option::is_none",
6856        rename = "matchLabels"
6857    )]
6858    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6859    pub match_labels: Option<BTreeMap<String, String>>,
6860}
6861
6862/// A label selector requirement is a selector that contains values, a key, and an operator that
6863/// relates the key and values.
6864#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6865#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6866#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6867pub struct ClusterProjectedVolumeTemplateSourcesClusterTrustBundleLabelSelectorMatchExpressions {
6868    /// key is the label key that the selector applies to.
6869    pub key: String,
6870    /// operator represents a key's relationship to a set of values.
6871    /// Valid operators are In, NotIn, Exists and DoesNotExist.
6872    pub operator: String,
6873    /// values is an array of string values. If the operator is In or NotIn,
6874    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
6875    /// the values array must be empty. This array is replaced during a strategic
6876    /// merge patch.
6877    #[serde(default, skip_serializing_if = "Option::is_none")]
6878    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6879    pub values: Option<Vec<String>>,
6880}
6881
6882/// configMap information about the configMap data to project
6883#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6884#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6885#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6886pub struct ClusterProjectedVolumeTemplateSourcesConfigMap {
6887    /// items if unspecified, each key-value pair in the Data field of the referenced
6888    /// ConfigMap will be projected into the volume as a file whose name is the
6889    /// key and content is the value. If specified, the listed keys will be
6890    /// projected into the specified paths, and unlisted keys will not be
6891    /// present. If a key is specified which is not present in the ConfigMap,
6892    /// the volume setup will error unless it is marked optional. Paths must be
6893    /// relative and may not contain the '..' path or start with '..'.
6894    #[serde(default, skip_serializing_if = "Option::is_none")]
6895    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6896    pub items: Option<Vec<ClusterProjectedVolumeTemplateSourcesConfigMapItems>>,
6897    /// Name of the referent.
6898    /// This field is effectively required, but due to backwards compatibility is
6899    /// allowed to be empty. Instances of this type with an empty value here are
6900    /// almost certainly wrong.
6901    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
6902    #[serde(default, skip_serializing_if = "Option::is_none")]
6903    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6904    pub name: Option<String>,
6905    /// optional specify whether the ConfigMap or its keys must be defined
6906    #[serde(default, skip_serializing_if = "Option::is_none")]
6907    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6908    pub optional: Option<bool>,
6909}
6910
6911/// Maps a string key to a path within a volume.
6912#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6913#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6914#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6915pub struct ClusterProjectedVolumeTemplateSourcesConfigMapItems {
6916    /// key is the key to project.
6917    pub key: String,
6918    /// mode is Optional: mode bits used to set permissions on this file.
6919    /// Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511.
6920    /// YAML accepts both octal and decimal values, JSON requires decimal values for mode bits.
6921    /// If not specified, the volume defaultMode will be used.
6922    /// This might be in conflict with other options that affect the file
6923    /// mode, like fsGroup, and the result can be other mode bits set.
6924    #[serde(default, skip_serializing_if = "Option::is_none")]
6925    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6926    pub mode: Option<i32>,
6927    /// path is the relative path of the file to map the key to.
6928    /// May not be an absolute path.
6929    /// May not contain the path element '..'.
6930    /// May not start with the string '..'.
6931    pub path: String,
6932    /// user is Optional: The owner UID of the created file.
6933    /// If specified, the item-level user field takes precedence over defaultUser.
6934    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
6935    #[serde(default, skip_serializing_if = "Option::is_none")]
6936    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6937    pub user: Option<i64>,
6938}
6939
6940/// downwardAPI information about the downwardAPI data to project
6941#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6942#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6943#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6944pub struct ClusterProjectedVolumeTemplateSourcesDownwardApi {
6945    /// Items is a list of DownwardAPIVolume file
6946    #[serde(default, skip_serializing_if = "Option::is_none")]
6947    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6948    pub items: Option<Vec<ClusterProjectedVolumeTemplateSourcesDownwardApiItems>>,
6949}
6950
6951/// DownwardAPIVolumeFile represents information to create the file containing the pod field
6952#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6953#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6954#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6955pub struct ClusterProjectedVolumeTemplateSourcesDownwardApiItems {
6956    /// Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported.
6957    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldRef")]
6958    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6959    pub field_ref: Option<ClusterProjectedVolumeTemplateSourcesDownwardApiItemsFieldRef>,
6960    /// Optional: mode bits used to set permissions on this file, must be an octal value
6961    /// between 0000 and 0777 or a decimal value between 0 and 511.
6962    /// YAML accepts both octal and decimal values, JSON requires decimal values for mode bits.
6963    /// If not specified, the volume defaultMode will be used.
6964    /// This might be in conflict with other options that affect the file
6965    /// mode, like fsGroup, and the result can be other mode bits set.
6966    #[serde(default, skip_serializing_if = "Option::is_none")]
6967    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6968    pub mode: Option<i32>,
6969    /// Required: Path is  the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'
6970    pub path: String,
6971    /// Selects a resource of the container: only resources limits and requests
6972    /// (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.
6973    #[serde(
6974        default,
6975        skip_serializing_if = "Option::is_none",
6976        rename = "resourceFieldRef"
6977    )]
6978    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6979    pub resource_field_ref:
6980        Option<ClusterProjectedVolumeTemplateSourcesDownwardApiItemsResourceFieldRef>,
6981    /// user is Optional: The owner UID of the created file.
6982    /// If specified, the item-level user field takes precedence over defaultUser.
6983    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
6984    #[serde(default, skip_serializing_if = "Option::is_none")]
6985    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
6986    pub user: Option<i64>,
6987}
6988
6989/// Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported.
6990#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
6991#[cfg_attr(feature = "builder", derive(TypedBuilder))]
6992#[cfg_attr(feature = "schemars", derive(JsonSchema))]
6993pub struct ClusterProjectedVolumeTemplateSourcesDownwardApiItemsFieldRef {
6994    /// Version of the schema the FieldPath is written in terms of, defaults to "v1".
6995    #[serde(
6996        default,
6997        skip_serializing_if = "Option::is_none",
6998        rename = "apiVersion"
6999    )]
7000    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7001    pub api_version: Option<String>,
7002    /// Path of the field to select in the specified API version.
7003    #[serde(rename = "fieldPath")]
7004    pub field_path: String,
7005}
7006
7007/// Selects a resource of the container: only resources limits and requests
7008/// (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.
7009#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7010#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7011#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7012pub struct ClusterProjectedVolumeTemplateSourcesDownwardApiItemsResourceFieldRef {
7013    /// Container name: required for volumes, optional for env vars
7014    #[serde(
7015        default,
7016        skip_serializing_if = "Option::is_none",
7017        rename = "containerName"
7018    )]
7019    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7020    pub container_name: Option<String>,
7021    /// Specifies the output format of the exposed resources, defaults to "1"
7022    #[serde(default, skip_serializing_if = "Option::is_none")]
7023    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7024    pub divisor: Option<IntOrString>,
7025    /// Required: resource to select
7026    pub resource: String,
7027}
7028
7029/// Projects an auto-rotating credential bundle (private key and certificate
7030/// chain) that the pod can use either as a TLS client or server.
7031///
7032/// Kubelet generates a private key and uses it to send a
7033/// PodCertificateRequest to the named signer.  Once the signer approves the
7034/// request and issues a certificate chain, Kubelet writes the key and
7035/// certificate chain to the pod filesystem.  The pod does not start until
7036/// certificates have been issued for each podCertificate projected volume
7037/// source in its spec.
7038///
7039/// Kubelet will begin trying to rotate the certificate at the time indicated
7040/// by the signer using the PodCertificateRequest.Status.BeginRefreshAt
7041/// timestamp.
7042///
7043/// Kubelet can write a single file, indicated by the credentialBundlePath
7044/// field, or separate files, indicated by the keyPath and
7045/// certificateChainPath fields.
7046///
7047/// The credential bundle is a single file in PEM format.  The first PEM
7048/// entry is the private key (in PKCS#8 format), and the remaining PEM
7049/// entries are the certificate chain issued by the signer (typically,
7050/// signers will return their certificate chain in leaf-to-root order).
7051///
7052/// Prefer using the credential bundle format, since your application code
7053/// can read it atomically.  If you use keyPath and certificateChainPath,
7054/// your application must make two separate file reads. If these coincide
7055/// with a certificate rotation, it is possible that the private key and leaf
7056/// certificate you read may not correspond to each other.  Your application
7057/// will need to check for this condition, and re-read until they are
7058/// consistent.
7059///
7060/// The named signer controls chooses the format of the certificate it
7061/// issues; consult the signer implementation's documentation to learn how to
7062/// use the certificates it issues.
7063#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7064#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7065#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7066pub struct ClusterProjectedVolumeTemplateSourcesPodCertificate {
7067    /// Write the certificate chain at this path in the projected volume.
7068    ///
7069    /// Most applications should use credentialBundlePath.  When using keyPath
7070    /// and certificateChainPath, your application needs to check that the key
7071    /// and leaf certificate are consistent, because it is possible to read the
7072    /// files mid-rotation.
7073    #[serde(
7074        default,
7075        skip_serializing_if = "Option::is_none",
7076        rename = "certificateChainPath"
7077    )]
7078    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7079    pub certificate_chain_path: Option<String>,
7080    /// Write the credential bundle at this path in the projected volume.
7081    ///
7082    /// The credential bundle is a single file that contains multiple PEM blocks.
7083    /// The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private
7084    /// key.
7085    ///
7086    /// The remaining blocks are CERTIFICATE blocks, containing the issued
7087    /// certificate chain from the signer (leaf and any intermediates).
7088    ///
7089    /// Using credentialBundlePath lets your Pod's application code make a single
7090    /// atomic read that retrieves a consistent key and certificate chain.  If you
7091    /// project them to separate files, your application code will need to
7092    /// additionally check that the leaf certificate was issued to the key.
7093    #[serde(
7094        default,
7095        skip_serializing_if = "Option::is_none",
7096        rename = "credentialBundlePath"
7097    )]
7098    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7099    pub credential_bundle_path: Option<String>,
7100    /// Write the key at this path in the projected volume.
7101    ///
7102    /// Most applications should use credentialBundlePath.  When using keyPath
7103    /// and certificateChainPath, your application needs to check that the key
7104    /// and leaf certificate are consistent, because it is possible to read the
7105    /// files mid-rotation.
7106    #[serde(default, skip_serializing_if = "Option::is_none", rename = "keyPath")]
7107    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7108    pub key_path: Option<String>,
7109    /// The type of keypair Kubelet will generate for the pod.
7110    ///
7111    /// Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384",
7112    /// "ECDSAP521", and "ED25519".
7113    #[serde(rename = "keyType")]
7114    pub key_type: String,
7115    /// maxExpirationSeconds is the maximum lifetime permitted for the
7116    /// certificate.
7117    ///
7118    /// Kubelet copies this value verbatim into the PodCertificateRequests it
7119    /// generates for this projection.
7120    ///
7121    /// If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver
7122    /// will reject values shorter than 3600 (1 hour).  The maximum allowable
7123    /// value is 7862400 (91 days).
7124    ///
7125    /// The signer implementation is then free to issue a certificate with any
7126    /// lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600
7127    /// seconds (1 hour).  This constraint is enforced by kube-apiserver.
7128    /// `kubernetes.io` signers will never issue certificates with a lifetime
7129    /// longer than 24 hours.
7130    #[serde(
7131        default,
7132        skip_serializing_if = "Option::is_none",
7133        rename = "maxExpirationSeconds"
7134    )]
7135    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7136    pub max_expiration_seconds: Option<i32>,
7137    /// Kubelet's generated CSRs will be addressed to this signer.
7138    #[serde(rename = "signerName")]
7139    pub signer_name: String,
7140    /// user is Optional: The owner UID of the created file.
7141    /// If specified, the item-level user field takes precedence over defaultUser.
7142    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
7143    #[serde(default, skip_serializing_if = "Option::is_none")]
7144    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7145    pub user: Option<i64>,
7146    /// userAnnotations allow pod authors to pass additional information to
7147    /// the signer implementation.  Kubernetes does not restrict or validate this
7148    /// metadata in any way.
7149    ///
7150    /// These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of
7151    /// the PodCertificateRequest objects that Kubelet creates.
7152    ///
7153    /// Entries are subject to the same validation as object metadata annotations,
7154    /// with the addition that all keys must be domain-prefixed. No restrictions
7155    /// are placed on values, except an overall size limitation on the entire field.
7156    ///
7157    /// Signers should document the keys and values they support. Signers should
7158    /// deny requests that contain keys they do not recognize.
7159    #[serde(
7160        default,
7161        skip_serializing_if = "Option::is_none",
7162        rename = "userAnnotations"
7163    )]
7164    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7165    pub user_annotations: Option<BTreeMap<String, String>>,
7166}
7167
7168/// secret information about the secret data to project
7169#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7170#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7171#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7172pub struct ClusterProjectedVolumeTemplateSourcesSecret {
7173    /// items if unspecified, each key-value pair in the Data field of the referenced
7174    /// Secret will be projected into the volume as a file whose name is the
7175    /// key and content is the value. If specified, the listed keys will be
7176    /// projected into the specified paths, and unlisted keys will not be
7177    /// present. If a key is specified which is not present in the Secret,
7178    /// the volume setup will error unless it is marked optional. Paths must be
7179    /// relative and may not contain the '..' path or start with '..'.
7180    #[serde(default, skip_serializing_if = "Option::is_none")]
7181    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7182    pub items: Option<Vec<ClusterProjectedVolumeTemplateSourcesSecretItems>>,
7183    /// Name of the referent.
7184    /// This field is effectively required, but due to backwards compatibility is
7185    /// allowed to be empty. Instances of this type with an empty value here are
7186    /// almost certainly wrong.
7187    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names>
7188    #[serde(default, skip_serializing_if = "Option::is_none")]
7189    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7190    pub name: Option<String>,
7191    /// optional field specify whether the Secret or its key must be defined
7192    #[serde(default, skip_serializing_if = "Option::is_none")]
7193    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7194    pub optional: Option<bool>,
7195}
7196
7197/// Maps a string key to a path within a volume.
7198#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7199#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7200#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7201pub struct ClusterProjectedVolumeTemplateSourcesSecretItems {
7202    /// key is the key to project.
7203    pub key: String,
7204    /// mode is Optional: mode bits used to set permissions on this file.
7205    /// Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511.
7206    /// YAML accepts both octal and decimal values, JSON requires decimal values for mode bits.
7207    /// If not specified, the volume defaultMode will be used.
7208    /// This might be in conflict with other options that affect the file
7209    /// mode, like fsGroup, and the result can be other mode bits set.
7210    #[serde(default, skip_serializing_if = "Option::is_none")]
7211    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7212    pub mode: Option<i32>,
7213    /// path is the relative path of the file to map the key to.
7214    /// May not be an absolute path.
7215    /// May not contain the path element '..'.
7216    /// May not start with the string '..'.
7217    pub path: String,
7218    /// user is Optional: The owner UID of the created file.
7219    /// If specified, the item-level user field takes precedence over defaultUser.
7220    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
7221    #[serde(default, skip_serializing_if = "Option::is_none")]
7222    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7223    pub user: Option<i64>,
7224}
7225
7226/// serviceAccountToken is information about the serviceAccountToken data to project
7227#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7228#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7229#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7230pub struct ClusterProjectedVolumeTemplateSourcesServiceAccountToken {
7231    /// audience is the intended audience of the token. A recipient of a token
7232    /// must identify itself with an identifier specified in the audience of the
7233    /// token, and otherwise should reject the token. The audience defaults to the
7234    /// identifier of the apiserver.
7235    #[serde(default, skip_serializing_if = "Option::is_none")]
7236    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7237    pub audience: Option<String>,
7238    /// expirationSeconds is the requested duration of validity of the service
7239    /// account token. As the token approaches expiration, the kubelet volume
7240    /// plugin will proactively rotate the service account token. The kubelet will
7241    /// start trying to rotate the token if the token is older than 80 percent of
7242    /// its time to live or if the token is older than 24 hours.Defaults to 1 hour
7243    /// and must be at least 10 minutes.
7244    #[serde(
7245        default,
7246        skip_serializing_if = "Option::is_none",
7247        rename = "expirationSeconds"
7248    )]
7249    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7250    pub expiration_seconds: Option<i64>,
7251    /// path is the path relative to the mount point of the file to project the
7252    /// token into.
7253    pub path: String,
7254    /// user is Optional: The owner UID of the created file.
7255    /// If specified, the item-level user field takes precedence over defaultUser.
7256    /// (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled.
7257    #[serde(default, skip_serializing_if = "Option::is_none")]
7258    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7259    pub user: Option<i64>,
7260}
7261
7262/// Replica cluster configuration
7263#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7264#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7265#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7266pub struct ClusterReplica {
7267    /// If replica mode is enabled, this cluster will be a replica of an
7268    /// existing cluster. Replica cluster can be created from a recovery
7269    /// object store or via streaming through pg_basebackup.
7270    /// Refer to the Replica clusters page of the documentation for more information.
7271    #[serde(default, skip_serializing_if = "Option::is_none")]
7272    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7273    pub enabled: Option<bool>,
7274    /// When replica mode is enabled, this parameter allows you to replay
7275    /// transactions only when the system time is at least the configured
7276    /// time past the commit time. This provides an opportunity to correct
7277    /// data loss errors. Note that when this parameter is set, a promotion
7278    /// token cannot be used.
7279    #[serde(
7280        default,
7281        skip_serializing_if = "Option::is_none",
7282        rename = "minApplyDelay"
7283    )]
7284    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7285    pub min_apply_delay: Option<String>,
7286    /// Primary defines which Cluster is defined to be the primary in the distributed PostgreSQL cluster, based on the
7287    /// topology specified in externalClusters
7288    #[serde(default, skip_serializing_if = "Option::is_none")]
7289    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7290    pub primary: Option<String>,
7291    /// A demotion token generated by an external cluster used to
7292    /// check if the promotion requirements are met.
7293    #[serde(
7294        default,
7295        skip_serializing_if = "Option::is_none",
7296        rename = "promotionToken"
7297    )]
7298    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7299    pub promotion_token: Option<String>,
7300    /// Self defines the name of this cluster. It is used to determine if this is a primary
7301    /// or a replica cluster, comparing it with `primary`
7302    #[serde(default, skip_serializing_if = "Option::is_none", rename = "self")]
7303    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7304    pub r#_self: Option<String>,
7305    /// The name of the external cluster which is the replication origin
7306    pub source: String,
7307}
7308
7309/// Replication slots management configuration
7310#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7311#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7312#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7313pub struct ClusterReplicationSlots {
7314    /// Replication slots for high availability configuration
7315    #[serde(
7316        default,
7317        skip_serializing_if = "Option::is_none",
7318        rename = "highAvailability"
7319    )]
7320    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7321    pub high_availability: Option<ClusterReplicationSlotsHighAvailability>,
7322    /// Configures the synchronization of the user defined physical replication slots
7323    #[serde(
7324        default,
7325        skip_serializing_if = "Option::is_none",
7326        rename = "synchronizeReplicas"
7327    )]
7328    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7329    pub synchronize_replicas: Option<ClusterReplicationSlotsSynchronizeReplicas>,
7330    /// Standby will update the status of the local replication slots
7331    /// every `updateInterval` seconds (default 30).
7332    #[serde(
7333        default,
7334        skip_serializing_if = "Option::is_none",
7335        rename = "updateInterval"
7336    )]
7337    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7338    pub update_interval: Option<i64>,
7339}
7340
7341/// Replication slots for high availability configuration
7342#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7343#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7344#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7345pub struct ClusterReplicationSlotsHighAvailability {
7346    /// If enabled (default), the operator will automatically manage replication slots
7347    /// on the primary instance and use them in streaming replication
7348    /// connections with all the standby instances that are part of the HA
7349    /// cluster. If disabled, the operator will not take advantage
7350    /// of replication slots in streaming connections with the replicas.
7351    /// This feature also controls replication slots in replica cluster,
7352    /// from the designated primary to its cascading replicas.
7353    #[serde(default, skip_serializing_if = "Option::is_none")]
7354    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7355    pub enabled: Option<bool>,
7356    /// Prefix for replication slots managed by the operator for HA.
7357    /// It may only contain lower case letters, numbers, and the underscore character.
7358    /// This can only be set at creation time. By default set to `_cnpg_`.
7359    #[serde(
7360        default,
7361        skip_serializing_if = "Option::is_none",
7362        rename = "slotPrefix"
7363    )]
7364    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7365    pub slot_prefix: Option<String>,
7366    /// When enabled, the operator automatically manages synchronization of logical
7367    /// decoding (replication) slots across high-availability clusters.
7368    ///
7369    /// Requires one of the following conditions:
7370    /// - PostgreSQL version 17 or later
7371    /// - PostgreSQL version < 17 with pg_failover_slots extension enabled
7372    #[serde(
7373        default,
7374        skip_serializing_if = "Option::is_none",
7375        rename = "synchronizeLogicalDecoding"
7376    )]
7377    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7378    pub synchronize_logical_decoding: Option<bool>,
7379}
7380
7381/// Configures the synchronization of the user defined physical replication slots
7382#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7383#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7384#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7385pub struct ClusterReplicationSlotsSynchronizeReplicas {
7386    /// When set to true, every replication slot that is on the primary is synchronized on each standby
7387    pub enabled: bool,
7388    /// List of regular expression patterns to match the names of replication slots to be excluded (by default empty)
7389    #[serde(
7390        default,
7391        skip_serializing_if = "Option::is_none",
7392        rename = "excludePatterns"
7393    )]
7394    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7395    pub exclude_patterns: Option<Vec<String>>,
7396}
7397
7398/// Resources requirements of every generated Pod. Please refer to
7399/// <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
7400/// for more information.
7401#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7402#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7403#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7404pub struct ClusterResources {
7405    /// Claims lists the names of resources, defined in spec.resourceClaims,
7406    /// that are used by this container.
7407    ///
7408    /// This field depends on the
7409    /// DynamicResourceAllocation feature gate.
7410    ///
7411    /// This field is immutable. It can only be set for containers.
7412    #[serde(default, skip_serializing_if = "Option::is_none")]
7413    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7414    pub claims: Option<Vec<ClusterResourcesClaims>>,
7415    /// Limits describes the maximum amount of compute resources allowed.
7416    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
7417    #[serde(default, skip_serializing_if = "Option::is_none")]
7418    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7419    pub limits: Option<BTreeMap<String, IntOrString>>,
7420    /// Requests describes the minimum amount of compute resources required.
7421    /// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
7422    /// otherwise to an implementation-defined value. Requests cannot exceed Limits.
7423    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
7424    #[serde(default, skip_serializing_if = "Option::is_none")]
7425    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7426    pub requests: Option<BTreeMap<String, IntOrString>>,
7427}
7428
7429/// ResourceClaim references one entry in PodSpec.ResourceClaims.
7430#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7431#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7432#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7433pub struct ClusterResourcesClaims {
7434    /// Name must match the name of one entry in pod.spec.resourceClaims of
7435    /// the Pod where this field is used. It makes that resource available
7436    /// inside a container.
7437    pub name: String,
7438    /// Request is the name chosen for a request in the referenced claim.
7439    /// If empty, everything from the claim is made available, otherwise
7440    /// only the result of this request.
7441    #[serde(default, skip_serializing_if = "Option::is_none")]
7442    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7443    pub request: Option<String>,
7444}
7445
7446/// The SeccompProfile applied to every Pod and Container.
7447/// Defaults to: `RuntimeDefault`
7448#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7449#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7450#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7451pub struct ClusterSeccompProfile {
7452    /// localhostProfile indicates a profile defined in a file on the node should be used.
7453    /// The profile must be preconfigured on the node to work.
7454    /// Must be a descending path, relative to the kubelet's configured seccomp profile location.
7455    /// Must be set if type is "Localhost". Must NOT be set for any other type.
7456    #[serde(
7457        default,
7458        skip_serializing_if = "Option::is_none",
7459        rename = "localhostProfile"
7460    )]
7461    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7462    pub localhost_profile: Option<String>,
7463    /// type indicates which kind of seccomp profile will be applied.
7464    /// Valid options are:
7465    ///
7466    /// Localhost - a profile defined in a file on the node should be used.
7467    /// RuntimeDefault - the container runtime default profile should be used.
7468    /// Unconfined - no profile should be applied.
7469    #[serde(rename = "type")]
7470    pub r#type: String,
7471}
7472
7473/// Override the SecurityContext applied to every Container in the Pod of the cluster.
7474/// When set, this overrides the operator's default Container SecurityContext.
7475/// If omitted, the operator defaults are used.
7476#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7477#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7478#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7479pub struct ClusterSecurityContext {
7480    /// AllowPrivilegeEscalation controls whether a process can gain more
7481    /// privileges than its parent process. This bool directly controls if
7482    /// the no_new_privs flag will be set on the container process.
7483    /// AllowPrivilegeEscalation is true always when the container is:
7484    /// 1) run as Privileged
7485    /// 2) has CAP_SYS_ADMIN
7486    /// Note that this field cannot be set when spec.os.name is windows.
7487    #[serde(
7488        default,
7489        skip_serializing_if = "Option::is_none",
7490        rename = "allowPrivilegeEscalation"
7491    )]
7492    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7493    pub allow_privilege_escalation: Option<bool>,
7494    /// appArmorProfile is the AppArmor options to use by this container. If set, this profile
7495    /// overrides the pod's appArmorProfile.
7496    /// Note that this field cannot be set when spec.os.name is windows.
7497    #[serde(
7498        default,
7499        skip_serializing_if = "Option::is_none",
7500        rename = "appArmorProfile"
7501    )]
7502    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7503    pub app_armor_profile: Option<ClusterSecurityContextAppArmorProfile>,
7504    /// The capabilities to add/drop when running containers.
7505    /// Defaults to the default set of capabilities granted by the container runtime.
7506    /// Note that this field cannot be set when spec.os.name is windows.
7507    #[serde(default, skip_serializing_if = "Option::is_none")]
7508    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7509    pub capabilities: Option<ClusterSecurityContextCapabilities>,
7510    /// Run container in privileged mode.
7511    /// Processes in privileged containers are essentially equivalent to root on the host.
7512    /// Defaults to false.
7513    /// Note that this field cannot be set when spec.os.name is windows.
7514    #[serde(default, skip_serializing_if = "Option::is_none")]
7515    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7516    pub privileged: Option<bool>,
7517    /// procMount denotes the type of proc mount to use for the containers.
7518    /// The default value is Default which uses the container runtime defaults for
7519    /// readonly paths and masked paths.
7520    /// Note that this field cannot be set when spec.os.name is windows.
7521    #[serde(default, skip_serializing_if = "Option::is_none", rename = "procMount")]
7522    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7523    pub proc_mount: Option<String>,
7524    /// Whether this container has a read-only root filesystem.
7525    /// Default is false.
7526    /// Note that this field cannot be set when spec.os.name is windows.
7527    #[serde(
7528        default,
7529        skip_serializing_if = "Option::is_none",
7530        rename = "readOnlyRootFilesystem"
7531    )]
7532    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7533    pub read_only_root_filesystem: Option<bool>,
7534    /// The GID to run the entrypoint of the container process.
7535    /// Uses runtime default if unset.
7536    /// May also be set in PodSecurityContext.  If set in both SecurityContext and
7537    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
7538    /// Note that this field cannot be set when spec.os.name is windows.
7539    #[serde(
7540        default,
7541        skip_serializing_if = "Option::is_none",
7542        rename = "runAsGroup"
7543    )]
7544    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7545    pub run_as_group: Option<i64>,
7546    /// Indicates that the container must run as a non-root user.
7547    /// If true, the Kubelet will validate the image at runtime to ensure that it
7548    /// does not run as UID 0 (root) and fail to start the container if it does.
7549    /// If unset or false, no such validation will be performed.
7550    /// May also be set in PodSecurityContext.  If set in both SecurityContext and
7551    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
7552    #[serde(
7553        default,
7554        skip_serializing_if = "Option::is_none",
7555        rename = "runAsNonRoot"
7556    )]
7557    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7558    pub run_as_non_root: Option<bool>,
7559    /// The UID to run the entrypoint of the container process.
7560    /// Defaults to user specified in image metadata if unspecified.
7561    /// May also be set in PodSecurityContext.  If set in both SecurityContext and
7562    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
7563    /// Note that this field cannot be set when spec.os.name is windows.
7564    #[serde(default, skip_serializing_if = "Option::is_none", rename = "runAsUser")]
7565    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7566    pub run_as_user: Option<i64>,
7567    /// The SELinux context to be applied to the container.
7568    /// If unspecified, the container runtime will allocate a random SELinux context for each
7569    /// container.  May also be set in PodSecurityContext.  If set in both SecurityContext and
7570    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
7571    /// Note that this field cannot be set when spec.os.name is windows.
7572    #[serde(
7573        default,
7574        skip_serializing_if = "Option::is_none",
7575        rename = "seLinuxOptions"
7576    )]
7577    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7578    pub se_linux_options: Option<ClusterSecurityContextSeLinuxOptions>,
7579    /// The seccomp options to use by this container. If seccomp options are
7580    /// provided at both the pod & container level, the container options
7581    /// override the pod options.
7582    /// Note that this field cannot be set when spec.os.name is windows.
7583    #[serde(
7584        default,
7585        skip_serializing_if = "Option::is_none",
7586        rename = "seccompProfile"
7587    )]
7588    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7589    pub seccomp_profile: Option<ClusterSecurityContextSeccompProfile>,
7590    /// The Windows specific settings applied to all containers.
7591    /// If unspecified, the options from the PodSecurityContext will be used.
7592    /// If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
7593    /// Note that this field cannot be set when spec.os.name is linux.
7594    #[serde(
7595        default,
7596        skip_serializing_if = "Option::is_none",
7597        rename = "windowsOptions"
7598    )]
7599    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7600    pub windows_options: Option<ClusterSecurityContextWindowsOptions>,
7601}
7602
7603/// appArmorProfile is the AppArmor options to use by this container. If set, this profile
7604/// overrides the pod's appArmorProfile.
7605/// Note that this field cannot be set when spec.os.name is windows.
7606#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7607#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7608#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7609pub struct ClusterSecurityContextAppArmorProfile {
7610    /// localhostProfile indicates a profile loaded on the node that should be used.
7611    /// The profile must be preconfigured on the node to work.
7612    /// Must match the loaded name of the profile.
7613    /// Must be set if and only if type is "Localhost".
7614    #[serde(
7615        default,
7616        skip_serializing_if = "Option::is_none",
7617        rename = "localhostProfile"
7618    )]
7619    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7620    pub localhost_profile: Option<String>,
7621    /// type indicates which kind of AppArmor profile will be applied.
7622    /// Valid options are:
7623    ///   Localhost - a profile pre-loaded on the node.
7624    ///   RuntimeDefault - the container runtime's default profile.
7625    ///   Unconfined - no AppArmor enforcement.
7626    #[serde(rename = "type")]
7627    pub r#type: String,
7628}
7629
7630/// The capabilities to add/drop when running containers.
7631/// Defaults to the default set of capabilities granted by the container runtime.
7632/// Note that this field cannot be set when spec.os.name is windows.
7633#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7634#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7635#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7636pub struct ClusterSecurityContextCapabilities {
7637    /// Added capabilities
7638    #[serde(default, skip_serializing_if = "Option::is_none")]
7639    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7640    pub add: Option<Vec<String>>,
7641    /// Removed capabilities
7642    #[serde(default, skip_serializing_if = "Option::is_none")]
7643    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7644    pub drop: Option<Vec<String>>,
7645}
7646
7647/// The SELinux context to be applied to the container.
7648/// If unspecified, the container runtime will allocate a random SELinux context for each
7649/// container.  May also be set in PodSecurityContext.  If set in both SecurityContext and
7650/// PodSecurityContext, the value specified in SecurityContext takes precedence.
7651/// Note that this field cannot be set when spec.os.name is windows.
7652#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7653#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7654#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7655pub struct ClusterSecurityContextSeLinuxOptions {
7656    /// Level is SELinux level label that applies to the container.
7657    #[serde(default, skip_serializing_if = "Option::is_none")]
7658    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7659    pub level: Option<String>,
7660    /// Role is a SELinux role label that applies to the container.
7661    #[serde(default, skip_serializing_if = "Option::is_none")]
7662    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7663    pub role: Option<String>,
7664    /// Type is a SELinux type label that applies to the container.
7665    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
7666    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7667    pub r#type: Option<String>,
7668    /// User is a SELinux user label that applies to the container.
7669    #[serde(default, skip_serializing_if = "Option::is_none")]
7670    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7671    pub user: Option<String>,
7672}
7673
7674/// The seccomp options to use by this container. If seccomp options are
7675/// provided at both the pod & container level, the container options
7676/// override the pod options.
7677/// Note that this field cannot be set when spec.os.name is windows.
7678#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7679#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7680#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7681pub struct ClusterSecurityContextSeccompProfile {
7682    /// localhostProfile indicates a profile defined in a file on the node should be used.
7683    /// The profile must be preconfigured on the node to work.
7684    /// Must be a descending path, relative to the kubelet's configured seccomp profile location.
7685    /// Must be set if type is "Localhost". Must NOT be set for any other type.
7686    #[serde(
7687        default,
7688        skip_serializing_if = "Option::is_none",
7689        rename = "localhostProfile"
7690    )]
7691    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7692    pub localhost_profile: Option<String>,
7693    /// type indicates which kind of seccomp profile will be applied.
7694    /// Valid options are:
7695    ///
7696    /// Localhost - a profile defined in a file on the node should be used.
7697    /// RuntimeDefault - the container runtime default profile should be used.
7698    /// Unconfined - no profile should be applied.
7699    #[serde(rename = "type")]
7700    pub r#type: String,
7701}
7702
7703/// The Windows specific settings applied to all containers.
7704/// If unspecified, the options from the PodSecurityContext will be used.
7705/// If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
7706/// Note that this field cannot be set when spec.os.name is linux.
7707#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7708#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7709#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7710pub struct ClusterSecurityContextWindowsOptions {
7711    /// GMSACredentialSpec is where the GMSA admission webhook
7712    /// (<https://github.com/kubernetes-sigs/windows-gmsa)> inlines the contents of the
7713    /// GMSA credential spec named by the GMSACredentialSpecName field.
7714    #[serde(
7715        default,
7716        skip_serializing_if = "Option::is_none",
7717        rename = "gmsaCredentialSpec"
7718    )]
7719    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7720    pub gmsa_credential_spec: Option<String>,
7721    /// GMSACredentialSpecName is the name of the GMSA credential spec to use.
7722    #[serde(
7723        default,
7724        skip_serializing_if = "Option::is_none",
7725        rename = "gmsaCredentialSpecName"
7726    )]
7727    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7728    pub gmsa_credential_spec_name: Option<String>,
7729    /// HostProcess determines if a container should be run as a 'Host Process' container.
7730    /// All of a Pod's containers must have the same effective HostProcess value
7731    /// (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers).
7732    /// In addition, if HostProcess is true then HostNetwork must also be set to true.
7733    #[serde(
7734        default,
7735        skip_serializing_if = "Option::is_none",
7736        rename = "hostProcess"
7737    )]
7738    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7739    pub host_process: Option<bool>,
7740    /// The UserName in Windows to run the entrypoint of the container process.
7741    /// Defaults to the user specified in image metadata if unspecified.
7742    /// May also be set in PodSecurityContext. If set in both SecurityContext and
7743    /// PodSecurityContext, the value specified in SecurityContext takes precedence.
7744    #[serde(
7745        default,
7746        skip_serializing_if = "Option::is_none",
7747        rename = "runAsUserName"
7748    )]
7749    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7750    pub run_as_user_name: Option<String>,
7751}
7752
7753/// Configure the generation of the service account
7754#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7755#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7756#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7757pub struct ClusterServiceAccountTemplate {
7758    /// Metadata are the metadata to be used for the generated
7759    /// service account
7760    pub metadata: ClusterServiceAccountTemplateMetadata,
7761}
7762
7763/// Metadata are the metadata to be used for the generated
7764/// service account
7765#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7766#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7767#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7768pub struct ClusterServiceAccountTemplateMetadata {
7769    /// Annotations is an unstructured key value map stored with a resource that may be
7770    /// set by external tools to store and retrieve arbitrary metadata. They are not
7771    /// queryable and should be preserved when modifying objects.
7772    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
7773    #[serde(default, skip_serializing_if = "Option::is_none")]
7774    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7775    pub annotations: Option<BTreeMap<String, String>>,
7776    /// Map of string keys and values that can be used to organize and categorize
7777    /// (scope and select) objects. May match selectors of replication controllers
7778    /// and services.
7779    /// More info: <http://kubernetes.io/docs/user-guide/labels>
7780    #[serde(default, skip_serializing_if = "Option::is_none")]
7781    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7782    pub labels: Option<BTreeMap<String, String>>,
7783    /// The name of the resource. Only supported for certain types
7784    #[serde(default, skip_serializing_if = "Option::is_none")]
7785    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7786    pub name: Option<String>,
7787}
7788
7789/// Configuration of the storage of the instances
7790#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7791#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7792#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7793pub struct ClusterStorage {
7794    /// Template to be used to generate the Persistent Volume Claim
7795    #[serde(
7796        default,
7797        skip_serializing_if = "Option::is_none",
7798        rename = "pvcTemplate"
7799    )]
7800    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7801    pub pvc_template: Option<ClusterStoragePvcTemplate>,
7802    /// Resize existent PVCs, defaults to true
7803    #[serde(
7804        default,
7805        skip_serializing_if = "Option::is_none",
7806        rename = "resizeInUseVolumes"
7807    )]
7808    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7809    pub resize_in_use_volumes: Option<bool>,
7810    /// Size of the storage. Required if not already specified in the PVC template.
7811    /// Changes to this field are automatically reapplied to the created PVCs.
7812    /// Size cannot be decreased.
7813    #[serde(default, skip_serializing_if = "Option::is_none")]
7814    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7815    pub size: Option<String>,
7816    /// StorageClass to use for PVCs. Applied after
7817    /// evaluating the PVC template, if available.
7818    /// If not specified, the generated PVCs will use the
7819    /// default storage class
7820    #[serde(
7821        default,
7822        skip_serializing_if = "Option::is_none",
7823        rename = "storageClass"
7824    )]
7825    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7826    pub storage_class: Option<String>,
7827}
7828
7829/// Template to be used to generate the Persistent Volume Claim
7830#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7831#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7832#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7833pub struct ClusterStoragePvcTemplate {
7834    /// accessModes contains the desired access modes the volume should have.
7835    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1>
7836    #[serde(
7837        default,
7838        skip_serializing_if = "Option::is_none",
7839        rename = "accessModes"
7840    )]
7841    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7842    pub access_modes: Option<Vec<String>>,
7843    /// dataSource field can be used to specify either:
7844    /// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
7845    /// * An existing PVC (PersistentVolumeClaim)
7846    /// If the provisioner or an external controller can support the specified data source,
7847    /// it will create a new volume based on the contents of the specified data source.
7848    /// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
7849    /// copied to dataSource when dataSourceRef.namespace is not specified.
7850    /// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
7851    #[serde(
7852        default,
7853        skip_serializing_if = "Option::is_none",
7854        rename = "dataSource"
7855    )]
7856    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7857    pub data_source: Option<ClusterStoragePvcTemplateDataSource>,
7858    /// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
7859    /// volume is desired. This may be any object from a non-empty API group (non
7860    /// core object) or a PersistentVolumeClaim object.
7861    /// When this field is specified, volume binding will only succeed if the type of
7862    /// the specified object matches some installed volume populator or dynamic
7863    /// provisioner.
7864    /// This field will replace the functionality of the dataSource field and as such
7865    /// if both fields are non-empty, they must have the same value. For backwards
7866    /// compatibility, when namespace isn't specified in dataSourceRef,
7867    /// both fields (dataSource and dataSourceRef) will be set to the same
7868    /// value automatically if one of them is empty and the other is non-empty.
7869    /// When namespace is specified in dataSourceRef,
7870    /// dataSource isn't set to the same value and must be empty.
7871    /// There are three important differences between dataSource and dataSourceRef:
7872    /// * While dataSource only allows two specific types of objects, dataSourceRef
7873    ///   allows any non-core object, as well as PersistentVolumeClaim objects.
7874    /// * While dataSource ignores disallowed values (dropping them), dataSourceRef
7875    ///   preserves all values, and generates an error if a disallowed value is
7876    ///   specified.
7877    /// * While dataSource only allows local objects, dataSourceRef allows objects
7878    ///   in any namespaces.
7879    /// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
7880    #[serde(
7881        default,
7882        skip_serializing_if = "Option::is_none",
7883        rename = "dataSourceRef"
7884    )]
7885    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7886    pub data_source_ref: Option<ClusterStoragePvcTemplateDataSourceRef>,
7887    /// resources represents the minimum resources the volume should have.
7888    /// Users are allowed to specify resource requirements
7889    /// that are lower than previous value but must still be higher than capacity recorded in the
7890    /// status field of the claim.
7891    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
7892    #[serde(default, skip_serializing_if = "Option::is_none")]
7893    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7894    pub resources: Option<ClusterStoragePvcTemplateResources>,
7895    /// selector is a label query over volumes to consider for binding.
7896    #[serde(default, skip_serializing_if = "Option::is_none")]
7897    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7898    pub selector: Option<ClusterStoragePvcTemplateSelector>,
7899    /// storageClassName is the name of the StorageClass required by the claim.
7900    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1>
7901    #[serde(
7902        default,
7903        skip_serializing_if = "Option::is_none",
7904        rename = "storageClassName"
7905    )]
7906    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7907    pub storage_class_name: Option<String>,
7908    /// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
7909    /// If specified, the CSI driver will create or update the volume with the attributes defined
7910    /// in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName,
7911    /// it can be changed after the claim is created. An empty string or nil value indicates that no
7912    /// VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state,
7913    /// this field can be reset to its previous value (including nil) to cancel the modification.
7914    /// If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be
7915    /// set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource
7916    /// exists.
7917    /// More info: <https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/>
7918    #[serde(
7919        default,
7920        skip_serializing_if = "Option::is_none",
7921        rename = "volumeAttributesClassName"
7922    )]
7923    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7924    pub volume_attributes_class_name: Option<String>,
7925    /// volumeMode defines what type of volume is required by the claim.
7926    /// Value of Filesystem is implied when not included in claim spec.
7927    #[serde(
7928        default,
7929        skip_serializing_if = "Option::is_none",
7930        rename = "volumeMode"
7931    )]
7932    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7933    pub volume_mode: Option<String>,
7934    /// volumeName is the binding reference to the PersistentVolume backing this claim.
7935    #[serde(
7936        default,
7937        skip_serializing_if = "Option::is_none",
7938        rename = "volumeName"
7939    )]
7940    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7941    pub volume_name: Option<String>,
7942}
7943
7944/// dataSource field can be used to specify either:
7945/// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
7946/// * An existing PVC (PersistentVolumeClaim)
7947/// If the provisioner or an external controller can support the specified data source,
7948/// it will create a new volume based on the contents of the specified data source.
7949/// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
7950/// copied to dataSource when dataSourceRef.namespace is not specified.
7951/// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
7952#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7953#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7954#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7955pub struct ClusterStoragePvcTemplateDataSource {
7956    /// APIGroup is the group for the resource being referenced.
7957    /// If APIGroup is not specified, the specified Kind must be in the core API group.
7958    /// For any other third-party types, APIGroup is required.
7959    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
7960    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7961    pub api_group: Option<String>,
7962    /// Kind is the type of resource being referenced
7963    pub kind: String,
7964    /// Name is the name of resource being referenced
7965    pub name: String,
7966}
7967
7968/// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
7969/// volume is desired. This may be any object from a non-empty API group (non
7970/// core object) or a PersistentVolumeClaim object.
7971/// When this field is specified, volume binding will only succeed if the type of
7972/// the specified object matches some installed volume populator or dynamic
7973/// provisioner.
7974/// This field will replace the functionality of the dataSource field and as such
7975/// if both fields are non-empty, they must have the same value. For backwards
7976/// compatibility, when namespace isn't specified in dataSourceRef,
7977/// both fields (dataSource and dataSourceRef) will be set to the same
7978/// value automatically if one of them is empty and the other is non-empty.
7979/// When namespace is specified in dataSourceRef,
7980/// dataSource isn't set to the same value and must be empty.
7981/// There are three important differences between dataSource and dataSourceRef:
7982/// * While dataSource only allows two specific types of objects, dataSourceRef
7983///   allows any non-core object, as well as PersistentVolumeClaim objects.
7984/// * While dataSource ignores disallowed values (dropping them), dataSourceRef
7985///   preserves all values, and generates an error if a disallowed value is
7986///   specified.
7987/// * While dataSource only allows local objects, dataSourceRef allows objects
7988///   in any namespaces.
7989/// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
7990#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
7991#[cfg_attr(feature = "builder", derive(TypedBuilder))]
7992#[cfg_attr(feature = "schemars", derive(JsonSchema))]
7993pub struct ClusterStoragePvcTemplateDataSourceRef {
7994    /// APIGroup is the group for the resource being referenced.
7995    /// If APIGroup is not specified, the specified Kind must be in the core API group.
7996    /// For any other third-party types, APIGroup is required.
7997    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
7998    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
7999    pub api_group: Option<String>,
8000    /// Kind is the type of resource being referenced
8001    pub kind: String,
8002    /// Name is the name of resource being referenced
8003    pub name: String,
8004    /// Namespace is the namespace of resource being referenced
8005    /// Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details.
8006    /// (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8007    #[serde(default, skip_serializing_if = "Option::is_none")]
8008    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8009    pub namespace: Option<String>,
8010}
8011
8012/// resources represents the minimum resources the volume should have.
8013/// Users are allowed to specify resource requirements
8014/// that are lower than previous value but must still be higher than capacity recorded in the
8015/// status field of the claim.
8016/// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
8017#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8018#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8019#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8020pub struct ClusterStoragePvcTemplateResources {
8021    /// Limits describes the maximum amount of compute resources allowed.
8022    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8023    #[serde(default, skip_serializing_if = "Option::is_none")]
8024    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8025    pub limits: Option<BTreeMap<String, IntOrString>>,
8026    /// Requests describes the minimum amount of compute resources required.
8027    /// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
8028    /// otherwise to an implementation-defined value. Requests cannot exceed Limits.
8029    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8030    #[serde(default, skip_serializing_if = "Option::is_none")]
8031    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8032    pub requests: Option<BTreeMap<String, IntOrString>>,
8033}
8034
8035/// selector is a label query over volumes to consider for binding.
8036#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8037#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8038#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8039pub struct ClusterStoragePvcTemplateSelector {
8040    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
8041    #[serde(
8042        default,
8043        skip_serializing_if = "Option::is_none",
8044        rename = "matchExpressions"
8045    )]
8046    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8047    pub match_expressions: Option<Vec<ClusterStoragePvcTemplateSelectorMatchExpressions>>,
8048    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
8049    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
8050    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
8051    #[serde(
8052        default,
8053        skip_serializing_if = "Option::is_none",
8054        rename = "matchLabels"
8055    )]
8056    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8057    pub match_labels: Option<BTreeMap<String, String>>,
8058}
8059
8060/// A label selector requirement is a selector that contains values, a key, and an operator that
8061/// relates the key and values.
8062#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8063#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8064#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8065pub struct ClusterStoragePvcTemplateSelectorMatchExpressions {
8066    /// key is the label key that the selector applies to.
8067    pub key: String,
8068    /// operator represents a key's relationship to a set of values.
8069    /// Valid operators are In, NotIn, Exists and DoesNotExist.
8070    pub operator: String,
8071    /// values is an array of string values. If the operator is In or NotIn,
8072    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
8073    /// the values array must be empty. This array is replaced during a strategic
8074    /// merge patch.
8075    #[serde(default, skip_serializing_if = "Option::is_none")]
8076    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8077    pub values: Option<Vec<String>>,
8078}
8079
8080/// The secret containing the superuser password. If not defined a new
8081/// secret will be created with a randomly generated password
8082#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8083#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8084#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8085pub struct ClusterSuperuserSecret {
8086    /// Name of the referent.
8087    pub name: String,
8088}
8089
8090/// TablespaceConfiguration is the configuration of a tablespace, and includes
8091/// the storage specification for the tablespace
8092#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8093#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8094#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8095pub struct ClusterTablespaces {
8096    /// The name of the tablespace
8097    pub name: String,
8098    /// Owner is the PostgreSQL user owning the tablespace
8099    #[serde(default, skip_serializing_if = "Option::is_none")]
8100    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8101    pub owner: Option<ClusterTablespacesOwner>,
8102    /// The storage configuration for the tablespace
8103    pub storage: ClusterTablespacesStorage,
8104    /// When set to true, the tablespace will be added as a `temp_tablespaces`
8105    /// entry in PostgreSQL, and will be available to automatically house temp
8106    /// database objects, or other temporary files. Please refer to PostgreSQL
8107    /// documentation for more information on the `temp_tablespaces` GUC.
8108    #[serde(default, skip_serializing_if = "Option::is_none")]
8109    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8110    pub temporary: Option<bool>,
8111}
8112
8113/// Owner is the PostgreSQL user owning the tablespace
8114#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8115#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8116#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8117pub struct ClusterTablespacesOwner {
8118    #[serde(default, skip_serializing_if = "Option::is_none")]
8119    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8120    pub name: Option<String>,
8121}
8122
8123/// The storage configuration for the tablespace
8124#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8125#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8126#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8127pub struct ClusterTablespacesStorage {
8128    /// Template to be used to generate the Persistent Volume Claim
8129    #[serde(
8130        default,
8131        skip_serializing_if = "Option::is_none",
8132        rename = "pvcTemplate"
8133    )]
8134    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8135    pub pvc_template: Option<ClusterTablespacesStoragePvcTemplate>,
8136    /// Resize existent PVCs, defaults to true
8137    #[serde(
8138        default,
8139        skip_serializing_if = "Option::is_none",
8140        rename = "resizeInUseVolumes"
8141    )]
8142    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8143    pub resize_in_use_volumes: Option<bool>,
8144    /// Size of the storage. Required if not already specified in the PVC template.
8145    /// Changes to this field are automatically reapplied to the created PVCs.
8146    /// Size cannot be decreased.
8147    #[serde(default, skip_serializing_if = "Option::is_none")]
8148    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8149    pub size: Option<String>,
8150    /// StorageClass to use for PVCs. Applied after
8151    /// evaluating the PVC template, if available.
8152    /// If not specified, the generated PVCs will use the
8153    /// default storage class
8154    #[serde(
8155        default,
8156        skip_serializing_if = "Option::is_none",
8157        rename = "storageClass"
8158    )]
8159    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8160    pub storage_class: Option<String>,
8161}
8162
8163/// Template to be used to generate the Persistent Volume Claim
8164#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8165#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8166#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8167pub struct ClusterTablespacesStoragePvcTemplate {
8168    /// accessModes contains the desired access modes the volume should have.
8169    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1>
8170    #[serde(
8171        default,
8172        skip_serializing_if = "Option::is_none",
8173        rename = "accessModes"
8174    )]
8175    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8176    pub access_modes: Option<Vec<String>>,
8177    /// dataSource field can be used to specify either:
8178    /// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
8179    /// * An existing PVC (PersistentVolumeClaim)
8180    /// If the provisioner or an external controller can support the specified data source,
8181    /// it will create a new volume based on the contents of the specified data source.
8182    /// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
8183    /// copied to dataSource when dataSourceRef.namespace is not specified.
8184    /// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
8185    #[serde(
8186        default,
8187        skip_serializing_if = "Option::is_none",
8188        rename = "dataSource"
8189    )]
8190    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8191    pub data_source: Option<ClusterTablespacesStoragePvcTemplateDataSource>,
8192    /// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
8193    /// volume is desired. This may be any object from a non-empty API group (non
8194    /// core object) or a PersistentVolumeClaim object.
8195    /// When this field is specified, volume binding will only succeed if the type of
8196    /// the specified object matches some installed volume populator or dynamic
8197    /// provisioner.
8198    /// This field will replace the functionality of the dataSource field and as such
8199    /// if both fields are non-empty, they must have the same value. For backwards
8200    /// compatibility, when namespace isn't specified in dataSourceRef,
8201    /// both fields (dataSource and dataSourceRef) will be set to the same
8202    /// value automatically if one of them is empty and the other is non-empty.
8203    /// When namespace is specified in dataSourceRef,
8204    /// dataSource isn't set to the same value and must be empty.
8205    /// There are three important differences between dataSource and dataSourceRef:
8206    /// * While dataSource only allows two specific types of objects, dataSourceRef
8207    ///   allows any non-core object, as well as PersistentVolumeClaim objects.
8208    /// * While dataSource ignores disallowed values (dropping them), dataSourceRef
8209    ///   preserves all values, and generates an error if a disallowed value is
8210    ///   specified.
8211    /// * While dataSource only allows local objects, dataSourceRef allows objects
8212    ///   in any namespaces.
8213    /// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8214    #[serde(
8215        default,
8216        skip_serializing_if = "Option::is_none",
8217        rename = "dataSourceRef"
8218    )]
8219    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8220    pub data_source_ref: Option<ClusterTablespacesStoragePvcTemplateDataSourceRef>,
8221    /// resources represents the minimum resources the volume should have.
8222    /// Users are allowed to specify resource requirements
8223    /// that are lower than previous value but must still be higher than capacity recorded in the
8224    /// status field of the claim.
8225    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
8226    #[serde(default, skip_serializing_if = "Option::is_none")]
8227    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8228    pub resources: Option<ClusterTablespacesStoragePvcTemplateResources>,
8229    /// selector is a label query over volumes to consider for binding.
8230    #[serde(default, skip_serializing_if = "Option::is_none")]
8231    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8232    pub selector: Option<ClusterTablespacesStoragePvcTemplateSelector>,
8233    /// storageClassName is the name of the StorageClass required by the claim.
8234    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1>
8235    #[serde(
8236        default,
8237        skip_serializing_if = "Option::is_none",
8238        rename = "storageClassName"
8239    )]
8240    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8241    pub storage_class_name: Option<String>,
8242    /// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
8243    /// If specified, the CSI driver will create or update the volume with the attributes defined
8244    /// in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName,
8245    /// it can be changed after the claim is created. An empty string or nil value indicates that no
8246    /// VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state,
8247    /// this field can be reset to its previous value (including nil) to cancel the modification.
8248    /// If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be
8249    /// set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource
8250    /// exists.
8251    /// More info: <https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/>
8252    #[serde(
8253        default,
8254        skip_serializing_if = "Option::is_none",
8255        rename = "volumeAttributesClassName"
8256    )]
8257    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8258    pub volume_attributes_class_name: Option<String>,
8259    /// volumeMode defines what type of volume is required by the claim.
8260    /// Value of Filesystem is implied when not included in claim spec.
8261    #[serde(
8262        default,
8263        skip_serializing_if = "Option::is_none",
8264        rename = "volumeMode"
8265    )]
8266    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8267    pub volume_mode: Option<String>,
8268    /// volumeName is the binding reference to the PersistentVolume backing this claim.
8269    #[serde(
8270        default,
8271        skip_serializing_if = "Option::is_none",
8272        rename = "volumeName"
8273    )]
8274    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8275    pub volume_name: Option<String>,
8276}
8277
8278/// dataSource field can be used to specify either:
8279/// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
8280/// * An existing PVC (PersistentVolumeClaim)
8281/// If the provisioner or an external controller can support the specified data source,
8282/// it will create a new volume based on the contents of the specified data source.
8283/// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
8284/// copied to dataSource when dataSourceRef.namespace is not specified.
8285/// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
8286#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8287#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8288#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8289pub struct ClusterTablespacesStoragePvcTemplateDataSource {
8290    /// APIGroup is the group for the resource being referenced.
8291    /// If APIGroup is not specified, the specified Kind must be in the core API group.
8292    /// For any other third-party types, APIGroup is required.
8293    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
8294    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8295    pub api_group: Option<String>,
8296    /// Kind is the type of resource being referenced
8297    pub kind: String,
8298    /// Name is the name of resource being referenced
8299    pub name: String,
8300}
8301
8302/// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
8303/// volume is desired. This may be any object from a non-empty API group (non
8304/// core object) or a PersistentVolumeClaim object.
8305/// When this field is specified, volume binding will only succeed if the type of
8306/// the specified object matches some installed volume populator or dynamic
8307/// provisioner.
8308/// This field will replace the functionality of the dataSource field and as such
8309/// if both fields are non-empty, they must have the same value. For backwards
8310/// compatibility, when namespace isn't specified in dataSourceRef,
8311/// both fields (dataSource and dataSourceRef) will be set to the same
8312/// value automatically if one of them is empty and the other is non-empty.
8313/// When namespace is specified in dataSourceRef,
8314/// dataSource isn't set to the same value and must be empty.
8315/// There are three important differences between dataSource and dataSourceRef:
8316/// * While dataSource only allows two specific types of objects, dataSourceRef
8317///   allows any non-core object, as well as PersistentVolumeClaim objects.
8318/// * While dataSource ignores disallowed values (dropping them), dataSourceRef
8319///   preserves all values, and generates an error if a disallowed value is
8320///   specified.
8321/// * While dataSource only allows local objects, dataSourceRef allows objects
8322///   in any namespaces.
8323/// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8324#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8325#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8326#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8327pub struct ClusterTablespacesStoragePvcTemplateDataSourceRef {
8328    /// APIGroup is the group for the resource being referenced.
8329    /// If APIGroup is not specified, the specified Kind must be in the core API group.
8330    /// For any other third-party types, APIGroup is required.
8331    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
8332    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8333    pub api_group: Option<String>,
8334    /// Kind is the type of resource being referenced
8335    pub kind: String,
8336    /// Name is the name of resource being referenced
8337    pub name: String,
8338    /// Namespace is the namespace of resource being referenced
8339    /// Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details.
8340    /// (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8341    #[serde(default, skip_serializing_if = "Option::is_none")]
8342    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8343    pub namespace: Option<String>,
8344}
8345
8346/// resources represents the minimum resources the volume should have.
8347/// Users are allowed to specify resource requirements
8348/// that are lower than previous value but must still be higher than capacity recorded in the
8349/// status field of the claim.
8350/// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
8351#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8352#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8353#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8354pub struct ClusterTablespacesStoragePvcTemplateResources {
8355    /// Limits describes the maximum amount of compute resources allowed.
8356    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8357    #[serde(default, skip_serializing_if = "Option::is_none")]
8358    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8359    pub limits: Option<BTreeMap<String, IntOrString>>,
8360    /// Requests describes the minimum amount of compute resources required.
8361    /// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
8362    /// otherwise to an implementation-defined value. Requests cannot exceed Limits.
8363    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8364    #[serde(default, skip_serializing_if = "Option::is_none")]
8365    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8366    pub requests: Option<BTreeMap<String, IntOrString>>,
8367}
8368
8369/// selector is a label query over volumes to consider for binding.
8370#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8371#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8372#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8373pub struct ClusterTablespacesStoragePvcTemplateSelector {
8374    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
8375    #[serde(
8376        default,
8377        skip_serializing_if = "Option::is_none",
8378        rename = "matchExpressions"
8379    )]
8380    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8381    pub match_expressions:
8382        Option<Vec<ClusterTablespacesStoragePvcTemplateSelectorMatchExpressions>>,
8383    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
8384    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
8385    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
8386    #[serde(
8387        default,
8388        skip_serializing_if = "Option::is_none",
8389        rename = "matchLabels"
8390    )]
8391    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8392    pub match_labels: Option<BTreeMap<String, String>>,
8393}
8394
8395/// A label selector requirement is a selector that contains values, a key, and an operator that
8396/// relates the key and values.
8397#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8398#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8399#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8400pub struct ClusterTablespacesStoragePvcTemplateSelectorMatchExpressions {
8401    /// key is the label key that the selector applies to.
8402    pub key: String,
8403    /// operator represents a key's relationship to a set of values.
8404    /// Valid operators are In, NotIn, Exists and DoesNotExist.
8405    pub operator: String,
8406    /// values is an array of string values. If the operator is In or NotIn,
8407    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
8408    /// the values array must be empty. This array is replaced during a strategic
8409    /// merge patch.
8410    #[serde(default, skip_serializing_if = "Option::is_none")]
8411    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8412    pub values: Option<Vec<String>>,
8413}
8414
8415/// TopologySpreadConstraint specifies how to spread matching pods among the given topology.
8416#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8417#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8418#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8419pub struct ClusterTopologySpreadConstraints {
8420    /// LabelSelector is used to find matching pods.
8421    /// Pods that match this label selector are counted to determine the number of pods
8422    /// in their corresponding topology domain.
8423    #[serde(
8424        default,
8425        skip_serializing_if = "Option::is_none",
8426        rename = "labelSelector"
8427    )]
8428    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8429    pub label_selector: Option<ClusterTopologySpreadConstraintsLabelSelector>,
8430    /// MatchLabelKeys is a set of pod label keys to select the pods over which
8431    /// spreading will be calculated. The keys are used to lookup values from the
8432    /// incoming pod labels, those key-value labels are ANDed with labelSelector
8433    /// to select the group of existing pods over which spreading will be calculated
8434    /// for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector.
8435    /// MatchLabelKeys cannot be set when LabelSelector isn't set.
8436    /// Keys that don't exist in the incoming pod labels will
8437    /// be ignored. A null or empty list means only match against labelSelector.
8438    ///
8439    /// This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
8440    #[serde(
8441        default,
8442        skip_serializing_if = "Option::is_none",
8443        rename = "matchLabelKeys"
8444    )]
8445    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8446    pub match_label_keys: Option<Vec<String>>,
8447    /// MaxSkew describes the degree to which pods may be unevenly distributed.
8448    /// When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference
8449    /// between the number of matching pods in the target topology and the global minimum.
8450    /// The global minimum is the minimum number of matching pods in an eligible domain
8451    /// or zero if the number of eligible domains is less than MinDomains.
8452    /// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
8453    /// labelSelector spread as 2/2/1:
8454    /// In this case, the global minimum is 1.
8455    /// | zone1 | zone2 | zone3 |
8456    /// |  P P  |  P P  |   P   |
8457    /// - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2;
8458    /// scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2)
8459    /// violate MaxSkew(1).
8460    /// - if MaxSkew is 2, incoming pod can be scheduled onto any zone.
8461    /// When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence
8462    /// to topologies that satisfy it.
8463    /// It's a required field. Default value is 1 and 0 is not allowed.
8464    #[serde(rename = "maxSkew")]
8465    pub max_skew: i32,
8466    /// MinDomains indicates a minimum number of eligible domains.
8467    /// When the number of eligible domains with matching topology keys is less than minDomains,
8468    /// Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed.
8469    /// And when the number of eligible domains with matching topology keys equals or greater than minDomains,
8470    /// this value has no effect on scheduling.
8471    /// As a result, when the number of eligible domains is less than minDomains,
8472    /// scheduler won't schedule more than maxSkew Pods to those domains.
8473    /// If value is nil, the constraint behaves as if MinDomains is equal to 1.
8474    /// Valid values are integers greater than 0.
8475    /// When value is not nil, WhenUnsatisfiable must be DoNotSchedule.
8476    ///
8477    /// For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same
8478    /// labelSelector spread as 2/2/2:
8479    /// | zone1 | zone2 | zone3 |
8480    /// |  P P  |  P P  |  P P  |
8481    /// The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0.
8482    /// In this situation, new pod with the same labelSelector cannot be scheduled,
8483    /// because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones,
8484    /// it will violate MaxSkew.
8485    #[serde(
8486        default,
8487        skip_serializing_if = "Option::is_none",
8488        rename = "minDomains"
8489    )]
8490    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8491    pub min_domains: Option<i32>,
8492    /// NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector
8493    /// when calculating pod topology spread skew. Options are:
8494    /// - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations.
8495    /// - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations.
8496    ///
8497    /// If this value is nil, the behavior is equivalent to the Honor policy.
8498    #[serde(
8499        default,
8500        skip_serializing_if = "Option::is_none",
8501        rename = "nodeAffinityPolicy"
8502    )]
8503    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8504    pub node_affinity_policy: Option<String>,
8505    /// NodeTaintsPolicy indicates how we will treat node taints when calculating
8506    /// pod topology spread skew. Options are:
8507    /// - Honor: nodes without taints, along with tainted nodes for which the incoming pod
8508    /// has a toleration, are included.
8509    /// - Ignore: node taints are ignored. All nodes are included.
8510    ///
8511    /// If this value is nil, the behavior is equivalent to the Ignore policy.
8512    #[serde(
8513        default,
8514        skip_serializing_if = "Option::is_none",
8515        rename = "nodeTaintsPolicy"
8516    )]
8517    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8518    pub node_taints_policy: Option<String>,
8519    /// TopologyKey is the key of node labels. Nodes that have a label with this key
8520    /// and identical values are considered to be in the same topology.
8521    /// We consider each <key, value> as a "bucket", and try to put balanced number
8522    /// of pods into each bucket.
8523    /// We define a domain as a particular instance of a topology.
8524    /// Also, we define an eligible domain as a domain whose nodes meet the requirements of
8525    /// nodeAffinityPolicy and nodeTaintsPolicy.
8526    /// e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology.
8527    /// And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology.
8528    /// It's a required field.
8529    #[serde(rename = "topologyKey")]
8530    pub topology_key: String,
8531    /// WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy
8532    /// the spread constraint.
8533    /// - DoNotSchedule (default) tells the scheduler not to schedule it.
8534    /// - ScheduleAnyway tells the scheduler to schedule the pod in any location,
8535    ///   but giving higher precedence to topologies that would help reduce the
8536    ///   skew.
8537    /// A constraint is considered "Unsatisfiable" for an incoming pod
8538    /// if and only if every possible node assignment for that pod would violate
8539    /// "MaxSkew" on some topology.
8540    /// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
8541    /// labelSelector spread as 3/1/1:
8542    /// | zone1 | zone2 | zone3 |
8543    /// | P P P |   P   |   P   |
8544    /// If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled
8545    /// to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies
8546    /// MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler
8547    /// won't make it *more* imbalanced.
8548    /// It's a required field.
8549    #[serde(rename = "whenUnsatisfiable")]
8550    pub when_unsatisfiable: String,
8551}
8552
8553/// LabelSelector is used to find matching pods.
8554/// Pods that match this label selector are counted to determine the number of pods
8555/// in their corresponding topology domain.
8556#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8557#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8558#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8559pub struct ClusterTopologySpreadConstraintsLabelSelector {
8560    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
8561    #[serde(
8562        default,
8563        skip_serializing_if = "Option::is_none",
8564        rename = "matchExpressions"
8565    )]
8566    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8567    pub match_expressions:
8568        Option<Vec<ClusterTopologySpreadConstraintsLabelSelectorMatchExpressions>>,
8569    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
8570    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
8571    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
8572    #[serde(
8573        default,
8574        skip_serializing_if = "Option::is_none",
8575        rename = "matchLabels"
8576    )]
8577    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8578    pub match_labels: Option<BTreeMap<String, String>>,
8579}
8580
8581/// A label selector requirement is a selector that contains values, a key, and an operator that
8582/// relates the key and values.
8583#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8584#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8585#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8586pub struct ClusterTopologySpreadConstraintsLabelSelectorMatchExpressions {
8587    /// key is the label key that the selector applies to.
8588    pub key: String,
8589    /// operator represents a key's relationship to a set of values.
8590    /// Valid operators are In, NotIn, Exists and DoesNotExist.
8591    pub operator: String,
8592    /// values is an array of string values. If the operator is In or NotIn,
8593    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
8594    /// the values array must be empty. This array is replaced during a strategic
8595    /// merge patch.
8596    #[serde(default, skip_serializing_if = "Option::is_none")]
8597    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8598    pub values: Option<Vec<String>>,
8599}
8600
8601/// Configuration of the storage for PostgreSQL WAL (Write-Ahead Log)
8602#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8603#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8604#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8605pub struct ClusterWalStorage {
8606    /// Template to be used to generate the Persistent Volume Claim
8607    #[serde(
8608        default,
8609        skip_serializing_if = "Option::is_none",
8610        rename = "pvcTemplate"
8611    )]
8612    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8613    pub pvc_template: Option<ClusterWalStoragePvcTemplate>,
8614    /// Resize existent PVCs, defaults to true
8615    #[serde(
8616        default,
8617        skip_serializing_if = "Option::is_none",
8618        rename = "resizeInUseVolumes"
8619    )]
8620    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8621    pub resize_in_use_volumes: Option<bool>,
8622    /// Size of the storage. Required if not already specified in the PVC template.
8623    /// Changes to this field are automatically reapplied to the created PVCs.
8624    /// Size cannot be decreased.
8625    #[serde(default, skip_serializing_if = "Option::is_none")]
8626    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8627    pub size: Option<String>,
8628    /// StorageClass to use for PVCs. Applied after
8629    /// evaluating the PVC template, if available.
8630    /// If not specified, the generated PVCs will use the
8631    /// default storage class
8632    #[serde(
8633        default,
8634        skip_serializing_if = "Option::is_none",
8635        rename = "storageClass"
8636    )]
8637    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8638    pub storage_class: Option<String>,
8639}
8640
8641/// Template to be used to generate the Persistent Volume Claim
8642#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8643#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8644#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8645pub struct ClusterWalStoragePvcTemplate {
8646    /// accessModes contains the desired access modes the volume should have.
8647    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1>
8648    #[serde(
8649        default,
8650        skip_serializing_if = "Option::is_none",
8651        rename = "accessModes"
8652    )]
8653    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8654    pub access_modes: Option<Vec<String>>,
8655    /// dataSource field can be used to specify either:
8656    /// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
8657    /// * An existing PVC (PersistentVolumeClaim)
8658    /// If the provisioner or an external controller can support the specified data source,
8659    /// it will create a new volume based on the contents of the specified data source.
8660    /// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
8661    /// copied to dataSource when dataSourceRef.namespace is not specified.
8662    /// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
8663    #[serde(
8664        default,
8665        skip_serializing_if = "Option::is_none",
8666        rename = "dataSource"
8667    )]
8668    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8669    pub data_source: Option<ClusterWalStoragePvcTemplateDataSource>,
8670    /// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
8671    /// volume is desired. This may be any object from a non-empty API group (non
8672    /// core object) or a PersistentVolumeClaim object.
8673    /// When this field is specified, volume binding will only succeed if the type of
8674    /// the specified object matches some installed volume populator or dynamic
8675    /// provisioner.
8676    /// This field will replace the functionality of the dataSource field and as such
8677    /// if both fields are non-empty, they must have the same value. For backwards
8678    /// compatibility, when namespace isn't specified in dataSourceRef,
8679    /// both fields (dataSource and dataSourceRef) will be set to the same
8680    /// value automatically if one of them is empty and the other is non-empty.
8681    /// When namespace is specified in dataSourceRef,
8682    /// dataSource isn't set to the same value and must be empty.
8683    /// There are three important differences between dataSource and dataSourceRef:
8684    /// * While dataSource only allows two specific types of objects, dataSourceRef
8685    ///   allows any non-core object, as well as PersistentVolumeClaim objects.
8686    /// * While dataSource ignores disallowed values (dropping them), dataSourceRef
8687    ///   preserves all values, and generates an error if a disallowed value is
8688    ///   specified.
8689    /// * While dataSource only allows local objects, dataSourceRef allows objects
8690    ///   in any namespaces.
8691    /// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8692    #[serde(
8693        default,
8694        skip_serializing_if = "Option::is_none",
8695        rename = "dataSourceRef"
8696    )]
8697    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8698    pub data_source_ref: Option<ClusterWalStoragePvcTemplateDataSourceRef>,
8699    /// resources represents the minimum resources the volume should have.
8700    /// Users are allowed to specify resource requirements
8701    /// that are lower than previous value but must still be higher than capacity recorded in the
8702    /// status field of the claim.
8703    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
8704    #[serde(default, skip_serializing_if = "Option::is_none")]
8705    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8706    pub resources: Option<ClusterWalStoragePvcTemplateResources>,
8707    /// selector is a label query over volumes to consider for binding.
8708    #[serde(default, skip_serializing_if = "Option::is_none")]
8709    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8710    pub selector: Option<ClusterWalStoragePvcTemplateSelector>,
8711    /// storageClassName is the name of the StorageClass required by the claim.
8712    /// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1>
8713    #[serde(
8714        default,
8715        skip_serializing_if = "Option::is_none",
8716        rename = "storageClassName"
8717    )]
8718    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8719    pub storage_class_name: Option<String>,
8720    /// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
8721    /// If specified, the CSI driver will create or update the volume with the attributes defined
8722    /// in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName,
8723    /// it can be changed after the claim is created. An empty string or nil value indicates that no
8724    /// VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state,
8725    /// this field can be reset to its previous value (including nil) to cancel the modification.
8726    /// If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be
8727    /// set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource
8728    /// exists.
8729    /// More info: <https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/>
8730    #[serde(
8731        default,
8732        skip_serializing_if = "Option::is_none",
8733        rename = "volumeAttributesClassName"
8734    )]
8735    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8736    pub volume_attributes_class_name: Option<String>,
8737    /// volumeMode defines what type of volume is required by the claim.
8738    /// Value of Filesystem is implied when not included in claim spec.
8739    #[serde(
8740        default,
8741        skip_serializing_if = "Option::is_none",
8742        rename = "volumeMode"
8743    )]
8744    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8745    pub volume_mode: Option<String>,
8746    /// volumeName is the binding reference to the PersistentVolume backing this claim.
8747    #[serde(
8748        default,
8749        skip_serializing_if = "Option::is_none",
8750        rename = "volumeName"
8751    )]
8752    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8753    pub volume_name: Option<String>,
8754}
8755
8756/// dataSource field can be used to specify either:
8757/// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
8758/// * An existing PVC (PersistentVolumeClaim)
8759/// If the provisioner or an external controller can support the specified data source,
8760/// it will create a new volume based on the contents of the specified data source.
8761/// dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be
8762/// copied to dataSource when dataSourceRef.namespace is not specified.
8763/// If the namespace is specified, then dataSourceRef will not be copied to dataSource.
8764#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8765#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8766#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8767pub struct ClusterWalStoragePvcTemplateDataSource {
8768    /// APIGroup is the group for the resource being referenced.
8769    /// If APIGroup is not specified, the specified Kind must be in the core API group.
8770    /// For any other third-party types, APIGroup is required.
8771    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
8772    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8773    pub api_group: Option<String>,
8774    /// Kind is the type of resource being referenced
8775    pub kind: String,
8776    /// Name is the name of resource being referenced
8777    pub name: String,
8778}
8779
8780/// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty
8781/// volume is desired. This may be any object from a non-empty API group (non
8782/// core object) or a PersistentVolumeClaim object.
8783/// When this field is specified, volume binding will only succeed if the type of
8784/// the specified object matches some installed volume populator or dynamic
8785/// provisioner.
8786/// This field will replace the functionality of the dataSource field and as such
8787/// if both fields are non-empty, they must have the same value. For backwards
8788/// compatibility, when namespace isn't specified in dataSourceRef,
8789/// both fields (dataSource and dataSourceRef) will be set to the same
8790/// value automatically if one of them is empty and the other is non-empty.
8791/// When namespace is specified in dataSourceRef,
8792/// dataSource isn't set to the same value and must be empty.
8793/// There are three important differences between dataSource and dataSourceRef:
8794/// * While dataSource only allows two specific types of objects, dataSourceRef
8795///   allows any non-core object, as well as PersistentVolumeClaim objects.
8796/// * While dataSource ignores disallowed values (dropping them), dataSourceRef
8797///   preserves all values, and generates an error if a disallowed value is
8798///   specified.
8799/// * While dataSource only allows local objects, dataSourceRef allows objects
8800///   in any namespaces.
8801/// (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8802#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8803#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8804#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8805pub struct ClusterWalStoragePvcTemplateDataSourceRef {
8806    /// APIGroup is the group for the resource being referenced.
8807    /// If APIGroup is not specified, the specified Kind must be in the core API group.
8808    /// For any other third-party types, APIGroup is required.
8809    #[serde(default, skip_serializing_if = "Option::is_none", rename = "apiGroup")]
8810    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8811    pub api_group: Option<String>,
8812    /// Kind is the type of resource being referenced
8813    pub kind: String,
8814    /// Name is the name of resource being referenced
8815    pub name: String,
8816    /// Namespace is the namespace of resource being referenced
8817    /// Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details.
8818    /// (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.
8819    #[serde(default, skip_serializing_if = "Option::is_none")]
8820    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8821    pub namespace: Option<String>,
8822}
8823
8824/// resources represents the minimum resources the volume should have.
8825/// Users are allowed to specify resource requirements
8826/// that are lower than previous value but must still be higher than capacity recorded in the
8827/// status field of the claim.
8828/// More info: <https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources>
8829#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8830#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8831#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8832pub struct ClusterWalStoragePvcTemplateResources {
8833    /// Limits describes the maximum amount of compute resources allowed.
8834    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8835    #[serde(default, skip_serializing_if = "Option::is_none")]
8836    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8837    pub limits: Option<BTreeMap<String, IntOrString>>,
8838    /// Requests describes the minimum amount of compute resources required.
8839    /// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
8840    /// otherwise to an implementation-defined value. Requests cannot exceed Limits.
8841    /// More info: <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>
8842    #[serde(default, skip_serializing_if = "Option::is_none")]
8843    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8844    pub requests: Option<BTreeMap<String, IntOrString>>,
8845}
8846
8847/// selector is a label query over volumes to consider for binding.
8848#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8849#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8850#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8851pub struct ClusterWalStoragePvcTemplateSelector {
8852    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
8853    #[serde(
8854        default,
8855        skip_serializing_if = "Option::is_none",
8856        rename = "matchExpressions"
8857    )]
8858    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8859    pub match_expressions: Option<Vec<ClusterWalStoragePvcTemplateSelectorMatchExpressions>>,
8860    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
8861    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
8862    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
8863    #[serde(
8864        default,
8865        skip_serializing_if = "Option::is_none",
8866        rename = "matchLabels"
8867    )]
8868    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8869    pub match_labels: Option<BTreeMap<String, String>>,
8870}
8871
8872/// A label selector requirement is a selector that contains values, a key, and an operator that
8873/// relates the key and values.
8874#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8875#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8876#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8877pub struct ClusterWalStoragePvcTemplateSelectorMatchExpressions {
8878    /// key is the label key that the selector applies to.
8879    pub key: String,
8880    /// operator represents a key's relationship to a set of values.
8881    /// Valid operators are In, NotIn, Exists and DoesNotExist.
8882    pub operator: String,
8883    /// values is an array of string values. If the operator is In or NotIn,
8884    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
8885    /// the values array must be empty. This array is replaced during a strategic
8886    /// merge patch.
8887    #[serde(default, skip_serializing_if = "Option::is_none")]
8888    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8889    pub values: Option<Vec<String>>,
8890}
8891
8892/// Most recently observed status of the cluster. This data may not be up
8893/// to date. Populated by the system. Read-only.
8894/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
8895#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
8896#[cfg_attr(feature = "builder", derive(TypedBuilder))]
8897#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8898pub struct ClusterStatus {
8899    /// AvailableArchitectures reports the available architectures of a cluster
8900    #[serde(
8901        default,
8902        skip_serializing_if = "Option::is_none",
8903        rename = "availableArchitectures"
8904    )]
8905    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8906    pub available_architectures: Option<Vec<ClusterStatusAvailableArchitectures>>,
8907    /// The configuration for the CA and related certificates, initialized with defaults.
8908    #[serde(default, skip_serializing_if = "Option::is_none")]
8909    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8910    pub certificates: Option<ClusterStatusCertificates>,
8911    /// The commit hash number of which this operator running
8912    #[serde(
8913        default,
8914        skip_serializing_if = "Option::is_none",
8915        rename = "cloudNativePGCommitHash"
8916    )]
8917    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8918    pub cloud_native_pg_commit_hash: Option<String>,
8919    /// The hash of the binary of the operator
8920    #[serde(
8921        default,
8922        skip_serializing_if = "Option::is_none",
8923        rename = "cloudNativePGOperatorHash"
8924    )]
8925    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8926    pub cloud_native_pg_operator_hash: Option<String>,
8927    /// Conditions for cluster object
8928    #[serde(default, skip_serializing_if = "Option::is_none")]
8929    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8930    pub conditions: Option<Vec<Condition>>,
8931    /// The list of resource versions of the configmaps,
8932    /// managed by the operator. Every change here is done in the
8933    /// interest of the instance manager, which will refresh the
8934    /// configmap data
8935    #[serde(
8936        default,
8937        skip_serializing_if = "Option::is_none",
8938        rename = "configMapResourceVersion"
8939    )]
8940    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8941    pub config_map_resource_version: Option<ClusterStatusConfigMapResourceVersion>,
8942    /// Current primary instance
8943    #[serde(
8944        default,
8945        skip_serializing_if = "Option::is_none",
8946        rename = "currentPrimary"
8947    )]
8948    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8949    pub current_primary: Option<String>,
8950    /// The timestamp when the primary was detected to be unhealthy
8951    /// This field is reported when `.spec.failoverDelay` is populated or during online upgrades
8952    #[serde(
8953        default,
8954        skip_serializing_if = "Option::is_none",
8955        rename = "currentPrimaryFailingSinceTimestamp"
8956    )]
8957    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8958    pub current_primary_failing_since_timestamp: Option<String>,
8959    /// The timestamp when the last actual promotion to primary has occurred
8960    #[serde(
8961        default,
8962        skip_serializing_if = "Option::is_none",
8963        rename = "currentPrimaryTimestamp"
8964    )]
8965    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8966    pub current_primary_timestamp: Option<String>,
8967    /// List of all the PVCs created by this cluster and still available
8968    /// which are not attached to a Pod
8969    #[serde(
8970        default,
8971        skip_serializing_if = "Option::is_none",
8972        rename = "danglingPVC"
8973    )]
8974    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8975    pub dangling_pvc: Option<Vec<String>>,
8976    /// DemotionToken is a JSON token containing the information
8977    /// from pg_controldata such as Database system identifier, Latest checkpoint's
8978    /// TimeLineID, Latest checkpoint's REDO location, Latest checkpoint's REDO
8979    /// WAL file, and Time of latest checkpoint
8980    #[serde(
8981        default,
8982        skip_serializing_if = "Option::is_none",
8983        rename = "demotionToken"
8984    )]
8985    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8986    pub demotion_token: Option<String>,
8987    /// The first recoverability point, stored as a date in RFC3339 format.
8988    /// This field is calculated from the content of FirstRecoverabilityPointByMethod.
8989    ///
8990    /// Deprecated: the field is not set for backup plugins.
8991    #[serde(
8992        default,
8993        skip_serializing_if = "Option::is_none",
8994        rename = "firstRecoverabilityPoint"
8995    )]
8996    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
8997    pub first_recoverability_point: Option<String>,
8998    /// The first recoverability point, stored as a date in RFC3339 format, per backup method type.
8999    ///
9000    /// Deprecated: the field is not set for backup plugins.
9001    #[serde(
9002        default,
9003        skip_serializing_if = "Option::is_none",
9004        rename = "firstRecoverabilityPointByMethod"
9005    )]
9006    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9007    pub first_recoverability_point_by_method: Option<BTreeMap<String, String>>,
9008    /// List of all the PVCs not dangling nor initializing
9009    #[serde(
9010        default,
9011        skip_serializing_if = "Option::is_none",
9012        rename = "healthyPVC"
9013    )]
9014    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9015    pub healthy_pvc: Option<Vec<String>>,
9016    /// Image contains the image name used by the pods
9017    #[serde(default, skip_serializing_if = "Option::is_none")]
9018    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9019    pub image: Option<String>,
9020    /// List of all the PVCs that are being initialized by this cluster
9021    #[serde(
9022        default,
9023        skip_serializing_if = "Option::is_none",
9024        rename = "initializingPVC"
9025    )]
9026    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9027    pub initializing_pvc: Option<Vec<String>>,
9028    /// List of instance names in the cluster
9029    #[serde(
9030        default,
9031        skip_serializing_if = "Option::is_none",
9032        rename = "instanceNames"
9033    )]
9034    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9035    pub instance_names: Option<Vec<String>>,
9036    /// The total number of PVC Groups detected in the cluster. It may differ from the number of existing instance pods.
9037    #[serde(default, skip_serializing_if = "Option::is_none")]
9038    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9039    pub instances: Option<i64>,
9040    /// The reported state of the instances during the last reconciliation loop
9041    #[serde(
9042        default,
9043        skip_serializing_if = "Option::is_none",
9044        rename = "instancesReportedState"
9045    )]
9046    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9047    pub instances_reported_state: Option<BTreeMap<String, ClusterStatusInstancesReportedState>>,
9048    /// InstancesStatus indicates in which status the instances are
9049    #[serde(
9050        default,
9051        skip_serializing_if = "Option::is_none",
9052        rename = "instancesStatus"
9053    )]
9054    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9055    pub instances_status: Option<BTreeMap<String, Vec<String>>>,
9056    /// How many Jobs have been created by this cluster
9057    #[serde(default, skip_serializing_if = "Option::is_none", rename = "jobCount")]
9058    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9059    pub job_count: Option<i32>,
9060    /// Last failed backup, stored as a date in RFC3339 format.
9061    ///
9062    /// Deprecated: the field is not set for backup plugins.
9063    #[serde(
9064        default,
9065        skip_serializing_if = "Option::is_none",
9066        rename = "lastFailedBackup"
9067    )]
9068    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9069    pub last_failed_backup: Option<String>,
9070    /// LastPromotionToken is the last verified promotion token that
9071    /// was used to promote a replica cluster
9072    #[serde(
9073        default,
9074        skip_serializing_if = "Option::is_none",
9075        rename = "lastPromotionToken"
9076    )]
9077    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9078    pub last_promotion_token: Option<String>,
9079    /// Last successful backup, stored as a date in RFC3339 format.
9080    /// This field is calculated from the content of LastSuccessfulBackupByMethod.
9081    ///
9082    /// Deprecated: the field is not set for backup plugins.
9083    #[serde(
9084        default,
9085        skip_serializing_if = "Option::is_none",
9086        rename = "lastSuccessfulBackup"
9087    )]
9088    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9089    pub last_successful_backup: Option<String>,
9090    /// Last successful backup, stored as a date in RFC3339 format, per backup method type.
9091    ///
9092    /// Deprecated: the field is not set for backup plugins.
9093    #[serde(
9094        default,
9095        skip_serializing_if = "Option::is_none",
9096        rename = "lastSuccessfulBackupByMethod"
9097    )]
9098    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9099    pub last_successful_backup_by_method: Option<BTreeMap<String, String>>,
9100    /// ID of the latest generated node (used to avoid node name clashing)
9101    ///
9102    /// Deprecated: this field is not set anymore
9103    #[serde(
9104        default,
9105        skip_serializing_if = "Option::is_none",
9106        rename = "latestGeneratedNode"
9107    )]
9108    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9109    pub latest_generated_node: Option<i64>,
9110    /// ManagedRolesStatus reports the state of the managed roles in the cluster
9111    #[serde(
9112        default,
9113        skip_serializing_if = "Option::is_none",
9114        rename = "managedRolesStatus"
9115    )]
9116    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9117    pub managed_roles_status: Option<ClusterStatusManagedRolesStatus>,
9118    /// OnlineUpdateEnabled shows if the online upgrade is enabled inside the cluster
9119    #[serde(
9120        default,
9121        skip_serializing_if = "Option::is_none",
9122        rename = "onlineUpdateEnabled"
9123    )]
9124    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9125    pub online_update_enabled: Option<bool>,
9126    /// OperatorCertificateFingerprint is the SHA256 fingerprint of the operator's
9127    /// in-memory client certificate public key. The instance manager pins this
9128    /// fingerprint to authenticate requests from the operator.
9129    #[serde(
9130        default,
9131        skip_serializing_if = "Option::is_none",
9132        rename = "operatorCertificateFingerprint"
9133    )]
9134    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9135    pub operator_certificate_fingerprint: Option<String>,
9136    /// PGDataImageInfo contains the details of the latest image that has run on the current data directory.
9137    #[serde(
9138        default,
9139        skip_serializing_if = "Option::is_none",
9140        rename = "pgDataImageInfo"
9141    )]
9142    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9143    pub pg_data_image_info: Option<ClusterStatusPgDataImageInfo>,
9144    /// Current phase of the cluster
9145    #[serde(default, skip_serializing_if = "Option::is_none")]
9146    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9147    pub phase: Option<String>,
9148    /// Reason for the current phase
9149    #[serde(
9150        default,
9151        skip_serializing_if = "Option::is_none",
9152        rename = "phaseReason"
9153    )]
9154    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9155    pub phase_reason: Option<String>,
9156    /// PluginStatus is the status of the loaded plugins
9157    #[serde(
9158        default,
9159        skip_serializing_if = "Option::is_none",
9160        rename = "pluginStatus"
9161    )]
9162    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9163    pub plugin_status: Option<Vec<ClusterStatusPluginStatus>>,
9164    /// PodSelectorRefs contains the resolved pod IPs for each named selector
9165    /// defined in spec.podSelectorRefs.
9166    #[serde(
9167        default,
9168        skip_serializing_if = "Option::is_none",
9169        rename = "podSelectorRefs"
9170    )]
9171    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9172    pub pod_selector_refs: Option<Vec<ClusterStatusPodSelectorRefs>>,
9173    /// The integration needed by poolers referencing the cluster
9174    #[serde(
9175        default,
9176        skip_serializing_if = "Option::is_none",
9177        rename = "poolerIntegrations"
9178    )]
9179    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9180    pub pooler_integrations: Option<ClusterStatusPoolerIntegrations>,
9181    /// How many PVCs have been created by this cluster
9182    #[serde(default, skip_serializing_if = "Option::is_none", rename = "pvcCount")]
9183    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9184    pub pvc_count: Option<i32>,
9185    /// Current list of read pods
9186    #[serde(
9187        default,
9188        skip_serializing_if = "Option::is_none",
9189        rename = "readService"
9190    )]
9191    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9192    pub read_service: Option<String>,
9193    /// The total number of ready instances in the cluster. It is equal to the number of ready instance pods.
9194    #[serde(
9195        default,
9196        skip_serializing_if = "Option::is_none",
9197        rename = "readyInstances"
9198    )]
9199    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9200    pub ready_instances: Option<i64>,
9201    /// List of all the PVCs that have ResizingPVC condition.
9202    #[serde(
9203        default,
9204        skip_serializing_if = "Option::is_none",
9205        rename = "resizingPVC"
9206    )]
9207    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9208    pub resizing_pvc: Option<Vec<String>>,
9209    /// The list of resource versions of the secrets
9210    /// managed by the operator. Every change here is done in the
9211    /// interest of the instance manager, which will refresh the
9212    /// secret data
9213    #[serde(
9214        default,
9215        skip_serializing_if = "Option::is_none",
9216        rename = "secretsResourceVersion"
9217    )]
9218    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9219    pub secrets_resource_version: Option<ClusterStatusSecretsResourceVersion>,
9220    /// Selector is the serialized form of the label selector that identifies
9221    /// the pods managed by this cluster. Populated by the operator and exposed
9222    /// through the scale sub-resource so an autoscaler (such as HPA or VPA)
9223    /// can discover the managed instance pods.
9224    #[serde(default, skip_serializing_if = "Option::is_none")]
9225    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9226    pub selector: Option<String>,
9227    /// SwitchReplicaClusterStatus is the status of the switch to replica cluster
9228    #[serde(
9229        default,
9230        skip_serializing_if = "Option::is_none",
9231        rename = "switchReplicaClusterStatus"
9232    )]
9233    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9234    pub switch_replica_cluster_status: Option<ClusterStatusSwitchReplicaClusterStatus>,
9235    /// SystemID is the latest detected PostgreSQL SystemID
9236    #[serde(default, skip_serializing_if = "Option::is_none", rename = "systemID")]
9237    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9238    pub system_id: Option<String>,
9239    /// TablespacesStatus reports the state of the declarative tablespaces in the cluster
9240    #[serde(
9241        default,
9242        skip_serializing_if = "Option::is_none",
9243        rename = "tablespacesStatus"
9244    )]
9245    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9246    pub tablespaces_status: Option<Vec<ClusterStatusTablespacesStatus>>,
9247    /// TargetPGDataImageInfo contains the details of the target image for an
9248    /// in-progress major upgrade. It is set before the upgrade Job is created,
9249    /// and cleared on successful completion or when the upgrade is rolled back.
9250    #[serde(
9251        default,
9252        skip_serializing_if = "Option::is_none",
9253        rename = "targetPgDataImageInfo"
9254    )]
9255    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9256    pub target_pg_data_image_info: Option<ClusterStatusTargetPgDataImageInfo>,
9257    /// Target primary instance, this is different from the previous one
9258    /// during a switchover or a failover
9259    #[serde(
9260        default,
9261        skip_serializing_if = "Option::is_none",
9262        rename = "targetPrimary"
9263    )]
9264    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9265    pub target_primary: Option<String>,
9266    /// The timestamp when the last request for a new primary has occurred
9267    #[serde(
9268        default,
9269        skip_serializing_if = "Option::is_none",
9270        rename = "targetPrimaryTimestamp"
9271    )]
9272    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9273    pub target_primary_timestamp: Option<String>,
9274    /// The timeline of the Postgres cluster
9275    #[serde(
9276        default,
9277        skip_serializing_if = "Option::is_none",
9278        rename = "timelineID"
9279    )]
9280    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9281    pub timeline_id: Option<i64>,
9282    /// Instances topology.
9283    #[serde(default, skip_serializing_if = "Option::is_none")]
9284    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9285    pub topology: Option<ClusterStatusTopology>,
9286    /// List of all the PVCs that are unusable because another PVC is missing
9287    #[serde(
9288        default,
9289        skip_serializing_if = "Option::is_none",
9290        rename = "unusablePVC"
9291    )]
9292    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9293    pub unusable_pvc: Option<Vec<String>>,
9294    /// Current write pod
9295    #[serde(
9296        default,
9297        skip_serializing_if = "Option::is_none",
9298        rename = "writeService"
9299    )]
9300    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9301    pub write_service: Option<String>,
9302}
9303
9304/// AvailableArchitecture represents the state of a cluster's architecture
9305#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9306#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9307#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9308pub struct ClusterStatusAvailableArchitectures {
9309    /// GoArch is the name of the executable architecture
9310    #[serde(rename = "goArch")]
9311    pub go_arch: String,
9312    /// Hash is the hash of the executable
9313    pub hash: String,
9314}
9315
9316/// The configuration for the CA and related certificates, initialized with defaults.
9317#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9318#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9319#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9320pub struct ClusterStatusCertificates {
9321    /// The secret containing the Client CA certificate. If not defined, a new secret will be created
9322    /// with a self-signed CA and will be used to generate all the client certificates.<br />
9323    /// <br />
9324    /// Contains:<br />
9325    /// <br />
9326    /// - `ca.crt`: CA that should be used to validate the client certificates,
9327    /// used as `ssl_ca_file` of all the instances.<br />
9328    /// - `ca.key`: key used to generate client certificates, if ReplicationTLSSecret is provided,
9329    /// this can be omitted.<br />
9330    #[serde(
9331        default,
9332        skip_serializing_if = "Option::is_none",
9333        rename = "clientCASecret"
9334    )]
9335    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9336    pub client_ca_secret: Option<String>,
9337    /// Expiration dates for all certificates.
9338    #[serde(default, skip_serializing_if = "Option::is_none")]
9339    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9340    pub expirations: Option<BTreeMap<String, String>>,
9341    /// The secret of type kubernetes.io/tls containing the client certificate to authenticate as
9342    /// the `streaming_replica` user.
9343    /// If not defined, ClientCASecret must provide also `ca.key`, and a new secret will be
9344    /// created using the provided CA.
9345    #[serde(
9346        default,
9347        skip_serializing_if = "Option::is_none",
9348        rename = "replicationTLSSecret"
9349    )]
9350    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9351    pub replication_tls_secret: Option<String>,
9352    /// The list of the server alternative DNS names to be added to the generated server TLS certificates, when required.
9353    #[serde(
9354        default,
9355        skip_serializing_if = "Option::is_none",
9356        rename = "serverAltDNSNames"
9357    )]
9358    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9359    pub server_alt_dns_names: Option<Vec<String>>,
9360    /// The secret containing the Server CA certificate. If not defined, a new secret will be created
9361    /// with a self-signed CA and will be used to generate the TLS certificate ServerTLSSecret.<br />
9362    /// <br />
9363    /// Contains:<br />
9364    /// <br />
9365    /// - `ca.crt`: CA that should be used to validate the server certificate,
9366    /// used as `sslrootcert` in client connection strings.<br />
9367    /// - `ca.key`: key used to generate Server SSL certs, if ServerTLSSecret is provided,
9368    /// this can be omitted.<br />
9369    #[serde(
9370        default,
9371        skip_serializing_if = "Option::is_none",
9372        rename = "serverCASecret"
9373    )]
9374    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9375    pub server_ca_secret: Option<String>,
9376    /// The secret of type kubernetes.io/tls containing the server TLS certificate and key that will be set as
9377    /// `ssl_cert_file` and `ssl_key_file` so that clients can connect to postgres securely.
9378    /// If not defined, ServerCASecret must provide also `ca.key` and a new secret will be
9379    /// created using the provided CA.
9380    #[serde(
9381        default,
9382        skip_serializing_if = "Option::is_none",
9383        rename = "serverTLSSecret"
9384    )]
9385    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9386    pub server_tls_secret: Option<String>,
9387}
9388
9389/// The list of resource versions of the configmaps,
9390/// managed by the operator. Every change here is done in the
9391/// interest of the instance manager, which will refresh the
9392/// configmap data
9393#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9394#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9395#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9396pub struct ClusterStatusConfigMapResourceVersion {
9397    /// A map with the versions of all the config maps used to pass metrics.
9398    /// Map keys are the config map names, map values are the versions
9399    #[serde(default, skip_serializing_if = "Option::is_none")]
9400    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9401    pub metrics: Option<BTreeMap<String, String>>,
9402}
9403
9404/// The reported state of the instances during the last reconciliation loop
9405#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9406#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9407#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9408pub struct ClusterStatusInstancesReportedState {
9409    /// IP address of the instance
9410    #[serde(default, skip_serializing_if = "Option::is_none")]
9411    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9412    pub ip: Option<String>,
9413    /// indicates if an instance is the primary one
9414    #[serde(default, skip_serializing_if = "Option::is_none", rename = "isPrimary")]
9415    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9416    pub is_primary: Option<bool>,
9417    /// indicates on which TimelineId the instance is
9418    #[serde(
9419        default,
9420        skip_serializing_if = "Option::is_none",
9421        rename = "timeLineID"
9422    )]
9423    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9424    pub time_line_id: Option<i64>,
9425}
9426
9427/// ManagedRolesStatus reports the state of the managed roles in the cluster
9428#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9429#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9430#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9431pub struct ClusterStatusManagedRolesStatus {
9432    /// ByStatus gives the list of roles in each state
9433    #[serde(default, skip_serializing_if = "Option::is_none", rename = "byStatus")]
9434    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9435    pub by_status: Option<BTreeMap<String, Vec<String>>>,
9436    /// CannotReconcile lists roles that cannot be reconciled, with an
9437    /// explanation of the cause. Failures may originate in PostgreSQL
9438    /// (e.g. dropping a role that owns objects) or in Kubernetes (e.g.
9439    /// the referenced password Secret cannot be fetched).
9440    #[serde(
9441        default,
9442        skip_serializing_if = "Option::is_none",
9443        rename = "cannotReconcile"
9444    )]
9445    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9446    pub cannot_reconcile: Option<BTreeMap<String, Vec<String>>>,
9447    /// PasswordStatus gives the last transaction id and password secret version for each managed role
9448    #[serde(
9449        default,
9450        skip_serializing_if = "Option::is_none",
9451        rename = "passwordStatus"
9452    )]
9453    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9454    pub password_status: Option<BTreeMap<String, ClusterStatusManagedRolesStatusPasswordStatus>>,
9455}
9456
9457/// PasswordStatus gives the last transaction id and password secret version for each managed role
9458#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9459#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9460#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9461pub struct ClusterStatusManagedRolesStatusPasswordStatus {
9462    /// the resource version of the password secret
9463    #[serde(
9464        default,
9465        skip_serializing_if = "Option::is_none",
9466        rename = "resourceVersion"
9467    )]
9468    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9469    pub resource_version: Option<String>,
9470    /// the last transaction ID to affect the role definition in PostgreSQL
9471    #[serde(
9472        default,
9473        skip_serializing_if = "Option::is_none",
9474        rename = "transactionID"
9475    )]
9476    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9477    pub transaction_id: Option<i64>,
9478}
9479
9480/// PGDataImageInfo contains the details of the latest image that has run on the current data directory.
9481#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9482#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9483#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9484pub struct ClusterStatusPgDataImageInfo {
9485    /// Extensions contains the container image extensions available for the current Image
9486    #[serde(default, skip_serializing_if = "Option::is_none")]
9487    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9488    pub extensions: Option<Vec<ClusterStatusPgDataImageInfoExtensions>>,
9489    /// Image is the image name
9490    pub image: String,
9491    /// MajorVersion is the major version of the image
9492    #[serde(rename = "majorVersion")]
9493    pub major_version: i64,
9494}
9495
9496/// ExtensionConfiguration is the configuration used to add
9497/// PostgreSQL extensions to the Cluster.
9498#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9499#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9500#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9501pub struct ClusterStatusPgDataImageInfoExtensions {
9502    /// A list of directories within the image to be appended to the
9503    /// PostgreSQL process's `PATH` environment variable.
9504    #[serde(default, skip_serializing_if = "Option::is_none")]
9505    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9506    pub bin_path: Option<Vec<String>>,
9507    /// The list of directories inside the image which should be added to dynamic_library_path.
9508    /// If not defined, defaults to "/lib".
9509    #[serde(default, skip_serializing_if = "Option::is_none")]
9510    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9511    pub dynamic_library_path: Option<Vec<String>>,
9512    /// Env is a list of custom environment variables to be set in the
9513    /// PostgreSQL process for this extension. It is the responsibility of the
9514    /// cluster administrator to ensure the variables are correct for the
9515    /// specific extension. Note that changes to these variables require
9516    /// a manual cluster restart to take effect.
9517    #[serde(default, skip_serializing_if = "Option::is_none")]
9518    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9519    pub env: Option<Vec<ClusterStatusPgDataImageInfoExtensionsEnv>>,
9520    /// The list of directories inside the image which should be added to extension_control_path.
9521    /// If not defined, defaults to "/share".
9522    #[serde(default, skip_serializing_if = "Option::is_none")]
9523    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9524    pub extension_control_path: Option<Vec<String>>,
9525    /// The image containing the extension.
9526    #[serde(default, skip_serializing_if = "Option::is_none")]
9527    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9528    pub image: Option<ClusterStatusPgDataImageInfoExtensionsImage>,
9529    /// The list of directories inside the image which should be added to ld_library_path.
9530    #[serde(default, skip_serializing_if = "Option::is_none")]
9531    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9532    pub ld_library_path: Option<Vec<String>>,
9533    /// The name of the extension, required. The limit of 59 characters
9534    /// leaves room for the prefix the operator adds when deriving the
9535    /// extension's Kubernetes Volume name (capped at 63 characters).
9536    pub name: String,
9537}
9538
9539/// ExtensionEnvVar defines an environment variable for a specific extension
9540/// image volume.
9541#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9542#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9543#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9544pub struct ClusterStatusPgDataImageInfoExtensionsEnv {
9545    /// Name of the environment variable to be injected into the
9546    /// PostgreSQL process.
9547    pub name: String,
9548    /// Value of the environment variable. CloudNativePG performs a direct
9549    /// replacement of this value, with support for placeholder expansion.
9550    /// The ${`image_root`} placeholder resolves to the absolute mount path
9551    /// of the extension's volume (e.g., `/extensions/my-extension`). This
9552    /// is particularly useful for allowing applications or libraries to
9553    /// locate specific directories within the mounted image.
9554    /// Unrecognized placeholders are rejected. To include a literal ${...}
9555    /// in the value, escape it as $${...}.
9556    pub value: String,
9557}
9558
9559/// The image containing the extension.
9560#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9561#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9562#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9563pub struct ClusterStatusPgDataImageInfoExtensionsImage {
9564    /// Policy for pulling OCI objects. Possible values are:
9565    /// Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails.
9566    /// Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present.
9567    /// IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.
9568    /// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
9569    #[serde(
9570        default,
9571        skip_serializing_if = "Option::is_none",
9572        rename = "pullPolicy"
9573    )]
9574    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9575    pub pull_policy: Option<String>,
9576    /// Required: Image or artifact reference to be used.
9577    /// Behaves in the same way as pod.spec.containers[*].image.
9578    /// Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets.
9579    /// More info: <https://kubernetes.io/docs/concepts/containers/images>
9580    /// This field is optional to allow higher level config management to default or override
9581    /// container images in workload controllers like Deployments and StatefulSets.
9582    #[serde(default, skip_serializing_if = "Option::is_none")]
9583    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9584    pub reference: Option<String>,
9585}
9586
9587/// PluginStatus is the status of a loaded plugin
9588#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9589#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9590#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9591pub struct ClusterStatusPluginStatus {
9592    /// BackupCapabilities are the list of capabilities of the
9593    /// plugin regarding the Backup management
9594    #[serde(
9595        default,
9596        skip_serializing_if = "Option::is_none",
9597        rename = "backupCapabilities"
9598    )]
9599    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9600    pub backup_capabilities: Option<Vec<String>>,
9601    /// Capabilities are the list of capabilities of the
9602    /// plugin
9603    #[serde(default, skip_serializing_if = "Option::is_none")]
9604    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9605    pub capabilities: Option<Vec<String>>,
9606    /// Name is the name of the plugin
9607    pub name: String,
9608    /// OperatorCapabilities are the list of capabilities of the
9609    /// plugin regarding the reconciler
9610    #[serde(
9611        default,
9612        skip_serializing_if = "Option::is_none",
9613        rename = "operatorCapabilities"
9614    )]
9615    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9616    pub operator_capabilities: Option<Vec<String>>,
9617    /// PostgresCapabilities are the list of capabilities of the
9618    /// plugin regarding the PostgreSQL configuration
9619    #[serde(
9620        default,
9621        skip_serializing_if = "Option::is_none",
9622        rename = "postgresCapabilities"
9623    )]
9624    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9625    pub postgres_capabilities: Option<Vec<String>>,
9626    /// RestoreJobHookCapabilities are the list of capabilities of the
9627    /// plugin regarding the RestoreJobHook management
9628    #[serde(
9629        default,
9630        skip_serializing_if = "Option::is_none",
9631        rename = "restoreJobHookCapabilities"
9632    )]
9633    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9634    pub restore_job_hook_capabilities: Option<Vec<String>>,
9635    /// Status contain the status reported by the plugin through the SetStatusInCluster interface
9636    #[serde(default, skip_serializing_if = "Option::is_none")]
9637    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9638    pub status: Option<String>,
9639    /// Version is the version of the plugin loaded by the
9640    /// latest reconciliation loop
9641    pub version: String,
9642    /// WALCapabilities are the list of capabilities of the
9643    /// plugin regarding the WAL management
9644    #[serde(
9645        default,
9646        skip_serializing_if = "Option::is_none",
9647        rename = "walCapabilities"
9648    )]
9649    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9650    pub wal_capabilities: Option<Vec<String>>,
9651}
9652
9653/// PodSelectorRefStatus contains the resolved pod IPs for a named selector.
9654#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9655#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9656#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9657pub struct ClusterStatusPodSelectorRefs {
9658    /// IPs is the list of pod IPs matching the selector.
9659    /// Each IP is a single address (no CIDR notation).
9660    #[serde(default, skip_serializing_if = "Option::is_none")]
9661    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9662    pub ips: Option<Vec<String>>,
9663    /// Name corresponds to the name in the spec's PodSelectorRef.
9664    pub name: String,
9665}
9666
9667/// The integration needed by poolers referencing the cluster
9668#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9669#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9670#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9671pub struct ClusterStatusPoolerIntegrations {
9672    /// PgBouncerIntegrationStatus encapsulates the needed integration for the pgbouncer poolers referencing the cluster
9673    #[serde(
9674        default,
9675        skip_serializing_if = "Option::is_none",
9676        rename = "pgBouncerIntegration"
9677    )]
9678    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9679    pub pg_bouncer_integration: Option<ClusterStatusPoolerIntegrationsPgBouncerIntegration>,
9680}
9681
9682/// PgBouncerIntegrationStatus encapsulates the needed integration for the pgbouncer poolers referencing the cluster
9683#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9684#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9685#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9686pub struct ClusterStatusPoolerIntegrationsPgBouncerIntegration {
9687    #[serde(default, skip_serializing_if = "Option::is_none")]
9688    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9689    pub secrets: Option<Vec<String>>,
9690}
9691
9692/// The list of resource versions of the secrets
9693/// managed by the operator. Every change here is done in the
9694/// interest of the instance manager, which will refresh the
9695/// secret data
9696#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9697#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9698#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9699pub struct ClusterStatusSecretsResourceVersion {
9700    /// The resource version of the "app" user secret
9701    #[serde(
9702        default,
9703        skip_serializing_if = "Option::is_none",
9704        rename = "applicationSecretVersion"
9705    )]
9706    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9707    pub application_secret_version: Option<String>,
9708    /// The resource version of the Barman Endpoint CA if provided
9709    #[serde(
9710        default,
9711        skip_serializing_if = "Option::is_none",
9712        rename = "barmanEndpointCA"
9713    )]
9714    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9715    pub barman_endpoint_ca: Option<String>,
9716    /// Unused. Retained for compatibility with old versions.
9717    #[serde(
9718        default,
9719        skip_serializing_if = "Option::is_none",
9720        rename = "caSecretVersion"
9721    )]
9722    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9723    pub ca_secret_version: Option<String>,
9724    /// The resource version of the PostgreSQL client-side CA secret version
9725    #[serde(
9726        default,
9727        skip_serializing_if = "Option::is_none",
9728        rename = "clientCaSecretVersion"
9729    )]
9730    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9731    pub client_ca_secret_version: Option<String>,
9732    /// The resource versions of the external cluster secrets
9733    #[serde(
9734        default,
9735        skip_serializing_if = "Option::is_none",
9736        rename = "externalClusterSecretVersion"
9737    )]
9738    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9739    pub external_cluster_secret_version: Option<BTreeMap<String, String>>,
9740    /// The resource versions of the managed roles secrets
9741    #[serde(
9742        default,
9743        skip_serializing_if = "Option::is_none",
9744        rename = "managedRoleSecretVersion"
9745    )]
9746    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9747    pub managed_role_secret_version: Option<BTreeMap<String, String>>,
9748    /// A map with the versions of all the secrets used to pass metrics.
9749    /// Map keys are the secret names, map values are the versions
9750    #[serde(default, skip_serializing_if = "Option::is_none")]
9751    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9752    pub metrics: Option<BTreeMap<String, String>>,
9753    /// The resource version of the "streaming_replica" user secret
9754    #[serde(
9755        default,
9756        skip_serializing_if = "Option::is_none",
9757        rename = "replicationSecretVersion"
9758    )]
9759    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9760    pub replication_secret_version: Option<String>,
9761    /// The resource version of the PostgreSQL server-side CA secret version
9762    #[serde(
9763        default,
9764        skip_serializing_if = "Option::is_none",
9765        rename = "serverCaSecretVersion"
9766    )]
9767    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9768    pub server_ca_secret_version: Option<String>,
9769    /// The resource version of the PostgreSQL server-side secret version
9770    #[serde(
9771        default,
9772        skip_serializing_if = "Option::is_none",
9773        rename = "serverSecretVersion"
9774    )]
9775    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9776    pub server_secret_version: Option<String>,
9777    /// The resource version of the "postgres" user secret
9778    #[serde(
9779        default,
9780        skip_serializing_if = "Option::is_none",
9781        rename = "superuserSecretVersion"
9782    )]
9783    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9784    pub superuser_secret_version: Option<String>,
9785}
9786
9787/// SwitchReplicaClusterStatus is the status of the switch to replica cluster
9788#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9789#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9790#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9791pub struct ClusterStatusSwitchReplicaClusterStatus {
9792    /// InProgress indicates if there is an ongoing procedure of switching a cluster to a replica cluster.
9793    #[serde(
9794        default,
9795        skip_serializing_if = "Option::is_none",
9796        rename = "inProgress"
9797    )]
9798    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9799    pub in_progress: Option<bool>,
9800}
9801
9802/// TablespaceState represents the state of a tablespace in a cluster
9803#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9804#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9805#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9806pub struct ClusterStatusTablespacesStatus {
9807    /// Error is the reconciliation error, if any
9808    #[serde(default, skip_serializing_if = "Option::is_none")]
9809    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9810    pub error: Option<String>,
9811    /// Name is the name of the tablespace
9812    pub name: String,
9813    /// Owner is the PostgreSQL user owning the tablespace
9814    #[serde(default, skip_serializing_if = "Option::is_none")]
9815    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9816    pub owner: Option<String>,
9817    /// State is the latest reconciliation state
9818    pub state: String,
9819}
9820
9821/// TargetPGDataImageInfo contains the details of the target image for an
9822/// in-progress major upgrade. It is set before the upgrade Job is created,
9823/// and cleared on successful completion or when the upgrade is rolled back.
9824#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9825#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9826#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9827pub struct ClusterStatusTargetPgDataImageInfo {
9828    /// Extensions contains the container image extensions available for the current Image
9829    #[serde(default, skip_serializing_if = "Option::is_none")]
9830    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9831    pub extensions: Option<Vec<ClusterStatusTargetPgDataImageInfoExtensions>>,
9832    /// Image is the image name
9833    pub image: String,
9834    /// MajorVersion is the major version of the image
9835    #[serde(rename = "majorVersion")]
9836    pub major_version: i64,
9837}
9838
9839/// ExtensionConfiguration is the configuration used to add
9840/// PostgreSQL extensions to the Cluster.
9841#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9842#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9843#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9844pub struct ClusterStatusTargetPgDataImageInfoExtensions {
9845    /// A list of directories within the image to be appended to the
9846    /// PostgreSQL process's `PATH` environment variable.
9847    #[serde(default, skip_serializing_if = "Option::is_none")]
9848    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9849    pub bin_path: Option<Vec<String>>,
9850    /// The list of directories inside the image which should be added to dynamic_library_path.
9851    /// If not defined, defaults to "/lib".
9852    #[serde(default, skip_serializing_if = "Option::is_none")]
9853    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9854    pub dynamic_library_path: Option<Vec<String>>,
9855    /// Env is a list of custom environment variables to be set in the
9856    /// PostgreSQL process for this extension. It is the responsibility of the
9857    /// cluster administrator to ensure the variables are correct for the
9858    /// specific extension. Note that changes to these variables require
9859    /// a manual cluster restart to take effect.
9860    #[serde(default, skip_serializing_if = "Option::is_none")]
9861    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9862    pub env: Option<Vec<ClusterStatusTargetPgDataImageInfoExtensionsEnv>>,
9863    /// The list of directories inside the image which should be added to extension_control_path.
9864    /// If not defined, defaults to "/share".
9865    #[serde(default, skip_serializing_if = "Option::is_none")]
9866    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9867    pub extension_control_path: Option<Vec<String>>,
9868    /// The image containing the extension.
9869    #[serde(default, skip_serializing_if = "Option::is_none")]
9870    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9871    pub image: Option<ClusterStatusTargetPgDataImageInfoExtensionsImage>,
9872    /// The list of directories inside the image which should be added to ld_library_path.
9873    #[serde(default, skip_serializing_if = "Option::is_none")]
9874    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9875    pub ld_library_path: Option<Vec<String>>,
9876    /// The name of the extension, required. The limit of 59 characters
9877    /// leaves room for the prefix the operator adds when deriving the
9878    /// extension's Kubernetes Volume name (capped at 63 characters).
9879    pub name: String,
9880}
9881
9882/// ExtensionEnvVar defines an environment variable for a specific extension
9883/// image volume.
9884#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9885#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9886#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9887pub struct ClusterStatusTargetPgDataImageInfoExtensionsEnv {
9888    /// Name of the environment variable to be injected into the
9889    /// PostgreSQL process.
9890    pub name: String,
9891    /// Value of the environment variable. CloudNativePG performs a direct
9892    /// replacement of this value, with support for placeholder expansion.
9893    /// The ${`image_root`} placeholder resolves to the absolute mount path
9894    /// of the extension's volume (e.g., `/extensions/my-extension`). This
9895    /// is particularly useful for allowing applications or libraries to
9896    /// locate specific directories within the mounted image.
9897    /// Unrecognized placeholders are rejected. To include a literal ${...}
9898    /// in the value, escape it as $${...}.
9899    pub value: String,
9900}
9901
9902/// The image containing the extension.
9903#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9904#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9905#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9906pub struct ClusterStatusTargetPgDataImageInfoExtensionsImage {
9907    /// Policy for pulling OCI objects. Possible values are:
9908    /// Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails.
9909    /// Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present.
9910    /// IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.
9911    /// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
9912    #[serde(
9913        default,
9914        skip_serializing_if = "Option::is_none",
9915        rename = "pullPolicy"
9916    )]
9917    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9918    pub pull_policy: Option<String>,
9919    /// Required: Image or artifact reference to be used.
9920    /// Behaves in the same way as pod.spec.containers[*].image.
9921    /// Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets.
9922    /// More info: <https://kubernetes.io/docs/concepts/containers/images>
9923    /// This field is optional to allow higher level config management to default or override
9924    /// container images in workload controllers like Deployments and StatefulSets.
9925    #[serde(default, skip_serializing_if = "Option::is_none")]
9926    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9927    pub reference: Option<String>,
9928}
9929
9930/// Instances topology.
9931#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
9932#[cfg_attr(feature = "builder", derive(TypedBuilder))]
9933#[cfg_attr(feature = "schemars", derive(JsonSchema))]
9934pub struct ClusterStatusTopology {
9935    /// Instances contains the pod topology of the instances
9936    #[serde(default, skip_serializing_if = "Option::is_none")]
9937    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9938    pub instances: Option<BTreeMap<String, BTreeMap<String, String>>>,
9939    /// NodesUsed represents the count of distinct nodes accommodating the instances.
9940    /// A value of '1' suggests that all instances are hosted on a single node,
9941    /// implying the absence of High Availability (HA). Ideally, this value should
9942    /// be the same as the number of instances in the Postgres HA cluster, implying
9943    /// shared nothing architecture on the compute side.
9944    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodesUsed")]
9945    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9946    pub nodes_used: Option<i32>,
9947    /// SuccessfullyExtracted indicates if the topology data was extract. It is useful to enact fallback behaviors
9948    /// in synchronous replica election in case of failures
9949    #[serde(
9950        default,
9951        skip_serializing_if = "Option::is_none",
9952        rename = "successfullyExtracted"
9953    )]
9954    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
9955    pub successfully_extracted: Option<bool>,
9956}