Skip to content

Commit

Permalink
Allow empty status fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed Feb 26, 2020
1 parent fbab1a2 commit 2ccd5c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha3/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ type UnhealthyCondition struct {
type MachineHealthCheckStatus struct {
// total number of machines counted by this machine health check
// +kubebuilder:validation:Minimum=0
ExpectedMachines int32 `json:"expectedMachines"`
ExpectedMachines int32 `json:"expectedMachines,omitempty"`

// total number of healthy machines counted by this machine health check
// +kubebuilder:validation:Minimum=0
CurrentHealthy int32 `json:"currentHealthy"`
CurrentHealthy int32 `json:"currentHealthy,omitempty"`
}

// ANCHOR_END: MachineHealthCheckStatus
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha3/machinehealthcheck_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func TestMachineHealthCheckDefault(t *testing.T) {
mhc.Default()

g.Expect(mhc.Spec.MaxUnhealthy.String()).To(Equal("100%"))
g.Expect(mhc.Spec.NodeStartupTimeout).ToNot(BeNil())
g.Expect(*mhc.Spec.NodeStartupTimeout).To(Equal(metav1.Duration{Duration: 10 * time.Minute}))
}

func TestMachineHealthCheckLabelSelectorAsSelectorValidation(t *testing.T) {
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ spec:
format: int32
minimum: 0
type: integer
required:
- currentHealthy
- expectedMachines
type: object
type: object
served: true
Expand Down

0 comments on commit 2ccd5c2

Please sign in to comment.