Skip to content

Commit

Permalink
api: mark spec field of CRs as required
Browse files Browse the repository at this point in the history
All the CRs need to have valid spec field,
therefore this commit marks .spec field of all CRs
as required using kubebuilder validation tag.

Signed-off-by: Rakshith R <[email protected]>
  • Loading branch information
Rakshith-R authored and mergify[bot] committed Jan 10, 2023
1 parent 1ca9e1a commit c5025da
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 7 deletions.
4 changes: 3 additions & 1 deletion apis/csiaddons/v1alpha1/csiaddonsnode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ type CSIAddonsNode struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CSIAddonsNodeSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec CSIAddonsNodeSpec `json:"spec"`

Status CSIAddonsNodeStatus `json:"status,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion apis/csiaddons/v1alpha1/networkfence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ type NetworkFence struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec NetworkFenceSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec NetworkFenceSpec `json:"spec"`

Status NetworkFenceStatus `json:"status,omitempty"`
}

Expand Down
6 changes: 4 additions & 2 deletions apis/csiaddons/v1alpha1/reclaimspacecronjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1alpha1

import (
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -123,7 +123,9 @@ type ReclaimSpaceCronJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ReclaimSpaceCronJobSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec ReclaimSpaceCronJobSpec `json:"spec"`

Status ReclaimSpaceCronJobStatus `json:"status,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion apis/csiaddons/v1alpha1/reclaimspacejob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ type ReclaimSpaceJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ReclaimSpaceJobSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec ReclaimSpaceJobSpec `json:"spec"`

Status ReclaimSpaceJobStatus `json:"status,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion apis/replication.storage/v1alpha1/volumereplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ type VolumeReplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec VolumeReplicationSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec VolumeReplicationSpec `json:"spec"`

Status VolumeReplicationStatus `json:"status,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ type VolumeReplicationClass struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec VolumeReplicationClassSpec `json:"spec,omitempty"`
// +kubebuilder:validation:Required
Spec VolumeReplicationClassSpec `json:"spec"`

Status VolumeReplicationClassStatus `json:"status,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/csiaddons.openshift.io_csiaddonsnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ spec:
CSI Driver.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/csiaddons.openshift.io_networkfences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ spec:
operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/csiaddons.openshift.io_reclaimspacejobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ spec:
description: VolumeReplicationClassStatus defines the observed state of
VolumeReplicationClass.
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ spec:
description: State captures the latest state of the replication operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
12 changes: 12 additions & 0 deletions deploy/controller/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ spec:
CSI Driver.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -272,6 +274,8 @@ spec:
operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -476,6 +480,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -664,6 +670,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -741,6 +749,8 @@ spec:
description: VolumeReplicationClassStatus defines the observed state of
VolumeReplicationClass.
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -941,6 +951,8 @@ spec:
description: State captures the latest state of the replication operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
12 changes: 12 additions & 0 deletions deploy/controller/install-all-in-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
CSI Driver.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -279,6 +281,8 @@ spec:
operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -483,6 +487,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -671,6 +677,8 @@ spec:
format: date-time
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -748,6 +756,8 @@ spec:
description: VolumeReplicationClassStatus defines the observed state of
VolumeReplicationClass.
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down Expand Up @@ -948,6 +958,8 @@ spec:
description: State captures the latest state of the replication operation.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down

0 comments on commit c5025da

Please sign in to comment.