Skip to content

Commit bd1634c

Browse files
committed
Align Spec fields to optionalfields API conventions
1 parent ff2cbc1 commit bd1634c

33 files changed

+89
-39
lines changed

api/addons/v1beta2/clusterresourceset_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ type ClusterResourceSet struct {
203203
metav1.ObjectMeta `json:"metadata,omitempty"`
204204

205205
// spec is the desired state of ClusterResourceSet.
206-
// +optional
207-
Spec ClusterResourceSetSpec `json:"spec,omitempty"`
206+
// +required
207+
Spec ClusterResourceSetSpec `json:"spec"`
208208
// status is the observed state of ClusterResourceSet.
209209
// +optional
210210
Status ClusterResourceSetStatus `json:"status,omitempty"`

api/addons/v1beta2/clusterresourcesetbinding_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ type ClusterResourceSetBinding struct {
127127
// +optional
128128
metav1.ObjectMeta `json:"metadata,omitempty"`
129129
// spec is the desired state of ClusterResourceSetBinding.
130-
// +optional
131-
Spec ClusterResourceSetBindingSpec `json:"spec,omitempty"`
130+
// +required
131+
Spec ClusterResourceSetBindingSpec `json:"spec"`
132132
}
133133

134134
// ANCHOR: ClusterResourceSetBindingSpec

api/bootstrap/kubeadm/v1beta2/kubeadmconfig_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var (
5050

5151
// KubeadmConfigSpec defines the desired state of KubeadmConfig.
5252
// Either ClusterConfiguration and InitConfiguration should be defined or the JoinConfiguration should be defined.
53+
// +kubebuilder:validation:MinProperties=1
5354
type KubeadmConfigSpec struct {
5455
// clusterConfiguration along with InitConfiguration are the configurations necessary for the init command
5556
// +optional
@@ -541,8 +542,8 @@ type KubeadmConfig struct {
541542
metav1.ObjectMeta `json:"metadata,omitempty"`
542543

543544
// spec is the desired state of KubeadmConfig.
544-
// +optional
545-
Spec KubeadmConfigSpec `json:"spec,omitempty"`
545+
// +required
546+
Spec KubeadmConfigSpec `json:"spec"`
546547
// status is the observed state of KubeadmConfig.
547548
// +optional
548549
Status KubeadmConfigStatus `json:"status,omitempty"`

api/bootstrap/kubeadm/v1beta2/kubeadmconfigtemplate_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ import (
2323
)
2424

2525
// KubeadmConfigTemplateSpec defines the desired state of KubeadmConfigTemplate.
26+
// +kubebuilder:validation:MinProperties=1
2627
type KubeadmConfigTemplateSpec struct {
2728
// template defines the desired state of KubeadmConfigTemplate.
2829
// +required
2930
Template KubeadmConfigTemplateResource `json:"template"`
3031
}
3132

3233
// KubeadmConfigTemplateResource defines the Template structure.
34+
// +kubebuilder:validation:MinProperties=1
3335
type KubeadmConfigTemplateResource struct {
3436
// metadata is the standard object's metadata.
3537
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -38,7 +40,7 @@ type KubeadmConfigTemplateResource struct {
3840

3941
// spec is the desired state of KubeadmConfig.
4042
// +optional
41-
Spec KubeadmConfigSpec `json:"spec,omitempty"`
43+
Spec KubeadmConfigSpec `json:"spec,omitempty,omitzero"`
4244
}
4345

4446
// +kubebuilder:object:root=true
@@ -56,7 +58,7 @@ type KubeadmConfigTemplate struct {
5658

5759
// spec is the desired state of KubeadmConfigTemplate.
5860
// +optional
59-
Spec KubeadmConfigTemplateSpec `json:"spec,omitempty"`
61+
Spec KubeadmConfigTemplateSpec `json:"spec,omitempty,omitzero"`
6062
}
6163

6264
// +kubebuilder:object:root=true

api/controlplane/kubeadm/v1beta2/kubeadm_control_plane_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ type KubeadmControlPlane struct {
806806
metav1.ObjectMeta `json:"metadata,omitempty"`
807807

808808
// spec is the desired state of KubeadmControlPlane.
809-
// +optional
810-
Spec KubeadmControlPlaneSpec `json:"spec,omitempty"`
809+
// +required
810+
Spec KubeadmControlPlaneSpec `json:"spec"`
811811
// status is the observed state of KubeadmControlPlane.
812812
// +optional
813813
Status KubeadmControlPlaneStatus `json:"status,omitempty"`

api/controlplane/kubeadm/v1beta2/kubeadmcontrolplanetemplate_types.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
)
2525

2626
// KubeadmControlPlaneTemplateSpec defines the desired state of KubeadmControlPlaneTemplate.
27+
// +kubebuilder:validation:MinProperties=1
2728
type KubeadmControlPlaneTemplateSpec struct {
2829
// template defines the desired state of KubeadmControlPlaneTemplate.
2930
// +required
@@ -46,7 +47,7 @@ type KubeadmControlPlaneTemplate struct {
4647

4748
// spec is the desired state of KubeadmControlPlaneTemplate.
4849
// +optional
49-
Spec KubeadmControlPlaneTemplateSpec `json:"spec,omitempty"`
50+
Spec KubeadmControlPlaneTemplateSpec `json:"spec,omitempty,omitzero"`
5051
}
5152

5253
// +kubebuilder:object:root=true
@@ -67,15 +68,16 @@ func init() {
6768
}
6869

6970
// KubeadmControlPlaneTemplateResource describes the data needed to create a KubeadmControlPlane from a template.
71+
// +kubebuilder:validation:MinProperties=1
7072
type KubeadmControlPlaneTemplateResource struct {
7173
// metadata is the standard object's metadata.
7274
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
7375
// +optional
7476
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
7577

7678
// spec is the desired state of KubeadmControlPlaneTemplateResource.
77-
// +required
78-
Spec KubeadmControlPlaneTemplateResourceSpec `json:"spec"`
79+
// +optional
80+
Spec KubeadmControlPlaneTemplateResourceSpec `json:"spec,omitempty,omitzero"`
7981
}
8082

8183
// KubeadmControlPlaneTemplateResourceSpec defines the desired state of KubeadmControlPlane.
@@ -91,8 +93,8 @@ type KubeadmControlPlaneTemplateResourceSpec struct {
9193

9294
// kubeadmConfigSpec is a KubeadmConfigSpec
9395
// to use for initializing and joining machines to the control plane.
94-
// +required
95-
KubeadmConfigSpec bootstrapv1.KubeadmConfigSpec `json:"kubeadmConfigSpec"`
96+
// +optional
97+
KubeadmConfigSpec bootstrapv1.KubeadmConfigSpec `json:"kubeadmConfigSpec,omitempty,omitzero"`
9698

9799
// rolloutBefore is a field to indicate a rollout should be performed
98100
// if the specified criteria is met.

api/core/v1beta2/cluster_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ const (
458458
// ANCHOR: ClusterSpec
459459

460460
// ClusterSpec defines the desired state of Cluster.
461+
// +kubebuilder:validation:MinProperties=1
461462
type ClusterSpec struct {
462463
// paused can be used to prevent controllers from processing the Cluster and all its associated objects.
463464
// +optional
@@ -1184,8 +1185,8 @@ type Cluster struct {
11841185
metav1.ObjectMeta `json:"metadata,omitempty"`
11851186

11861187
// spec is the desired state of Cluster.
1187-
// +optional
1188-
Spec ClusterSpec `json:"spec,omitempty"`
1188+
// +required
1189+
Spec ClusterSpec `json:"spec"`
11891190
// status is the observed state of Cluster.
11901191
// +optional
11911192
Status ClusterStatus `json:"status,omitempty"`

api/core/v1beta2/clusterclass_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ type ClusterClass struct {
8181
metav1.ObjectMeta `json:"metadata,omitempty"`
8282

8383
// spec is the desired state of ClusterClass.
84-
// +optional
85-
Spec ClusterClassSpec `json:"spec,omitempty"`
84+
// +required
85+
Spec ClusterClassSpec `json:"spec"`
8686
// status is the observed state of ClusterClass.
8787
// +optional
8888
Status ClusterClassStatus `json:"status,omitempty"`
8989
}
9090

9191
// ClusterClassSpec describes the desired state of the ClusterClass.
92+
// +kubebuilder:validation:MinProperties=1
9293
type ClusterClassSpec struct {
9394
// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
9495
//

api/core/v1beta2/machine_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ type Machine struct {
735735
metav1.ObjectMeta `json:"metadata,omitempty"`
736736

737737
// spec is the desired state of Machine.
738-
// +optional
739-
Spec MachineSpec `json:"spec,omitempty"`
738+
// +required
739+
Spec MachineSpec `json:"spec"`
740740
// status is the observed state of Machine.
741741
// +optional
742742
Status MachineStatus `json:"status,omitempty"`

api/core/v1beta2/machinedeployment_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@ type MachineDeployment struct {
592592
metav1.ObjectMeta `json:"metadata,omitempty"`
593593

594594
// spec is the desired state of MachineDeployment.
595-
// +optional
596-
Spec MachineDeploymentSpec `json:"spec,omitempty"`
595+
// +required
596+
Spec MachineDeploymentSpec `json:"spec"`
597597
// status is the observed state of MachineDeployment.
598598
// +optional
599599
Status MachineDeploymentStatus `json:"status,omitempty"`

0 commit comments

Comments
 (0)