From d11e7ea39ef09be37afd6b887167044e4260ce44 Mon Sep 17 00:00:00 2001 From: Liz <33235082+liztio@users.noreply.github.com> Date: Thu, 14 Feb 2019 11:04:14 -0500 Subject: [PATCH] Use InstanceState instead of String in Machine Status (#577) --- .../awsprovider/v1alpha1/awsmachineproviderstatus_types.go | 2 +- pkg/apis/awsprovider/v1alpha1/zz_generated.deepcopy.go | 2 +- pkg/cloud/aws/actuators/machine/actuator.go | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/apis/awsprovider/v1alpha1/awsmachineproviderstatus_types.go b/pkg/apis/awsprovider/v1alpha1/awsmachineproviderstatus_types.go index 57ad688ce2..38e4859903 100644 --- a/pkg/apis/awsprovider/v1alpha1/awsmachineproviderstatus_types.go +++ b/pkg/apis/awsprovider/v1alpha1/awsmachineproviderstatus_types.go @@ -35,7 +35,7 @@ type AWSMachineProviderStatus struct { // InstanceState is the state of the AWS instance for this machine // +optional - InstanceState *string `json:"instanceState,omitempty"` + InstanceState *InstanceState `json:"instanceState,omitempty"` // Conditions is a set of conditions associated with the Machine to indicate // errors or other status diff --git a/pkg/apis/awsprovider/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/awsprovider/v1alpha1/zz_generated.deepcopy.go index 9d0ee604a4..e4bb7ecd97 100644 --- a/pkg/apis/awsprovider/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/awsprovider/v1alpha1/zz_generated.deepcopy.go @@ -165,7 +165,7 @@ func (in *AWSMachineProviderStatus) DeepCopyInto(out *AWSMachineProviderStatus) } if in.InstanceState != nil { in, out := &in.InstanceState, &out.InstanceState - *out = new(string) + *out = new(InstanceState) **out = **in } if in.Conditions != nil { diff --git a/pkg/cloud/aws/actuators/machine/actuator.go b/pkg/cloud/aws/actuators/machine/actuator.go index 58e247f1a5..59ce6afd81 100644 --- a/pkg/cloud/aws/actuators/machine/actuator.go +++ b/pkg/cloud/aws/actuators/machine/actuator.go @@ -166,7 +166,7 @@ func (a *Actuator) Create(ctx context.Context, cluster *clusterv1.Cluster, machi } scope.MachineStatus.InstanceID = &i.ID - scope.MachineStatus.InstanceState = aws.String(string(i.State)) + scope.MachineStatus.InstanceState = &i.State if machine.Annotations == nil { machine.Annotations = map[string]string{} @@ -406,6 +406,8 @@ func (a *Actuator) Exists(ctx context.Context, cluster *clusterv1.Cluster, machi return false, nil } + scope.MachineStatus.InstanceState = &instance.State + if err := a.reconcileLBAttachment(scope, machine, instance); err != nil { return true, err }