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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -f clusters.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
    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 is the desired state of Cluster.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, 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 = "Cluster",
    plural = "clusters"
)]
#[kube(namespaced)]
#[kube(status = "ClusterStatus")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct ClusterSpec {
    /// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
    ///
    /// If this field is not defined and the Cluster implements a managed topology, availabilityGates
    /// from the corresponding ClusterClass will be used, if any.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "availabilityGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub availability_gates: Option<Vec<ClusterAvailabilityGates>>,
    /// clusterNetwork represents the cluster network configuration.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "clusterNetwork"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub cluster_network: Option<ClusterClusterNetwork>,
    /// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlaneEndpoint"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane_endpoint: Option<ClusterControlPlaneEndpoint>,
    /// controlPlaneRef is an optional reference to a provider-specific resource that holds
    /// the details for provisioning the Control Plane for a Cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlaneRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane_ref: Option<ClusterControlPlaneRef>,
    /// infrastructureRef is a reference to a provider-specific resource that holds the details
    /// for provisioning infrastructure for a cluster in said provider.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "infrastructureRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub infrastructure_ref: Option<ClusterInfrastructureRef>,
    /// paused can be used to prevent controllers from processing the Cluster and all its associated objects.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub paused: Option<bool>,
    /// topology encapsulates the topology for the cluster.
    /// NOTE: It is required to enable the ClusterTopology
    /// feature gate flag to activate managed topologies support;
    /// this feature is highly experimental, and parts of it might still be not implemented.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub topology: Option<ClusterTopology>,
}

/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterAvailabilityGates {
    /// conditionType refers to a condition with matching type in the Cluster's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this availabilityGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterAvailabilityGatesPolarity>,
}

/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterAvailabilityGatesPolarity {
    Positive,
    Negative,
}

/// clusterNetwork represents the cluster network configuration.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClusterNetwork {
    /// apiServerPort specifies the port the API Server should bind to.
    /// Defaults to 6443.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiServerPort"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub api_server_port: Option<i32>,
    /// pods is the network ranges from which Pod networks are allocated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pods: Option<ClusterClusterNetworkPods>,
    /// serviceDomain is the domain name for services.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serviceDomain"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub service_domain: Option<String>,
    /// services is the network ranges from which service VIPs are allocated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub services: Option<ClusterClusterNetworkServices>,
}

/// pods is the network ranges from which Pod networks are allocated.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClusterNetworkPods {
    /// cidrBlocks is a list of CIDR blocks.
    #[serde(rename = "cidrBlocks")]
    #[cfg_attr(feature = "builder", builder(default))]
    pub cidr_blocks: Vec<String>,
}

/// services is the network ranges from which service VIPs are allocated.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClusterNetworkServices {
    /// cidrBlocks is a list of CIDR blocks.
    #[serde(rename = "cidrBlocks")]
    #[cfg_attr(feature = "builder", builder(default))]
    pub cidr_blocks: Vec<String>,
}

/// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterControlPlaneEndpoint {
    /// host is the hostname on which the API server is serving.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub host: Option<String>,
    /// port is the port on which the API server is serving.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub port: Option<i32>,
}

/// controlPlaneRef is an optional reference to a provider-specific resource that holds
/// the details for provisioning the Control Plane for a Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterControlPlaneRef {
    /// apiGroup is the group of the resource being referenced.
    /// apiGroup must be fully qualified domain name.
    /// The corresponding version for this reference will be looked up from the contract
    /// labels of the corresponding CRD of the resource being referenced.
    #[serde(rename = "apiGroup")]
    pub api_group: String,
    /// kind of the resource being referenced.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the resource being referenced.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// infrastructureRef is a reference to a provider-specific resource that holds the details
/// for provisioning infrastructure for a cluster in said provider.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterInfrastructureRef {
    /// apiGroup is the group of the resource being referenced.
    /// apiGroup must be fully qualified domain name.
    /// The corresponding version for this reference will be looked up from the contract
    /// labels of the corresponding CRD of the resource being referenced.
    #[serde(rename = "apiGroup")]
    pub api_group: String,
    /// kind of the resource being referenced.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the resource being referenced.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// topology encapsulates the topology for the cluster.
