Skip to content

Commit 2ccd5c2

Browse files
committed
Allow empty status fields
1 parent fbab1a2 commit 2ccd5c2

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

api/v1alpha3/machinehealthcheck_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ type UnhealthyCondition struct {
7878
type MachineHealthCheckStatus struct {
7979
// total number of machines counted by this machine health check
8080
// +kubebuilder:validation:Minimum=0
81-
ExpectedMachines int32 `json:"expectedMachines"`
81+
ExpectedMachines int32 `json:"expectedMachines,omitempty"`
8282

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

8888
// ANCHOR_END: MachineHealthCheckStatus

api/v1alpha3/machinehealthcheck_webhook_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ func TestMachineHealthCheckDefault(t *testing.T) {
3131
mhc.Default()
3232

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

3638
func TestMachineHealthCheckLabelSelectorAsSelectorValidation(t *testing.T) {

config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ spec:
162162
format: int32
163163
minimum: 0
164164
type: integer
165-
required:
166-
- currentHealthy
167-
- expectedMachines
168165
type: object
169166
type: object
170167
served: true

0 commit comments

Comments
 (0)