Only watched managed resources #715
Only watched managed resources #715
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marun 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 |
@shashidharatd @irfanurrehman I realized while working on this that it will fix #549 without further work. We had discussed making adoption optional, but I don't think that will be necessary. Resources have always only been deleted if they appear in the informer cache, and as of this PR only labeled resources will appear in that cache. I'll add a test to this PR that validates that a non-labeled resource in a given member cluster will not be deleted if a federated resource is created without placement for that cluster. |
Rebased |
1 similar comment
Rebased |
Added a new e2e test validating the behavior required by #549. |
Rebased on #736 |
Rebased |
LGTM |
@marun few nits and queries in test code, otherwise lgtm. |
@marun Just realised that this needs a rebase. Please rebase and I will merge. |
Label all resources created or updated by federation and ensure that the federated informer only watches for resources so labeled.
If the containing namespace of a propagated version is deleted, the request to create it will be denied with 403 and no further attempts to create should be attempted. This commit also stops logging version write errors as events, since version accounting is an internal detail of the sync controller.
Rebased |
/lgtm |
This PR labels managed resources with
federation.k8s.io/managed: true
and the federated informer will only watch resources so labeled. Existing resources will be updated to include the label, and this is implicitly tested by the crud test for namespaces (since the namespace in the host cluster exists and will be adopted).The label will be removed from namespaces in the host cluster in the event of a propagation change resulting in the host cluster not existing in the selected set. The label is not yet removed from a namespace in the host cluster when a FederatedNamespace is deleted. The label is also not yet removed from an orphaned resource. Both of these changes will be made in a subsequent PR that rewrites the deletion helper.
Fixes #549
TODO:
5th in a series targeting #612