/// NOTE: It is required to enable the ClusterTopology
/// feature gate flag to activate managed topologies support;
/// this feature is highly experimental, and parts of it might still be not implemented.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopology {
    /// classRef is the ref to the ClusterClass that should be used for the topology.
    #[serde(rename = "classRef")]
    pub class_ref: ClusterTopologyClassRef,
    /// controlPlane describes the cluster control plane.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlane"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane: Option<ClusterTopologyControlPlane>,
    /// variables can be used to customize the Cluster through
    /// patches. They must comply to the corresponding
    /// VariableClasses defined in the ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<Vec<ClusterTopologyVariables>>,
    /// version is the Kubernetes version of the cluster.
    pub version: String,
    /// workers encapsulates the different constructs that form the worker nodes
    /// for the cluster.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub workers: Option<ClusterTopologyWorkers>,
}

/// classRef is the ref to the ClusterClass that should be used for the topology.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyClassRef {
    /// name is the name of the ClusterClass that should be used for the topology.
    /// name must be a valid ClusterClass name and because of that be at most 253 characters in length
    /// and it must consist only of lower case alphanumeric characters, hyphens (-) and periods (.), and must start
    /// and end with an alphanumeric character.
    pub name: String,
    /// namespace is the namespace of the ClusterClass that should be used for the topology.
    /// If namespace is empty or not set, it is defaulted to the namespace of the Cluster object.
    /// namespace must be a valid namespace name and because of that be at most 63 characters in length
    /// and it must consist only of lower case alphanumeric characters or hyphens (-), and must start
    /// and end with an alphanumeric character.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub namespace: Option<String>,
}

/// controlPlane describes the cluster control plane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlane {
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterTopologyControlPlaneDeletion>,
    /// healthCheck allows to enable, disable and override control plane health check
    /// configuration from the ClusterClass for this control plane.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "healthCheck"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub health_check: Option<ClusterTopologyControlPlaneHealthCheck>,
    /// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
    /// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
    /// is applied only to the ControlPlane.
    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterTopologyControlPlaneMetadata>,
    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
    ///
    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
    ///
    /// If this field is not defined, readinessGates from the corresponding ControlPlaneClass will be used, if any.
    ///
    /// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
    /// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readinessGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub readiness_gates: Option<Vec<ClusterTopologyControlPlaneReadinessGates>>,
    /// replicas is the number of control plane nodes.
    /// If the value is not set, the ControlPlane object is created without the number of Replicas
    /// and it's assumed that the control plane controller does not implement support for this field.
    /// When specified against a control plane provider that lacks support for this field, this value will be ignored.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub replicas: Option<i32>,
    /// variables can be used to customize the ControlPlane through patches.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<ClusterTopologyControlPlaneVariables>,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
}

/// healthCheck allows to enable, disable and override control plane health check
/// configuration from the ClusterClass for this control plane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheck {
    /// checks are the checks that are used to evaluate if a Machine is healthy.
    ///
    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
    /// and as a consequence the checks and remediation fields from Cluster will be used instead of the
    /// corresponding fields in ClusterClass.
    ///
    /// Independent of this configuration the MachineHealthCheck controller will always
    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
    /// Machines with deleted Nodes as unhealthy.
    ///
    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
    /// is defaulted to 10 minutes and evaluated accordingly.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub checks: Option<ClusterTopologyControlPlaneHealthCheckChecks>,
    /// enabled controls if a MachineHealthCheck should be created for the target machines.
    ///
    /// If false: No MachineHealthCheck will be created.
    ///
    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
    ///
    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
    /// block if `enable` is true and no MachineHealthCheck definition is available.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub enabled: Option<bool>,
    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
    ///
    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
    /// and as a consequence the checks and remediation fields from cluster will be used instead of the
    /// corresponding fields in ClusterClass.
    ///
    /// If an health check override is defined and remediation or remediation.triggerIf is not set,
    /// remediation will always be triggered for unhealthy Machines.
    ///
    /// If an health check override is defined and remediation or remediation.templateRef is not set,
    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub remediation: Option<ClusterTopologyControlPlaneHealthCheckRemediation>,
}

