k8s-crds-cluster-api 1.12.5

Kubernetes CRDs for cluster-api
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -f machinedrainrules.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use kube_derive::CustomResource;
    #[cfg(feature = "schemars")]
    pub use schemars::JsonSchema;
    pub use serde::{Deserialize, Serialize};
    pub use std::collections::BTreeMap;
    #[cfg(feature = "builder")]
    pub use typed_builder::TypedBuilder;
}

use self::prelude::*;

/// spec defines the spec of a MachineDrainRule.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[cfg_attr(not(feature = "schemars"), kube(schema = "disabled"))]
#[kube(
    group = "cluster.x-k8s.io",
    version = "v1beta2",
    kind = "MachineDrainRule",
    plural = "machinedrainrules"
)]
#[kube(namespaced)]
#[kube(derive = "PartialEq")]
pub struct MachineDrainRuleSpec {
    /// drain configures if and how Pods are drained.
    pub drain: MachineDrainRuleDrain,
    /// machines defines to which Machines this MachineDrainRule should be applied.
    ///
    /// If machines is not set, the MachineDrainRule applies to all Machines in the Namespace.
    /// If machines contains multiple selectors, the results are ORed.
    /// Within a single Machine selector the results of selector and clusterSelector are ANDed.
    /// Machines will be selected from all Clusters in the Namespace unless otherwise
    /// restricted with the clusterSelector.
    ///
    /// Example: Selects control plane Machines in all Clusters or
    ///          Machines with label "os" == "linux" in Clusters with label
    ///          "stage" == "production".
    ///
    ///  - selector:
    ///      matchExpressions:
    ///      - key: cluster.x-k8s.io/control-plane
    ///        operator: Exists
    ///  - selector:
    ///      matchLabels:
    ///        os: linux
    ///    clusterSelector:
    ///      matchExpressions:
    ///      - key: stage
    ///        operator: In
    ///        values:
    ///        - production
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machines: Option<Vec<MachineDrainRuleMachines>>,
    /// pods defines to which Pods this MachineDrainRule should be applied.
    ///
    /// If pods is not set, the MachineDrainRule applies to all Pods in all Namespaces.
    /// If pods contains multiple selectors, the results are ORed.
    /// Within a single Pod selector the results of selector and namespaceSelector are ANDed.
    /// Pods will be selected from all Namespaces unless otherwise
    /// restricted with the namespaceSelector.
    ///
    /// Example: Selects Pods with label "app" == "logging" in all Namespaces or
    ///          Pods with label "app" == "prometheus" in the "monitoring"
    ///          Namespace.
    ///
    ///  - selector:
    ///      matchExpressions:
    ///      - key: app
    ///        operator: In
    ///        values:
    ///        - logging
    ///  - selector:
    ///      matchLabels:
    ///        app: prometheus
    ///    namespaceSelector:
    ///      matchLabels:
    ///        kubernetes.io/metadata.name: monitoring
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pods: Option<Vec<MachineDrainRulePods>>,
}

/// drain configures if and how Pods are drained.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleDrain {
    /// behavior defines the drain behavior.
    /// Can be either "Drain", "Skip", or "WaitCompleted".
    /// "Drain" means that the Pods to which this MachineDrainRule applies will be drained.
    /// If behavior is set to "Drain" the order in which Pods are drained can be configured
    /// with the order field. When draining Pods of a Node the Pods will be grouped by order
    /// and one group after another will be drained (by increasing order). Cluster API will
    /// wait until all Pods of a group are terminated / removed from the Node before starting
    /// with the next group.
    /// "Skip" means that the Pods to which this MachineDrainRule applies will be skipped during drain.
    /// "WaitCompleted" means that the pods to which this MachineDrainRule applies will never be evicted
    /// and we wait for them to be completed, it is enforced that pods marked with this behavior always have Order=0.
    pub behavior: MachineDrainRuleDrainBehavior,
    /// order defines the order in which Pods are drained.
    /// Pods with higher order are drained after Pods with lower order.
    /// order can only be set if behavior is set to "Drain".
    /// If order is not set, 0 will be used.
    /// Valid values for order are from -2147483648 to 2147483647 (inclusive).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub order: Option<i32>,
}

/// drain configures if and how Pods are drained.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum MachineDrainRuleDrainBehavior {
    Drain,
    Skip,
    WaitCompleted,
}

/// MachineDrainRuleMachineSelector defines to which Machines this MachineDrainRule should be applied.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleMachines {
    /// clusterSelector is a label selector which selects Machines by the labels of
    /// their Clusters.
    /// This field follows standard label selector semantics; if not present or
    /// empty, it selects Machines of all Clusters.
    ///
    /// If selector is also set, then the selector as a whole selects
    /// Machines matching selector belonging to Clusters selected by clusterSelector.
    /// If selector is not set, it selects all Machines belonging to Clusters
    /// selected by clusterSelector.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "clusterSelector"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub cluster_selector: Option<MachineDrainRuleMachinesClusterSelector>,
    /// selector is a label selector which selects Machines by their labels.
    /// This field follows standard label selector semantics; if not present or
    /// empty, it selects all Machines.
    ///
    /// If clusterSelector is also set, then the selector as a whole selects
    /// Machines matching selector belonging to Clusters selected by clusterSelector.
    /// If clusterSelector is not set, it selects all Machines matching selector in
    /// all Clusters.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub selector: Option<MachineDrainRuleMachinesSelector>,
}

