-
Notifications
You must be signed in to change notification settings - Fork 173
Allow HNC to propagate changes to CRD. #1513
Conversation
Currently, HNC are clearing out most of the metadata when doing an update request, which works fine for most types, but failed for CRDs. This PR allows HNC to propagate changes to CRD by setting 'ResourceVersion' explicitly when performing an update. Tested: before this change, first create an crd in the parent namespace, and then update whatever field of the crd, wait a second and run the following command: kubectl hns describe child Result: Events from the objects in namespace child Last Seen Reason Object Message 0s CannotUpdateObject EETest:child/eetest-sample Could not write from source namespace parent: eetests.e2e.hnc.x-k8s.io eetest-sample is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update. After this change, you should see it propagates normally and the inherited crd's field is updated.
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Welcome @just1900! |
Hi @just1900. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: just1900 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I signed it |
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.
Great change! I've just left a few minor comments.
for the unit test, I have no idea about how to
verify that the rV is being copied
by now, because every resource in k8s will have aResourceVersion
.
I think that's fine, the e2e test captures everything we need and it's really the interaction with K8s that's important. There might have been a way to test this in the unit tests (which actually run a copy of the apiserver) but in this case, I like the clarity of the e2e test using kubectl.
e2e test have been added and tested.
Thanks for doing that. Can you just confirm that you tested that this new test fails if you break the code, i.e. leave resourceVersion
as zero? That might be nice to put into the commit message as well, given that I've asked for some other minor changes anyway.
Also cc @rjbez17 for his review.
2. cleanup crd in AfterEach block instead of defer
Oh man, I just realized this is in the wrong repo! Sorry I didn't pick up on that. Can you please make this change in https://github.com/kubernetes-sigs/hierarchical-namespaces instead? Sorry about that. The code hasn't changed very much (apart from the paths - the |
I didn't realize that either 😂, I've open another PR there kubernetes-sigs/hierarchical-namespaces#59. |
Yup! Closing this copy. /close |
@adrianludwin: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@adrianludwin PTAL, follow your pointers
verify that the rV is being copied
by now, because every resource in k8s will have aResourceVersion
.