/// checks are the checks that are used to evaluate if a Machine is healthy.
///
/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
/// and as a consequence the checks and remediation fields from Cluster will be used instead of the
/// corresponding fields in ClusterClass.
///
/// Independent of this configuration the MachineHealthCheck controller will always
/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
/// Machines with deleted Nodes as unhealthy.
///
/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
/// is defaulted to 10 minutes and evaluated accordingly.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckChecks {
    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
    /// to consider a Machine unhealthy if a corresponding Node isn't associated
    /// through a `Spec.ProviderID` field.
    ///
    /// The duration set in this field is compared to the greatest of:
    /// - Cluster's infrastructure ready condition timestamp (if and when available)
    /// - Control Plane's initialized condition timestamp (if and when available)
    /// - Machine's infrastructure ready condition timestamp (if and when available)
    /// - Machine's metadata creation timestamp
    ///
    /// Defaults to 10 minutes.
    /// If you wish to disable this feature, set the value explicitly to 0.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeStartupTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_startup_timeout_seconds: Option<i32>,
    /// unhealthyMachineConditions contains a list of the machine conditions that determine
    /// whether a machine is considered unhealthy.  The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyMachineConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_machine_conditions:
        Option<Vec<ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditions>>,
    /// unhealthyNodeConditions contains a list of conditions that determine
    /// whether a node is considered unhealthy. The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyNodeConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_node_conditions:
        Option<Vec<ClusterTopologyControlPlaneHealthCheckChecksUnhealthyNodeConditions>>,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus,
    /// timeoutSeconds is the duration that a machine must be in a given status for,
    /// after which the machine is considered unhealthy.
    /// For example, with a value of "3600", the machine must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Machine condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus {
    True,
    False,
    Unknown,
}

/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a node is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckChecksUnhealthyNodeConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: String,
    /// timeoutSeconds is the duration that a node must be in a given status for,
    /// after which the node is considered unhealthy.
    /// For example, with a value of "3600", the node must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Node condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
///
/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
/// and as a consequence the checks and remediation fields from cluster will be used instead of the
/// corresponding fields in ClusterClass.
///
/// If an health check override is defined and remediation or remediation.triggerIf is not set,
/// remediation will always be triggered for unhealthy Machines.
///
/// If an health check override is defined and remediation or remediation.templateRef is not set,
/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckRemediation {
    /// templateRef is a reference to a remediation template
    /// provided by an infrastructure provider.
    ///
    /// This field is completely optional, when filled, the MachineHealthCheck controller
    /// creates a new object from the template referenced and hands off remediation of the machine to
    /// a controller that lives outside of Cluster API.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "templateRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template_ref: Option<ClusterTopologyControlPlaneHealthCheckRemediationTemplateRef>,
    /// triggerIf configures if remediations are triggered.
    /// If this field is not set, remediations are always triggered.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub trigger_if: Option<ClusterTopologyControlPlaneHealthCheckRemediationTriggerIf>,
}

/// templateRef is a reference to a remediation template
/// provided by an infrastructure provider.
///
/// This field is completely optional, when filled, the MachineHealthCheck controller
/// creates a new object from the template referenced and hands off remediation of the machine to
/// a controller that lives outside of Cluster API.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckRemediationTemplateRef {
    /// apiVersion of the remediation template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the remediation template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the remediation template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// triggerIf configures if remediations are triggered.
/// If this field is not set, remediations are always triggered.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneHealthCheckRemediationTriggerIf {
    /// unhealthyInRange specifies that remediations are only triggered if the number of
    /// unhealthy Machines is in the configured range.
    /// Takes precedence over unhealthyLessThanOrEqualTo.
    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
    /// (a) there are at least 3 unhealthy Machines (and)
    /// (b) there are at most 5 unhealthy Machines
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyInRange"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_in_range: Option<String>,
    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
    /// unhealthy Machines is less than or equal to the configured value.
    /// unhealthyInRange takes precedence if set.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyLessThanOrEqualTo"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
}

/// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
/// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
/// is applied only to the ControlPlane.
/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneReadinessGates {
    /// conditionType refers to a condition with matching type in the Machine's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this readinessGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterTopologyControlPlaneReadinessGatesPolarity>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyControlPlaneReadinessGatesPolarity {
    Positive,
    Negative,
}

/// variables can be used to customize the ControlPlane through patches.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneVariables {
    /// overrides can be used to override Cluster level variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub overrides: Option<Vec<ClusterTopologyControlPlaneVariablesOverrides>>,
}

/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
/// Variable definition in the ClusterClass `status` variables.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyControlPlaneVariablesOverrides {
    /// name of the variable.
    pub name: String,
    /// value of the variable.
    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
    /// from the ClusterClass.
    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
    /// i.e. it is not possible to have no type field.
    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
    pub value: serde_json::Value,
}

/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
/// Variable definition in the ClusterClass `status` variables.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyVariables {
    /// name of the variable.
    pub name: String,
    /// value of the variable.
    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
    /// from the ClusterClass.
    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
    /// i.e. it is not possible to have no type field.
    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
    pub value: serde_json::Value,
}

/// workers encapsulates the different constructs that form the worker nodes
/// for the cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkers {
    /// machineDeployments is a list of machine deployments in the cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machineDeployments"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_deployments: Option<Vec<ClusterTopologyWorkersMachineDeployments>>,
    /// machinePools is a list of machine pools in the cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machinePools"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_pools: Option<Vec<ClusterTopologyWorkersMachinePools>>,
}

/// MachineDeploymentTopology specifies the different parameters for a set of worker nodes in the topology.
/// This set of nodes is managed by a MachineDeployment object whose lifecycle is managed by the Cluster controller.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeployments {
    /// class is the name of the MachineDeploymentClass used to create the set of worker nodes.
    /// This should match one of the deployment classes defined in the ClusterClass object
    /// mentioned in the `Cluster.Spec.Class` field.
    pub class: String,
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterTopologyWorkersMachineDeploymentsDeletion>,
    /// failureDomain is the failure domain the machines will be created in.
    /// Must match a key in the FailureDomains map stored on the cluster object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureDomain"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_domain: Option<String>,
    /// healthCheck allows to enable, disable and override MachineDeployment health check
    /// configuration from the ClusterClass for this MachineDeployment.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "healthCheck"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub health_check: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheck>,
    /// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterTopologyWorkersMachineDeploymentsMetadata>,
    /// minReadySeconds is the minimum number of seconds for which a newly created machine should
    /// be ready.
    /// Defaults to 0 (machine will be considered available as soon as it
    /// is ready)
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minReadySeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_ready_seconds: Option<i32>,
    /// name is the unique identifier for this MachineDeploymentTopology.
    /// The value is used with other unique identifiers to create a MachineDeployment's Name
    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
    /// the values are hashed together.
    pub name: String,
    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
    ///
    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
    ///
    /// If this field is not defined, readinessGates from the corresponding MachineDeploymentClass will be used, if any.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readinessGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub readiness_gates: Option<Vec<ClusterTopologyWorkersMachineDeploymentsReadinessGates>>,
    /// replicas is the number of worker nodes belonging to this set.
    /// If the value is nil, the MachineDeployment is created without the number of Replicas (defaulting to 1)
    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
    /// of this value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub replicas: Option<i32>,
    /// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
    /// It allows you to define the strategy used during rolling replacements.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub rollout: Option<ClusterTopologyWorkersMachineDeploymentsRollout>,
    /// variables can be used to customize the MachineDeployment through patches.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<ClusterTopologyWorkersMachineDeploymentsVariables>,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
    /// order defines the order in which Machines are deleted when downscaling.
    /// Defaults to "Random".  Valid values are "Random, "Newest", "Oldest"
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub order: Option<ClusterTopologyWorkersMachineDeploymentsDeletionOrder>,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyWorkersMachineDeploymentsDeletionOrder {
    Random,
    Newest,
    Oldest,
}