/// clusterSelector is a label selector which selects Machines by the labels of
/// their Clusters.
/// This field follows standard label selector semantics; if not present or
/// empty, it selects Machines of all Clusters.
///
/// If selector is also set, then the selector as a whole selects
/// Machines matching selector belonging to Clusters selected by clusterSelector.
/// If selector is not set, it selects all Machines belonging to Clusters
/// selected by clusterSelector.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleMachinesClusterSelector {
    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchExpressions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_expressions: Option<Vec<MachineDrainRuleMachinesClusterSelectorMatchExpressions>>,
    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_labels: Option<BTreeMap<String, String>>,
}

/// A label selector requirement is a selector that contains values, a key, and an operator that
/// relates the key and values.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleMachinesClusterSelectorMatchExpressions {
    /// key is the label key that the selector applies to.
    pub key: String,
    /// operator represents a key's relationship to a set of values.
    /// Valid operators are In, NotIn, Exists and DoesNotExist.
    pub operator: String,
    /// values is an array of string values. If the operator is In or NotIn,
    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
    /// the values array must be empty. This array is replaced during a strategic
    /// merge patch.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub values: Option<Vec<String>>,
}

/// selector is a label selector which selects Machines by their labels.
/// This field follows standard label selector semantics; if not present or
/// empty, it selects all Machines.
///
/// If clusterSelector is also set, then the selector as a whole selects
/// Machines matching selector belonging to Clusters selected by clusterSelector.
/// If clusterSelector is not set, it selects all Machines matching selector in
/// all Clusters.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleMachinesSelector {
    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchExpressions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_expressions: Option<Vec<MachineDrainRuleMachinesSelectorMatchExpressions>>,
    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_labels: Option<BTreeMap<String, String>>,
}

/// A label selector requirement is a selector that contains values, a key, and an operator that
/// relates the key and values.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRuleMachinesSelectorMatchExpressions {
    /// key is the label key that the selector applies to.
    pub key: String,
    /// operator represents a key's relationship to a set of values.
    /// Valid operators are In, NotIn, Exists and DoesNotExist.
    pub operator: String,
    /// values is an array of string values. If the operator is In or NotIn,
    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
    /// the values array must be empty. This array is replaced during a strategic
    /// merge patch.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub values: Option<Vec<String>>,
}

/// MachineDrainRulePodSelector defines to which Pods this MachineDrainRule should be applied.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRulePods {
    /// namespaceSelector is a label selector which selects Pods by the labels of
    /// their Namespaces.
    /// This field follows standard label selector semantics; if not present or
    /// empty, it selects Pods of all Namespaces.
    ///
    /// If selector is also set, then the selector as a whole selects
    /// Pods matching selector in Namespaces selected by namespaceSelector.
    /// If selector is not set, it selects all Pods in Namespaces selected by
    /// namespaceSelector.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "namespaceSelector"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub namespace_selector: Option<MachineDrainRulePodsNamespaceSelector>,
    /// selector is a label selector which selects Pods by their labels.
    /// This field follows standard label selector semantics; if not present or
    /// empty, it selects all Pods.
    ///
    /// If namespaceSelector is also set, then the selector as a whole selects
    /// Pods matching selector in Namespaces selected by namespaceSelector.
    /// If namespaceSelector is not set, it selects all Pods matching selector in
    /// all Namespaces.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub selector: Option<MachineDrainRulePodsSelector>,
}

/// namespaceSelector is a label selector which selects Pods by the labels of
/// their Namespaces.
/// This field follows standard label selector semantics; if not present or
/// empty, it selects Pods of all Namespaces.
///
/// If selector is also set, then the selector as a whole selects
/// Pods matching selector in Namespaces selected by namespaceSelector.
/// If selector is not set, it selects all Pods in Namespaces selected by
/// namespaceSelector.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRulePodsNamespaceSelector {
    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchExpressions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_expressions: Option<Vec<MachineDrainRulePodsNamespaceSelectorMatchExpressions>>,
    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_labels: Option<BTreeMap<String, String>>,
}

/// A label selector requirement is a selector that contains values, a key, and an operator that
/// relates the key and values.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRulePodsNamespaceSelectorMatchExpressions {
    /// key is the label key that the selector applies to.
    pub key: String,
    /// operator represents a key's relationship to a set of values.
    /// Valid operators are In, NotIn, Exists and DoesNotExist.
    pub operator: String,
    /// values is an array of string values. If the operator is In or NotIn,
    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
    /// the values array must be empty. This array is replaced during a strategic
    /// merge patch.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub values: Option<Vec<String>>,
}

/// selector is a label selector which selects Pods by their labels.
/// This field follows standard label selector semantics; if not present or
/// empty, it selects all Pods.
///
/// If namespaceSelector is also set, then the selector as a whole selects
/// Pods matching selector in Namespaces selected by namespaceSelector.
/// If namespaceSelector is not set, it selects all Pods matching selector in
/// all Namespaces.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRulePodsSelector {
    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchExpressions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_expressions: Option<Vec<MachineDrainRulePodsSelectorMatchExpressions>>,
    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub match_labels: Option<BTreeMap<String, String>>,
}

/// A label selector requirement is a selector that contains values, a key, and an operator that
/// relates the key and values.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct MachineDrainRulePodsSelectorMatchExpressions {
    /// key is the label key that the selector applies to.
    pub key: String,
    /// operator represents a key's relationship to a set of values.
    /// Valid operators are In, NotIn, Exists and DoesNotExist.
    pub operator: String,
    /// values is an array of string values. If the operator is In or NotIn,
    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
    /// the values array must be empty. This array is replaced during a strategic
    /// merge patch.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub values: Option<Vec<String>>,
}