Skip to content

Commit

Permalink
Stop nonstop status reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
vikaschoudhary16 committed Oct 31, 2018
1 parent 0488a2f commit 0ca8941
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/cloud/aws/actuators/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/client-go/kubernetes"

providerconfigv1 "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1"
Expand Down Expand Up @@ -133,9 +132,14 @@ func (a *Actuator) updateMachineStatus(machine *clusterv1.Machine, awsStatus *pr
if networkAddresses != nil {
machineCopy.Status.Addresses = networkAddresses
}

if !equality.Semantic.DeepEqual(machine.Status, machineCopy.Status) {
glog.Infof("machine status changed: %s", diff.ObjectReflectDiff(machine.Status, machineCopy.Status))
oldAWSStatus, err := ProviderStatusFromMachine(a.codec, machine)
if err != nil {
glog.Errorf("error updating machine status: %v", err)
return err
}
// TODO(vikasc): Revisit to compare complete machine status objects
if !equality.Semantic.DeepEqual(awsStatus, oldAWSStatus) || !equality.Semantic.DeepEqual(machine.Status.Addresses, machineCopy.Status.Addresses) {
glog.Infof("machine status has changed, updating")
time := metav1.Now()
machineCopy.Status.LastUpdated = &time

Expand Down

0 comments on commit 0ca8941

Please sign in to comment.