/// healthCheck allows to enable, disable and override MachineDeployment health check
/// configuration from the ClusterClass for this MachineDeployment.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheck {
    /// checks are the checks that are used to evaluate if a Machine is healthy.
    ///
    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
    /// and as a consequence the checks and remediation fields from Cluster will be used instead of the
    /// corresponding fields in ClusterClass.
    ///
    /// Independent of this configuration the MachineHealthCheck controller will always
    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
    /// Machines with deleted Nodes as unhealthy.
    ///
    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
    /// is defaulted to 10 minutes and evaluated accordingly.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub checks: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecks>,
    /// enabled controls if a MachineHealthCheck should be created for the target machines.
    ///
    /// If false: No MachineHealthCheck will be created.
    ///
    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
    ///
    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
    /// block if `enable` is true and no MachineHealthCheck definition is available.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub enabled: Option<bool>,
    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
    ///
    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
    /// and as a consequence the checks and remediation fields from cluster will be used instead of the
    /// corresponding fields in ClusterClass.
    ///
    /// If an health check override is defined and remediation or remediation.triggerIf is not set,
    /// remediation will always be triggered for unhealthy Machines.
    ///
    /// If an health check override is defined and remediation or remediation.templateRef is not set,
    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub remediation: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediation>,
}

/// checks are the checks that are used to evaluate if a Machine is healthy.
///
/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
/// and as a consequence the checks and remediation fields from Cluster will be used instead of the
/// corresponding fields in ClusterClass.
///
/// Independent of this configuration the MachineHealthCheck controller will always
/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
/// Machines with deleted Nodes as unhealthy.
///
/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
/// is defaulted to 10 minutes and evaluated accordingly.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecks {
    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
    /// to consider a Machine unhealthy if a corresponding Node isn't associated
    /// through a `Spec.ProviderID` field.
    ///
    /// The duration set in this field is compared to the greatest of:
    /// - Cluster's infrastructure ready condition timestamp (if and when available)
    /// - Control Plane's initialized condition timestamp (if and when available)
    /// - Machine's infrastructure ready condition timestamp (if and when available)
    /// - Machine's metadata creation timestamp
    ///
    /// Defaults to 10 minutes.
    /// If you wish to disable this feature, set the value explicitly to 0.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeStartupTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_startup_timeout_seconds: Option<i32>,
    /// unhealthyMachineConditions contains a list of the machine conditions that determine
    /// whether a machine is considered unhealthy.  The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyMachineConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_machine_conditions: Option<
        Vec<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions>,
    >,
    /// unhealthyNodeConditions contains a list of conditions that determine
    /// whether a node is considered unhealthy. The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyNodeConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_node_conditions: Option<
        Vec<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions>,
    >,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status:
        ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus,
    /// timeoutSeconds is the duration that a machine must be in a given status for,
    /// after which the machine is considered unhealthy.
    /// For example, with a value of "3600", the machine must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Machine condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus {
    True,
    False,
    Unknown,
}

/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a node is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: String,
    /// timeoutSeconds is the duration that a node must be in a given status for,
    /// after which the node is considered unhealthy.
    /// For example, with a value of "3600", the node must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Node condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
