Skip to content

Commit

Permalink
Make task status fields optional
Browse files Browse the repository at this point in the history
It was just the kubebuilder default to make them required, this was
never intended

Co-authored-by: Kieron Browne <kbrowne@vmware.com>
  • Loading branch information
danail-branekov and Kieron Browne committed Jul 13, 2022
1 parent 6023fb4 commit f23d373
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
13 changes: 9 additions & 4 deletions controllers/api/v1alpha1/cftask_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ type CFTaskSpec struct {
type CFTaskStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// +optional
Conditions []metav1.Condition `json:"conditions"`

SequenceID int64 `json:"sequenceId"`
MemoryMB int64 `json:"memoryMB"`
DiskQuotaMB int64 `json:"diskQuotaMB"`
DropletRef corev1.LocalObjectReference `json:"dropletRef"`
// +optional
SequenceID int64 `json:"sequenceId"`
// +optional
MemoryMB int64 `json:"memoryMB"`
// +optional
DiskQuotaMB int64 `json:"diskQuotaMB"`
// +optional
DropletRef corev1.LocalObjectReference `json:"dropletRef"`
}

//+kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ spec:
sequenceId:
format: int64
type: integer
required:
- conditions
- diskQuotaMB
- dropletRef
- memoryMB
- sequenceId
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ func setStatusCondition(cftask *korifiv1alpha1.CFTask, conditionType string) {
Reason: "foo",
Message: "bar",
})
cftask.Status.MemoryMB = 1
cftask.Status.DiskQuotaMB = 2
cftask.Status.DropletRef = corev1.LocalObjectReference{Name: "bob"}
cftask.Status.SequenceID = 3
Expect(k8sClient.Status().Patch(context.Background(), cftask, client.MergeFrom(clone))).To(Succeed())

// the status update clears any unapplied changes to the rest of the object, so reset spec changes:
Expand Down

0 comments on commit f23d373

Please sign in to comment.