Skip to content

Commit

Permalink
Set synced when missing (#68)
Browse files Browse the repository at this point in the history
Issue #, if available: aws-controllers-k8s/community#1133

Description of changes:
* Do not overwrite `ACK.ResourceSynced` condition, if it was being set by ReadOne/Create/Update hook code
* This change will restore existing functionality for asynchronous Create/Update handling until `AWS.ResourceManager.IsSynced` method is implemented. 
* revert the AWSResourceManager.IsSynced method, which can be added after this immediate patch
----

Tested locally with `iam-controller` and `rds-controller`

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
vijtrip2 authored Jan 24, 2022
1 parent f142275 commit df46566
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
21 changes: 0 additions & 21 deletions mocks/pkg/types/aws_resource_manager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions pkg/runtime/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,12 @@ func (r *resourceReconciler) updateResource(
}
rlog.Info("updated resource")
} else {
// If there is no delta between desired state and latest state, it is
// If there is no delta between desired state and latest state, and
// ACK.ResourceSynced condition is not already set, it is
// safe to set ACK.ResourceSynced condition to true.
ackcondition.SetSynced(latest, corev1.ConditionTrue, nil, nil)
if ackcondition.Synced(latest) == nil {
ackcondition.SetSynced(latest, corev1.ConditionTrue, nil, nil)
}
}
return latest, nil
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/types/aws_resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ type AWSResourceManager interface {
// This method also adds/updates the ConditionTypeReferencesResolved for the
// AWSResource.
ResolveReferences(context.Context, client.Reader, AWSResource) (AWSResource, error)
// IsSynced returns true if a resource is synced.
IsSynced(context.Context, AWSResource) (bool, error)
}

// AWSResourceManagerFactory returns an AWSResourceManager that can be used to
Expand Down

0 comments on commit df46566

Please sign in to comment.