///
/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
/// and as a consequence the checks and remediation fields from cluster will be used instead of the
/// corresponding fields in ClusterClass.
///
/// If an health check override is defined and remediation or remediation.triggerIf is not set,
/// remediation will always be triggered for unhealthy Machines.
///
/// If an health check override is defined and remediation or remediation.templateRef is not set,
/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediation {
    /// maxInFlight determines how many in flight remediations should happen at the same time.
    ///
    /// Remediation only happens on the MachineSet with the most current revision, while
    /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
    ///
    /// Note: In general (independent of remediations), unhealthy machines are always
    /// prioritized during scale down operations over healthy ones.
    ///
    /// MaxInFlight can be set to a fixed number or a percentage.
    /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
    /// the desired replicas.
    ///
    /// If not set, remediation is limited to all machines (bounded by replicas)
    /// under the active MachineSet's management.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxInFlight"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_in_flight: Option<IntOrString>,
    /// templateRef is a reference to a remediation template
    /// provided by an infrastructure provider.
    ///
    /// This field is completely optional, when filled, the MachineHealthCheck controller
    /// creates a new object from the template referenced and hands off remediation of the machine to
    /// a controller that lives outside of Cluster API.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "templateRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template_ref:
        Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTemplateRef>,
    /// triggerIf configures if remediations are triggered.
    /// If this field is not set, remediations are always triggered.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub trigger_if: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTriggerIf>,
}

/// templateRef is a reference to a remediation template
/// provided by an infrastructure provider.
///
/// This field is completely optional, when filled, the MachineHealthCheck controller
/// creates a new object from the template referenced and hands off remediation of the machine to
/// a controller that lives outside of Cluster API.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTemplateRef {
    /// apiVersion of the remediation template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the remediation template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the remediation template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// triggerIf configures if remediations are triggered.
/// If this field is not set, remediations are always triggered.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTriggerIf {
    /// unhealthyInRange specifies that remediations are only triggered if the number of
    /// unhealthy Machines is in the configured range.
    /// Takes precedence over unhealthyLessThanOrEqualTo.
    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
    /// (a) there are at least 3 unhealthy Machines (and)
    /// (b) there are at most 5 unhealthy Machines
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyInRange"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_in_range: Option<String>,
    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
    /// unhealthy Machines is less than or equal to the configured value.
    /// unhealthyInRange takes precedence if set.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyLessThanOrEqualTo"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
}

/// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsReadinessGates {
    /// conditionType refers to a condition with matching type in the Machine's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this readinessGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterTopologyWorkersMachineDeploymentsReadinessGatesPolarity>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyWorkersMachineDeploymentsReadinessGatesPolarity {
    Positive,
    Negative,
}

/// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
/// It allows you to define the strategy used during rolling replacements.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsRollout {
    /// strategy specifies how to roll out control plane Machines.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub strategy: Option<ClusterTopologyWorkersMachineDeploymentsRolloutStrategy>,
}

/// strategy specifies how to roll out control plane Machines.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsRolloutStrategy {
    /// rollingUpdate is the rolling update config params. Present only if
    /// type = RollingUpdate.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "rollingUpdate"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub rolling_update:
        Option<ClusterTopologyWorkersMachineDeploymentsRolloutStrategyRollingUpdate>,
    /// type of rollout. Allowed values are RollingUpdate and OnDelete.
    /// Default is RollingUpdate.
    #[serde(rename = "type")]
    pub r#type: ClusterTopologyWorkersMachineDeploymentsRolloutStrategyType,
}

/// rollingUpdate is the rolling update config params. Present only if
/// type = RollingUpdate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsRolloutStrategyRollingUpdate {
    /// maxSurge is the maximum number of machines that can be scheduled above the
    /// desired number of machines.
    /// Value can be an absolute number (ex: 5) or a percentage of
    /// desired machines (ex: 10%).
    /// This can not be 0 if MaxUnavailable is 0.
    /// Absolute number is calculated from percentage by rounding up.
    /// Defaults to 1.
    /// Example: when this is set to 30%, the new MachineSet can be scaled
    /// up immediately when the rolling update starts, such that the total
    /// number of old and new machines do not exceed 130% of desired
    /// machines. Once old machines have been killed, new MachineSet can
    /// be scaled up further, ensuring that total number of machines running
    /// at any time during the update is at most 130% of desired machines.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_surge: Option<IntOrString>,
    /// maxUnavailable is the maximum number of machines that can be unavailable during the update.
    /// Value can be an absolute number (ex: 5) or a percentage of desired
    /// machines (ex: 10%).
    /// Absolute number is calculated from percentage by rounding down.
    /// This can not be 0 if MaxSurge is 0.
    /// Defaults to 0.
    /// Example: when this is set to 30%, the old MachineSet can be scaled
    /// down to 70% of desired machines immediately when the rolling update
    /// starts. Once new machines are ready, old MachineSet can be scaled
    /// down further, followed by scaling up the new MachineSet, ensuring
    /// that the total number of machines available at all times
    /// during the update is at least 70% of desired machines.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxUnavailable"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_unavailable: Option<IntOrString>,
}

