Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Fix the code to set the ReconciledGeneration so that it does not ge s…
Browse files Browse the repository at this point in the history
…kipped when the function returns early
  • Loading branch information
staebler committed Aug 23, 2017
1 parent 8f7774c commit a93c5d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
10 changes: 5 additions & 5 deletions pkg/controller/controller_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ func setServiceInstanceCredentialConditionInternal(toUpdate *v1alpha1.ServiceIns

glog.V(5).Infof("Setting ServiceInstanceCredential '%v/%v' condition %q to %v", toUpdate.Namespace, toUpdate.Name, conditionType, status)

// Set status.ReconciledGeneration if updating ready condition to true
if conditionType == v1alpha1.ServiceInstanceCredentialConditionReady && status == v1alpha1.ConditionTrue {
toUpdate.Status.ReconciledGeneration = toUpdate.Generation
}

newCondition := v1alpha1.ServiceInstanceCredentialCondition{
Type: conditionType,
Status: status,
Expand Down Expand Up @@ -582,11 +587,6 @@ func setServiceInstanceCredentialConditionInternal(toUpdate *v1alpha1.ServiceIns
}
}

// Set status.ReconciledGeneration if updating ready condition to true
if conditionType == v1alpha1.ServiceInstanceCredentialConditionReady && status == v1alpha1.ConditionTrue {
toUpdate.Status.ReconciledGeneration = toUpdate.Generation
}

glog.V(3).Infof("Setting lastTransitionTime for ServiceInstanceCredential '%v/%v' condition %q to %v",
toUpdate.Namespace, toUpdate.Name, conditionType, t)

Expand Down
10 changes: 5 additions & 5 deletions pkg/controller/controller_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,11 @@ func setServiceInstanceConditionInternal(toUpdate *v1alpha1.ServiceInstance,

glog.V(5).Infof(`Setting ServiceInstance "%v/%v" condition %q to %v`, toUpdate.Namespace, toUpdate.Name, conditionType, status)

// Set status.ReconciledGeneration if updating ready condition to true
if conditionType == v1alpha1.ServiceInstanceConditionReady && status == v1alpha1.ConditionTrue {
toUpdate.Status.ReconciledGeneration = toUpdate.Generation
}

newCondition := v1alpha1.ServiceInstanceCondition{
Type: conditionType,
Status: status,
Expand Down Expand Up @@ -798,11 +803,6 @@ func setServiceInstanceConditionInternal(toUpdate *v1alpha1.ServiceInstance,
}
}

// Set status.ReconciledGeneration if updating ready condition to true
if conditionType == v1alpha1.ServiceInstanceConditionReady && status == v1alpha1.ConditionTrue {
toUpdate.Status.ReconciledGeneration = toUpdate.Generation
}

glog.V(3).Infof(`Setting lastTransitionTime for ServiceInstance "%v/%v" condition %q to %v`, toUpdate.Namespace, toUpdate.Name, conditionType, t)
newCondition.LastTransitionTime = t
toUpdate.Status.Conditions = append(toUpdate.Status.Conditions, newCondition)
Expand Down
6 changes: 0 additions & 6 deletions test/integration/clientset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,6 @@ func testInstanceClient(sType server.StorageType, client servicecatalogclient.In
if e, a := readyConditionTrue, instanceServer.Status.Conditions[0]; !reflect.DeepEqual(e, a) {
return fmt.Errorf("Didn't get matching ready conditions:\nexpected: %v\n\ngot: %v", e, a)
}
if instanceServer.Status.Checksum == nil {
return fmt.Errorf("Checksum should have been set after updating ready condition to true")
}

// delete the instance, set its finalizers to nil, update it, then ensure it is actually
// deleted
Expand Down Expand Up @@ -798,9 +795,6 @@ func testBindingClient(sType server.StorageType, client servicecatalogclient.Int
if e, a := readyConditionTrue, bindingServer.Status.Conditions[0]; !reflect.DeepEqual(e, a) {
return fmt.Errorf("Didn't get matching ready conditions:\nexpected: %v\n\ngot: %v", e, a)
}
if bindingServer.Status.Checksum == nil {
return fmt.Errorf("Checksum should have been set after updating ready condition to true")
}

if err = bindingClient.Delete(name, &metav1.DeleteOptions{}); nil != err {
return fmt.Errorf("binding delete failed (%s)", err)
Expand Down

0 comments on commit a93c5d9

Please sign in to comment.