cluster_api_rs/api/capi_clusterresourceset.rs
1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium --smart-derive-elision -D Default -D PartialEq -A -d -f -
3// kopium version: 0.22.5
4
5#[allow(unused_imports)]
6mod prelude {
7 pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8 pub use kube::CustomResource;
9 pub use schemars::JsonSchema;
10 pub use serde::{Deserialize, Serialize};
11 pub use std::collections::BTreeMap;
12}
13
14use self::prelude::*;
15
16/// spec is the desired state of ClusterResourceSet.
17#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
18#[kube(
19 group = "addons.cluster.x-k8s.io",
20 version = "v1beta2",
21 kind = "ClusterResourceSet",
22 plural = "clusterresourcesets"
23)]
24#[kube(namespaced)]
25#[kube(status = "ClusterResourceSetStatus")]
26#[kube(derive = "Default")]
27#[kube(derive = "PartialEq")]
28pub struct ClusterResourceSetSpec {
29 /// clusterSelector is the label selector for Clusters. The Clusters that are
30 /// selected by this will be the ones affected by this ClusterResourceSet.
31 /// It must match the Cluster labels. This field is immutable.
32 /// Label selector cannot be empty.
33 #[serde(rename = "clusterSelector")]
34 pub cluster_selector: ClusterResourceSetClusterSelector,
35 /// resources is a list of Secrets/ConfigMaps where each contains 1 or more resources to be applied to remote clusters.
36 pub resources: Vec<ClusterResourceSetResources>,
37 /// strategy is the strategy to be used during applying resources. Defaults to ApplyOnce. This field is immutable.
38 #[serde(default, skip_serializing_if = "Option::is_none")]
39 pub strategy: Option<ClusterResourceSetStrategy>,
40}
41
42/// clusterSelector is the label selector for Clusters. The Clusters that are
43/// selected by this will be the ones affected by this ClusterResourceSet.
44/// It must match the Cluster labels. This field is immutable.
45/// Label selector cannot be empty.
46#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
47pub struct ClusterResourceSetClusterSelector {
48 /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
49 #[serde(
50 default,
51 skip_serializing_if = "Option::is_none",
52 rename = "matchExpressions"
53 )]
54 pub match_expressions: Option<Vec<ClusterResourceSetClusterSelectorMatchExpressions>>,
55 /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
56 /// map is equivalent to an element of matchExpressions, whose key field is "key", the
57 /// operator is "In", and the values array contains only "value". The requirements are ANDed.
58 #[serde(
59 default,
60 skip_serializing_if = "Option::is_none",
61 rename = "matchLabels"
62 )]
63 pub match_labels: Option<BTreeMap<String, String>>,
64}
65
66/// A label selector requirement is a selector that contains values, a key, and an operator that
67/// relates the key and values.
68#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
69pub struct ClusterResourceSetClusterSelectorMatchExpressions {
70 /// key is the label key that the selector applies to.
71 pub key: String,
72 /// operator represents a key's relationship to a set of values.
73 /// Valid operators are In, NotIn, Exists and DoesNotExist.
74 pub operator: String,
75 /// values is an array of string values. If the operator is In or NotIn,
76 /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
77 /// the values array must be empty. This array is replaced during a strategic
78 /// merge patch.
79 #[serde(default, skip_serializing_if = "Option::is_none")]
80 pub values: Option<Vec<String>>,
81}
82
83/// ResourceRef specifies a resource.
84#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
85pub struct ClusterResourceSetResources {
86 /// kind of the resource. Supported kinds are: Secrets and ConfigMaps.
87 pub kind: ClusterResourceSetResourcesKind,
88 /// name of the resource that is in the same namespace with ClusterResourceSet object.
89 pub name: String,
90}
91
92/// ResourceRef specifies a resource.
93#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
94pub enum ClusterResourceSetResourcesKind {
95 Secret,
96 ConfigMap,
97}
98
99/// spec is the desired state of ClusterResourceSet.
100#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
101pub enum ClusterResourceSetStrategy {
102 ApplyOnce,
103 Reconcile,
104}
105
106/// status is the observed state of ClusterResourceSet.
107#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
108pub struct ClusterResourceSetStatus {
109 /// conditions represents the observations of a ClusterResourceSet's current state.
110 /// Known condition types are ResourcesApplied.
111 #[serde(default, skip_serializing_if = "Option::is_none")]
112 pub conditions: Option<Vec<Condition>>,
113 /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
114 #[serde(default, skip_serializing_if = "Option::is_none")]
115 pub deprecated: Option<ClusterResourceSetStatusDeprecated>,
116 /// observedGeneration reflects the generation of the most recently observed ClusterResourceSet.
117 #[serde(
118 default,
119 skip_serializing_if = "Option::is_none",
120 rename = "observedGeneration"
121 )]
122 pub observed_generation: Option<i64>,
123}
124
125/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
126#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
127pub struct ClusterResourceSetStatusDeprecated {
128 /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
129 #[serde(default, skip_serializing_if = "Option::is_none")]
130 pub v1beta1: Option<ClusterResourceSetStatusDeprecatedV1beta1>,
131}
132
133/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
134#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
135pub struct ClusterResourceSetStatusDeprecatedV1beta1 {
136 /// conditions defines current state of the ClusterResourceSet.
137 ///
138 /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
139 #[serde(default, skip_serializing_if = "Option::is_none")]
140 pub conditions: Option<Vec<Condition>>,
141}