Skip to content
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

Finalizing objects are mutable #77135

Closed
thockin opened this issue Apr 26, 2019 · 17 comments
Closed

Finalizing objects are mutable #77135

thockin opened this issue Apr 26, 2019 · 17 comments
Assignees
Labels
area/api Indicates an issue on api area. kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/network Categorizes an issue or PR as relevant to SIG Network. triage/unresolved Indicates an issue that can not or will not be resolved.

Comments

@thockin
Copy link
Member

thockin commented Apr 26, 2019

What happened:

Delete an object (Service in this case) with a finalizer. Mutate the Service.

What you expected to happen:

I expected an error.

Anything else we need to know?:

It's debatable whether this should be a blanket ban on mutability. Status seems important to mutate. Metadata too, probably. Maybe it should be resource-by-resource? E.g. chaning the ports or type of a Service should not be allowed when being deleted.

At the very minimum we should have guidance for resource implementors to follow on when to reject mutations and what error messages to deliver, or (if we think mutability is good) guidance that they must explicitly allow it.

@thockin thockin added kind/bug Categorizes issue or PR as related to a bug. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. labels Apr 26, 2019
@fedebongio
Copy link
Contributor

/assign @lavalamp

@yliaog
Copy link
Contributor

yliaog commented Apr 29, 2019

/cc

@lavalamp
Copy link
Member

I can see why you'd expect that, but it can be valid for system components to mutate the object (yes, even spec) as part of the shutdown process. So, it is risky to blanket-ban these modifications.

You can opt-in to a ban by e.g. explicitly setting deletion timestamp to nil in a patch or PUT; this will always fail validation if the object already has a deletion timestamp.

@MrHohn
Copy link
Member

MrHohn commented Apr 29, 2019

Humm..This may be problematic for service LB finalizer (kubernetes/enhancements#992) --- service controller might be cleaning up wrong resources. One specific case:

  • Delete LB type service with externalTrafficPolicy=Local.
  • (Before service controller gets a chance to process the deletion) Change service to externalTrafficPolicy=Cluster.
  • Service controller tries to cleanup resource based on name. But our naming scheme depends on how externalTrafficPolicy is configured. Hence it does cleanup on the wrong ones.
    (edited: turned out this may not be an issue if the cloud provider knows to cleanup both)

@thockin
Copy link
Member Author

thockin commented Apr 29, 2019 via email

@thockin
Copy link
Member Author

thockin commented Apr 29, 2019 via email

@thockin
Copy link
Member Author

thockin commented Apr 29, 2019 via email

@lavalamp
Copy link
Member

lavalamp commented Apr 29, 2019 via email

@thockin
Copy link
Member Author

thockin commented Apr 29, 2019 via email

@athenabot
Copy link

/triage unresolved

Comment /remove-triage unresolved when the issue is assessed and confirmed.

🤖 I am a bot run by @vllry. 👩‍🔬

@k8s-ci-robot k8s-ci-robot added the triage/unresolved Indicates an issue that can not or will not be resolved. label Apr 30, 2019
@athenabot
Copy link

@lavalamp
If this issue has been triaged, please comment /remove-triage unresolved.

If you aren't able to handle this issue, consider unassigning yourself and/or adding the help-wanted label.

🤖 I am a bot run by vllry. 👩‍🔬

@bgrant0607
Copy link
Member

I worry about creating resource instances in "limbo" state such that they can't be fixed, as with Allocs in Borgmaster.

The Service LB cleanup process sounds unsound. Changing the type and then immediately deleting would cause the same problem, no?

Why not create a finalizer specific to the types of resources being cleaned up? Or actually enumerate the resources somewhere? Or create a separate CR to represent the resources?

@bgrant0607 bgrant0607 added the area/api Indicates an issue on api area. label May 7, 2019
@thockin
Copy link
Member Author

thockin commented May 7, 2019 via email

@MrHohn
Copy link
Member

MrHohn commented May 10, 2019

The Service LB cleanup process sounds unsound. Changing the type and then immediately deleting would cause the same problem, no?

Good point.. I guess we haven't experienced such problem that much because service controller caches service's previous state. But with finalizer we plan to remove the cache layer, and will have to consider this case.

Why not create a finalizer specific to the types of resources being cleaned up? Or actually enumerate the resources somewhere? Or create a separate CR to represent the resources?

Sounds viable, though can't easily think of a non-cloud-provider specific solution out of this --- I guess the simplest version would be annotating service with the created resources (#70159) and make sure cloud controller does the cleanup and remove annotations?

@dims
Copy link
Member

dims commented May 14, 2019

Removing sig-arch tag, please re-tag us when there is a proposal or KEP

/remove-sig architecture

@k8s-ci-robot k8s-ci-robot removed the sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. label May 14, 2019
@athenabot
Copy link

@lavalamp
If this issue has been triaged, please comment /remove-triage unresolved.

If you aren't able to handle this issue, consider unassigning yourself and/or adding the help-wanted label.

🤖 I am a bot run by vllry. 👩‍🔬

@thockin thockin closed this as completed Jun 10, 2019
@MrHohn
Copy link
Member

MrHohn commented Jun 12, 2019

cc @bowei

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/network Categorizes an issue or PR as relevant to SIG Network. triage/unresolved Indicates an issue that can not or will not be resolved.
Projects
None yet
Development

No branches or pull requests

9 participants