diff --git a/api/v1alpha1/hivelocitymachine_types.go b/api/v1alpha1/hivelocitymachine_types.go index deea25b83..bb55d6ede 100644 --- a/api/v1alpha1/hivelocitymachine_types.go +++ b/api/v1alpha1/hivelocitymachine_types.go @@ -131,9 +131,9 @@ type HivelocityMachineStatus struct { // Region contains the name of the Hivelocity location the device is running. Region Region `json:"region,omitempty"` - // DeviceState is the state of the device for this machine. + // PowerState is the power state of the device for this machine (ON|OFF). // +optional - DeviceState string `json:"deviceState,omitempty"` + PowerState string `json:"powerState,omitempty"` // FailureReason will be set in the event that there is a terminal problem // reconciling the Machine and will contain a succinct value suitable @@ -159,7 +159,7 @@ type HivelocityMachineStatus struct { // +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this HivelocityMachine belongs" // +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.imageName",description="Image name" // +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type",description="Device type" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.deviceState",description="Hivelocity device state" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.powerState",description="Hivelocity device state" // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Machine ready status" // +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="ProviderID of machine object" // +kubebuilder:printcolumn:name="Machine",type="string",JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object which owns with this HivelocityMachine" @@ -220,7 +220,7 @@ func (r *HivelocityMachine) SetMachineStatus(device hv.BareMetalDevice) { Address: device.PrimaryIp, }, } - r.Status.DeviceState = device.PowerStatus + r.Status.PowerState = device.PowerStatus r.Status.Region = Region(device.LocationName) } diff --git a/api/v1alpha1/hivelocitymachine_types_test.go b/api/v1alpha1/hivelocitymachine_types_test.go index 5c58719c4..90f28e0ee 100644 --- a/api/v1alpha1/hivelocitymachine_types_test.go +++ b/api/v1alpha1/hivelocitymachine_types_test.go @@ -154,14 +154,14 @@ var _ = Describe("Test SetMachineStatus", func() { Address: "hostname", }, }, - Region: Region("testregion"), - DeviceState: "on", + Region: Region("testregion"), + PowerState: "ON", }, device: hv.BareMetalDevice{ Hostname: "device-hostname", PrimaryIp: "127.0.0.1", LocationName: "LAX2", - PowerStatus: "off", + PowerStatus: "OFF", }, expectStatus: HivelocityMachineStatus{ Addresses: []clusterv1.MachineAddress{ @@ -178,8 +178,8 @@ var _ = Describe("Test SetMachineStatus", func() { Address: "127.0.0.1", }, }, - Region: Region("LAX2"), - DeviceState: "off", + Region: Region("LAX2"), + PowerState: "OFF", }, }), Entry("no existing status", testCaseSetMachineStatus{ @@ -188,7 +188,7 @@ var _ = Describe("Test SetMachineStatus", func() { Hostname: "device-hostname", PrimaryIp: "127.0.0.1", LocationName: "LAX2", - PowerStatus: "off", + PowerStatus: "OFF", }, expectStatus: HivelocityMachineStatus{ Addresses: []clusterv1.MachineAddress{ @@ -205,8 +205,8 @@ var _ = Describe("Test SetMachineStatus", func() { Address: "127.0.0.1", }, }, - Region: Region("LAX2"), - DeviceState: "off", + Region: Region("LAX2"), + PowerState: "OFF", }, }), ) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_hivelocitymachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_hivelocitymachines.yaml index 4b2f65e53..cbe634acc 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_hivelocitymachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_hivelocitymachines.yaml @@ -32,7 +32,7 @@ spec: name: Type type: string - description: Hivelocity device state - jsonPath: .status.deviceState + jsonPath: .status.powerState name: State type: string - description: Machine ready status @@ -177,9 +177,6 @@ spec: - type type: object type: array - deviceState: - description: DeviceState is the state of the device for this machine. - type: string failureMessage: description: FailureMessage will be set in the event that there is a terminal problem reconciling the Machine and will contain a more @@ -190,6 +187,10 @@ spec: a terminal problem reconciling the Machine and will contain a succinct value suitable for machine interpretation. type: string + powerState: + description: PowerState is the power state of the device for this + machine (ON|OFF). + type: string ready: description: Ready is true when the provider resource is ready. type: boolean diff --git a/docs/book/src/crd/index.md b/docs/book/src/crd/index.md index 37927135f..f786ce8d9 100644 --- a/docs/book/src/crd/index.md +++ b/docs/book/src/crd/index.md @@ -720,14 +720,14 @@ Region
deviceState
powerState
DeviceState is the state of the device for this machine.
+PowerState is the state of the device for this machine.