Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Sync object propagation on newly labeled namespaces #1488

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

yiqigao217
Copy link
Contributor

@yiqigao217 yiqigao217 commented Apr 27, 2021

Fix #1448

Detect namespace label changes. If the labels are updated, ensure
syncing all the objects (including non-existing yet but possible
propagated objects) in the namespace, so that we will not miss any
propagation label changes that should trigger propagation or
unpropagation.

Add integration tests in reconciler/object_test.go.

Tested manually that labeling and unlabeling a child with the propagate
label won't do anything before the fix, but triggers propagation and
unpropagation accordingly after the fix. Also tested with make test,
passed after the fix ant failed before the fix.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yiqigao217

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 27, 2021
@yiqigao217
Copy link
Contributor Author

yiqigao217 commented Apr 27, 2021

/hold
until the issue in the integration test is figured out.

@adrianludwin the newly-added integration test always passed, no matter before or after the fix. I guess the source object is somehow reconciled very frequently in the integration test environment, so it can sync propagated objects in children frequent enough that we cannot reproduce the result in #1448 before the fix. I'm not sure what else I can try to fix this integration test issue.

You can search for ??????? in the code to see two of my comments in the code.

Just to be clear, this PR fixed #1448 and worked as expected, but we need to fix the integration test to make it fail before the fix.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 27, 2021
@yiqigao217 yiqigao217 removed the request for review from Fei-Guo April 27, 2021 01:17
Copy link
Contributor

@adrianludwin adrianludwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any great ideas about why this isn't working - I'd just add a ton of log messages so you can see exactly what gets called and when and try to debug it that way (make sure you only submit the most essential messages though). E.g. with a reasonable sleep of 10s (which should show up nicely in the logs) you should be pretty sure that HNC is quiet, and so you'll be able to see why it's not behaving as you expect.

@adrianludwin
Copy link
Contributor

Maybe there's something special about adding a label via kubectl as opposed to updating the entire namespace via the client? I hope not, but it's possible.

Fix 1448

Detect namespace label changes. If the labels are updated, ensure
syncing all the objects (including non-existing yet but possible
propagated objects) in the namespace, so that we will not miss any
propagation label changes that should trigger propagation or
unpropagation.

Add integration tests in reconciler/object_test.go.

Tested manually that labeling and unlabeling a child with the propagate
label won't do anything before the fix, but triggers propagation and
unpropagation accordingly after the fix. Also tested with `make test`,
passed after the fix ant failed before the fix.
@yiqigao217
Copy link
Contributor Author

/hold cancel

/assign @adrianludwin
/assign @rjbez17

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 27, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 27, 2021
Copy link
Contributor

@adrianludwin adrianludwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/hold
/assign @rjbez17

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 27, 2021
@rjbez17
Copy link

rjbez17 commented Apr 29, 2021

/hold cancel
/lgtm

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit e1cbb6c into kubernetes-retired:master Apr 29, 2021
@adrianludwin adrianludwin added this to the hnc-v0.8 milestone Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HNC: propagate.hnc.x-k8s.io/select won't trigger object propagation on newly labelled namespaces
4 participants