/// strategy specifies how to roll out control plane Machines.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterTopologyWorkersMachineDeploymentsRolloutStrategyType {
    RollingUpdate,
    OnDelete,
}

/// variables can be used to customize the MachineDeployment through patches.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsVariables {
    /// overrides can be used to override Cluster level variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub overrides: Option<Vec<ClusterTopologyWorkersMachineDeploymentsVariablesOverrides>>,
}

/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
/// Variable definition in the ClusterClass `status` variables.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachineDeploymentsVariablesOverrides {
    /// name of the variable.
    pub name: String,
    /// value of the variable.
    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
    /// from the ClusterClass.
    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
    /// i.e. it is not possible to have no type field.
    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
    pub value: serde_json::Value,
}

/// MachinePoolTopology specifies the different parameters for a pool of worker nodes in the topology.
/// This pool of nodes is managed by a MachinePool object whose lifecycle is managed by the Cluster controller.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachinePools {
    /// class is the name of the MachinePoolClass used to create the pool of worker nodes.
    /// This should match one of the deployment classes defined in the ClusterClass object
    /// mentioned in the `Cluster.Spec.Class` field.
    pub class: String,
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterTopologyWorkersMachinePoolsDeletion>,
    /// failureDomains is the list of failure domains the machine pool will be created in.
    /// Must match a key in the FailureDomains map stored on the cluster object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureDomains"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_domains: Option<Vec<String>>,
    /// metadata is the metadata applied to the MachinePool.
    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterTopologyWorkersMachinePoolsMetadata>,
    /// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
    /// be ready.
    /// Defaults to 0 (machine will be considered available as soon as it
    /// is ready)
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minReadySeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_ready_seconds: Option<i32>,
    /// name is the unique identifier for this MachinePoolTopology.
    /// The value is used with other unique identifiers to create a MachinePool's Name
    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
    /// the values are hashed together.
    pub name: String,
    /// replicas is the number of nodes belonging to this pool.
    /// If the value is nil, the MachinePool is created without the number of Replicas (defaulting to 1)
    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
    /// of this value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub replicas: Option<i32>,
    /// variables can be used to customize the MachinePool through patches.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<ClusterTopologyWorkersMachinePoolsVariables>,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachinePoolsDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the MachinePool
    /// hosts after the MachinePool is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
}

/// metadata is the metadata applied to the MachinePool.
/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachinePoolsMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// variables can be used to customize the MachinePool through patches.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachinePoolsVariables {
    /// overrides can be used to override Cluster level variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub overrides: Option<Vec<ClusterTopologyWorkersMachinePoolsVariablesOverrides>>,
}

/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
/// Variable definition in the ClusterClass `status` variables.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterTopologyWorkersMachinePoolsVariablesOverrides {
    /// name of the variable.
    pub name: String,
    /// value of the variable.
    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
    /// from the ClusterClass.
    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
    /// i.e. it is not possible to have no type field.
    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
    pub value: serde_json::Value,
}

/// status is the observed state of Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatus {
    /// conditions represents the observations of a Cluster's current state.
    /// Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady
    /// MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused.
    /// Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub conditions: Option<Vec<Condition>>,
    /// controlPlane groups all the observations about Cluster's ControlPlane current state.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlane"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane: Option<ClusterStatusControlPlane>,
    /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deprecated: Option<ClusterStatusDeprecated>,
    /// failureDomains is a slice of failure domain objects synced from the infrastructure provider.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureDomains"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_domains: Option<Vec<ClusterStatusFailureDomains>>,
    /// initialization provides observations of the Cluster initialization process.
    /// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub initialization: Option<ClusterStatusInitialization>,
    /// observedGeneration is the latest generation observed by the controller.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedGeneration"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub observed_generation: Option<i64>,
    /// phase represents the current phase of cluster actuation.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub phase: Option<ClusterStatusPhase>,
    /// workers groups all the observations about Cluster's Workers current state.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub workers: Option<ClusterStatusWorkers>,
}

