-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update hander/enqueue_annotation.go #2
Update hander/enqueue_annotation.go #2
Conversation
handler/enqueue_annotation.go
Outdated
// SetWatchOwnerAnnotation is a helper method to add watch annotation-based with the owner NamespacedName and | ||
// schema.GroupKind to the object provided. This allows you to declare the watch annotations of an owner to an object. | ||
// If a annotation to the same object already exists, it'll be overwritten with the newly provided version. | ||
func SetOwnerAnnotation(owner, object metav1.Object, ownerGK schema.GroupKind) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See that it is a helper. so, we need to update the places in SDK that are using the annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR kubernetes-sigs/controller-runtime#892 received a lot of contributions from the devs in the controller-runtime. So, I think it is in good shape. What is missing to do here;
- Cleanup the go mod
- Update the places across the project to use the helper
- We need to check the CI. (lint to ensure that all is fine, test to check if these tests are ok, ansible and helm as well to check that nothing broke after that and all is properly updated)
2726c3e
to
4ba30c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests pass for me once I remove the unnecessary dependency on running envtest. However, given all the nits and discrepancies I found, I'm a little concerned with the validity of the tests.
Let's make sure to double/triple check everything before we merge.
7b3c512
to
2a45e4d
Compare
This commit updates the implementation in enqueue_annotation, to watch dependent resources based on the presence of an annotation on them. Co-Authored-by: Camila Macedo <[email protected]>
2a45e4d
to
f03d3a7
Compare
5835cd5
to
c15d42b
Compare
Addressed review comments, and made changes to the PR. |
c15d42b
to
2d6fca2
Compare
Pull Request Test Coverage Report for Build 180371929
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits and grammar, looks great otherwise.
2d6fca2
to
b9bbc70
Compare
b9bbc70
to
9d29dbd
Compare
ce9b384
to
5be29f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
5be29f3
to
bc589e5
Compare
New changes are detected. LGTM label has been removed. |
This commit updates the implementation in enqueue_annotation, to
watch dependent resources based on the presence of an annotation.
Motivation: (Taken from PR #892 of Controller Runtime)
While owner references are the idiomatic way to manage dependent resources, they don't solve all use cases. Owner references have restrictions that limit which objects can own other objects.
An annotation-based watch handler does not have these restrictions. However, they don't provide the same feature set either.
The watch handler can be used to trigger reconciliation of a parent resource based on changes to dependent resources that include an annotation. The purpose of this handler is to support cross-scope ownership relationships that are not supported by native owner references.
For example, owner references are used for garbage collection. If a resource's owner is deleted, the resource will also be deleted. Because of this, annotation references need to be paired with a finalizer so that the operator can manually garbage collect.
Co-Authored-by: Camila Macedo [email protected]