Skip to content

Commit 80d99f9

Browse files
committed
change status and reason to *string
1 parent cebd713 commit 80d99f9

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

api/v1beta2/cloudstackmachine_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ type CloudStackMachineStatus struct {
128128

129129
// Status indicates the status of the provider resource.
130130
// +optional
131-
Status string `json:"status"`
131+
Status *string `json:"status,omitempty"`
132132

133133
// Reason indicates the reason of status failure
134134
// +optional
135-
Reason string `json:"reason"`
135+
Reason *string `json:"reason,omitempty"`
136136
}
137137

138138
// TimeSinceLastStateChange returns the amount of time that's elapsed since the state was last updated. If the state

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/cloudstackmachine_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controllers
1919
import (
2020
"context"
2121
"fmt"
22+
"k8s.io/utils/pointer"
2223
"math/rand"
2324
"reflect"
2425
"regexp"
@@ -274,8 +275,8 @@ func (r *CloudStackMachineReconciliationRunner) ReconcileDelete() (retRes ctrl.R
274275
// ResolveVMInstanceDetails can get InstanceID by CS machine name
275276
err := r.CSClient.ResolveVMInstanceDetails(r.ReconciliationSubject)
276277
if err != nil {
277-
r.ReconciliationSubject.Status.Status = metav1.StatusFailure
278-
r.ReconciliationSubject.Status.Reason = err.Error()
278+
r.ReconciliationSubject.Status.Status = pointer.String(metav1.StatusFailure)
279+
r.ReconciliationSubject.Status.Reason = pointer.String(err.Error())
279280
// Cloudstack VM may be not found or more than one found by name
280281
return ctrl.Result{}, err
281282
}

pkg/cloud/instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func (c *client) GetOrCreateVMInstance(
282282
return err
283283
}
284284
csMachine.Spec.InstanceID = pointer.StringPtr(deployVMResp.Id)
285-
csMachine.Status.Status = metav1.StatusSuccess
285+
csMachine.Status.Status = pointer.String(metav1.StatusSuccess)
286286
// Resolve uses a VM metrics request response to fill cloudstack machine status.
287287
// The deployment response is insufficient.
288288
return c.ResolveVMInstanceDetails(csMachine)

0 commit comments

Comments
 (0)