/// controlPlane groups all the observations about Cluster's ControlPlane current state.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusControlPlane {
    /// availableReplicas is the total number of available control plane machines in this cluster. A machine is considered available when Machine's Available condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "availableReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub available_replicas: Option<i32>,
    /// desiredReplicas is the total number of desired control plane machines in this cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "desiredReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub desired_replicas: Option<i32>,
    /// readyReplicas is the total number of ready control plane machines in this cluster. A machine is considered ready when Machine's Ready condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readyReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub ready_replicas: Option<i32>,
    /// replicas is the total number of control plane machines in this cluster.
    /// NOTE: replicas also includes machines still being provisioned or being deleted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub replicas: Option<i32>,
    /// upToDateReplicas is the number of up-to-date control plane machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "upToDateReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub up_to_date_replicas: Option<i32>,
}

/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusDeprecated {
    /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub v1beta1: Option<ClusterStatusDeprecatedV1beta1>,
}

/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusDeprecatedV1beta1 {
    /// conditions defines current service state of the cluster.
    ///
    /// 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.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub conditions: Option<Vec<Condition>>,
    /// failureMessage indicates that there is a fatal problem reconciling the
    /// state, and will be set to a descriptive error message.
    ///
    /// 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.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureMessage"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_message: Option<String>,
    /// failureReason indicates that there is a fatal problem reconciling the
    /// state, and will be set to a token value suitable for
    /// programmatic interpretation.
    ///
    /// 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.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureReason"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_reason: Option<String>,
}

/// FailureDomain is the Schema for Cluster API failure domains.
/// It allows controllers to understand how many failure domains a cluster can optionally span across.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusFailureDomains {
    /// attributes is a free form map of attributes an infrastructure provider might use or require.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub attributes: Option<BTreeMap<String, String>>,
    /// controlPlane determines if this failure domain is suitable for use by control plane machines.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlane"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane: Option<bool>,
    /// name is the name of the failure domain.
    pub name: String,
}

/// initialization provides observations of the Cluster initialization process.
/// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusInitialization {
    /// controlPlaneInitialized denotes when the control plane is functional enough to accept requests.
    /// This information is usually used as a signal for starting all the provisioning operations that depends on
    /// a functional API server, but do not require a full HA control plane to exists, like e.g. join worker Machines,
    /// install core addons like CNI, CPI, CSI etc.
    /// NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning.
    /// The value of this field is never updated after initialization is completed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlaneInitialized"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane_initialized: Option<bool>,
    /// infrastructureProvisioned is true when the infrastructure provider reports that Cluster's infrastructure is fully provisioned.
    /// NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning.
    /// The value of this field is never updated after provisioning is completed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "infrastructureProvisioned"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub infrastructure_provisioned: Option<bool>,
}

/// status is the observed state of Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterStatusPhase {
    Pending,
    Provisioning,
    Provisioned,
    Deleting,
    Failed,
    Unknown,
}

/// workers groups all the observations about Cluster's Workers current state.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterStatusWorkers {
    /// availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "availableReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub available_replicas: Option<i32>,
    /// desiredReplicas is the total number of desired worker machines in this cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "desiredReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub desired_replicas: Option<i32>,
    /// readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readyReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub ready_replicas: Option<i32>,
    /// replicas is the total number of worker machines in this cluster.
    /// NOTE: replicas also includes machines still being provisioned or being deleted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub replicas: Option<i32>,
    /// upToDateReplicas is the number of up-to-date worker machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "upToDateReplicas"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub up_to_date_replicas: Option<i32>,
}