@@ -75,11 +75,14 @@ type ClusterClass struct {
7575 metav1.TypeMeta `json:",inline"`
7676 // metadata is the standard object's metadata.
7777 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
78+ // +optional
7879 metav1.ObjectMeta `json:"metadata,omitempty"`
7980
8081 // spec is the desired state of ClusterClass.
82+ // +optional
8183 Spec ClusterClassSpec `json:"spec,omitempty"`
8284 // status is the observed state of ClusterClass.
85+ // +optional
8386 Status ClusterClassStatus `json:"status,omitempty"`
8487}
8588
@@ -255,10 +258,12 @@ type MachineDeploymentClass struct {
255258 // class denotes a type of worker node present in the cluster,
256259 // this name MUST be unique within a ClusterClass and can be referenced
257260 // in the Cluster to create a managed MachineDeployment.
261+ // +required
258262 Class string `json:"class"`
259263
260264 // template is a local struct containing a collection of templates for creation of
261265 // MachineDeployment objects representing a set of worker nodes.
266+ // +required
262267 Template MachineDeploymentClassTemplate `json:"template"`
263268
264269 // machineHealthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
@@ -300,6 +305,7 @@ type MachineDeploymentClass struct {
300305 // Defaults to 0 (machine will be considered available as soon as it
301306 // is ready)
302307 // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
308+ // +optional
303309 MinReadySeconds * int32 `json:"minReadySeconds,omitempty"`
304310
305311 // readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
@@ -319,6 +325,7 @@ type MachineDeploymentClass struct {
319325 // strategy is the deployment strategy to use to replace existing machines with
320326 // new ones.
321327 // NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
328+ // +optional
322329 Strategy * MachineDeploymentStrategy `json:"strategy,omitempty"`
323330}
324331
@@ -332,10 +339,12 @@ type MachineDeploymentClassTemplate struct {
332339
333340 // bootstrap contains the bootstrap template reference to be used
334341 // for the creation of worker Machines.
342+ // +required
335343 Bootstrap LocalObjectTemplate `json:"bootstrap"`
336344
337345 // infrastructure contains the infrastructure template reference to be used
338346 // for the creation of worker Machines.
347+ // +required
339348 Infrastructure LocalObjectTemplate `json:"infrastructure"`
340349}
341350
@@ -410,10 +419,12 @@ type MachinePoolClass struct {
410419 // class denotes a type of machine pool present in the cluster,
411420 // this name MUST be unique within a ClusterClass and can be referenced
412421 // in the Cluster to create a managed MachinePool.
422+ // +required
413423 Class string `json:"class"`
414424
415425 // template is a local struct containing a collection of templates for creation of
416426 // MachinePools objects representing a pool of worker nodes.
427+ // +required
417428 Template MachinePoolClassTemplate `json:"template"`
418429
419430 // failureDomains is the list of failure domains the MachinePool should be attached to.
@@ -452,6 +463,7 @@ type MachinePoolClass struct {
452463 // Defaults to 0 (machine will be considered available as soon as it
453464 // is ready)
454465 // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
466+ // +optional
455467 MinReadySeconds * int32 `json:"minReadySeconds,omitempty"`
456468}
457469
@@ -465,10 +477,12 @@ type MachinePoolClassTemplate struct {
465477
466478 // bootstrap contains the bootstrap template reference to be used
467479 // for the creation of the Machines in the MachinePool.
480+ // +required
468481 Bootstrap LocalObjectTemplate `json:"bootstrap"`
469482
470483 // infrastructure contains the infrastructure template reference to be used
471484 // for the creation of the MachinePool.
485+ // +required
472486 Infrastructure LocalObjectTemplate `json:"infrastructure"`
473487}
474488
@@ -495,12 +509,14 @@ func (m MachineHealthCheckClass) IsZero() bool {
495509// be configured in the Cluster topology and used in patches.
496510type ClusterClassVariable struct {
497511 // name of the variable.
512+ // +required
498513 Name string `json:"name"`
499514
500515 // required specifies if the variable is required.
501516 // Note: this applies to the variable as a whole and thus the
502517 // top-level object defined in the schema. If nested fields are
503518 // required, this will be specified inside the schema.
519+ // +required
504520 Required bool `json:"required"`
505521
506522 // metadata is the metadata of a variable.
@@ -513,6 +529,7 @@ type ClusterClassVariable struct {
513529 Metadata ClusterClassVariableMetadata `json:"metadata,omitempty"`
514530
515531 // schema defines the schema of the variable.
532+ // +required
516533 Schema VariableSchema `json:"schema"`
517534}
518535
@@ -539,6 +556,7 @@ type VariableSchema struct {
539556 // openAPIV3Schema defines the schema of a variable via OpenAPI v3
540557 // schema. The schema is a subset of the schema used in
541558 // Kubernetes CRDs.
559+ // +required
542560 OpenAPIV3Schema JSONSchemaProps `json:"openAPIV3Schema"`
543561}
544562
@@ -549,9 +567,11 @@ type VariableSchema struct {
549567// which are not supported in CAPI have been removed.
550568type JSONSchemaProps struct {
551569 // description is a human-readable description of this variable.
570+ // +optional
552571 Description string `json:"description,omitempty"`
553572
554573 // example is an example for this variable.
574+ // +optional
555575 Example * apiextensionsv1.JSON `json:"example,omitempty"`
556576
557577 // type is the type of the variable.
@@ -871,9 +891,11 @@ const (
871891// ClusterClassPatch defines a patch which is applied to customize the referenced templates.
872892type ClusterClassPatch struct {
873893 // name of the patch.
894+ // +required
874895 Name string `json:"name"`
875896
876897 // description is a human-readable description of this patch.
898+ // +optional
877899 Description string `json:"description,omitempty"`
878900
879901 // enabledIf is a Go template to be used to calculate if a patch should be enabled.
@@ -900,12 +922,14 @@ type ClusterClassPatch struct {
900922// PatchDefinition defines a patch which is applied to customize the referenced templates.
901923type PatchDefinition struct {
902924 // selector defines on which templates the patch should be applied.
925+ // +required
903926 Selector PatchSelector `json:"selector"`
904927
905928 // jsonPatches defines the patches which should be applied on the templates
906929 // matching the selector.
907930 // Note: Patches will be applied in the order of the array.
908931 // +kubebuilder:validation:MaxItems=100
932+ // +required
909933 JSONPatches []JSONPatch `json:"jsonPatches"`
910934}
911935
@@ -916,12 +940,15 @@ type PatchDefinition struct {
916940// Note: The results of selection based on the individual fields are ANDed.
917941type PatchSelector struct {
918942 // apiVersion filters templates by apiVersion.
943+ // +required
919944 APIVersion string `json:"apiVersion"`
920945
921946 // kind filters templates by kind.
947+ // +required
922948 Kind string `json:"kind"`
923949
924950 // matchResources selects templates based on where they are referenced.
951+ // +required
925952 MatchResources PatchSelectorMatch `json:"matchResources"`
926953}
927954
@@ -972,13 +999,15 @@ type PatchSelectorMatchMachinePoolClass struct {
972999type JSONPatch struct {
9731000 // op defines the operation of the patch.
9741001 // Note: Only `add`, `replace` and `remove` are supported.
1002+ // +required
9751003 Op string `json:"op"`
9761004
9771005 // path defines the path of the patch.
9781006 // Note: Only the spec of a template can be patched, thus the path has to start with /spec/.
9791007 // Note: For now the only allowed array modifications are `append` and `prepend`, i.e.:
9801008 // * for op: `add`: only index 0 (prepend) and - (append) are allowed
9811009 // * for op: `replace` or `remove`: no indexes are allowed
1010+ // +required
9821011 Path string `json:"path"`
9831012
9841013 // value defines the value of the patch.
@@ -1039,6 +1068,7 @@ type ExternalPatchDefinition struct {
10391068type LocalObjectTemplate struct {
10401069 // ref is a required reference to a custom resource
10411070 // offered by a provider.
1071+ // +required
10421072 Ref * corev1.ObjectReference `json:"ref"`
10431073}
10441074
@@ -1079,6 +1109,7 @@ type ClusterClassV1Beta2Status struct {
10791109// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
10801110type ClusterClassStatusVariable struct {
10811111 // name is the name of the variable.
1112+ // +required
10821113 Name string `json:"name"`
10831114
10841115 // definitionsConflict specifies whether or not there are conflicting definitions for a single variable name.
@@ -1087,6 +1118,7 @@ type ClusterClassStatusVariable struct {
10871118
10881119 // definitions is a list of definitions for a variable.
10891120 // +kubebuilder:validation:MaxItems=100
1121+ // +required
10901122 Definitions []ClusterClassStatusVariableDefinition `json:"definitions"`
10911123}
10921124
@@ -1095,12 +1127,14 @@ type ClusterClassStatusVariableDefinition struct {
10951127 // from specifies the origin of the variable definition.
10961128 // This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass
10971129 // for variables discovered from a DiscoverVariables runtime extensions.
1130+ // +required
10981131 From string `json:"from"`
10991132
11001133 // required specifies if the variable is required.
11011134 // Note: this applies to the variable as a whole and thus the
11021135 // top-level object defined in the schema. If nested fields are
11031136 // required, this will be specified inside the schema.
1137+ // +required
11041138 Required bool `json:"required"`
11051139
11061140 // metadata is the metadata of a variable.
@@ -1113,6 +1147,7 @@ type ClusterClassStatusVariableDefinition struct {
11131147 Metadata ClusterClassVariableMetadata `json:"metadata,omitempty"`
11141148
11151149 // schema defines the schema of the variable.
1150+ // +required
11161151 Schema VariableSchema `json:"schema"`
11171152}
11181153
@@ -1151,8 +1186,10 @@ type ClusterClassList struct {
11511186 metav1.TypeMeta `json:",inline"`
11521187 // metadata is the standard list's metadata.
11531188 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#lists-and-simple-kinds
1189+ // +optional
11541190 metav1.ListMeta `json:"metadata,omitempty"`
11551191 // items is the list of ClusterClasses.
1192+ // +required
11561193 Items []ClusterClass `json:"items"`
11571194}
11581195
0 commit comments