Re: [kubernetes/kubernetes] Garbage collector behavior on invalid ownerReferences for existing uids across namespaces and across kinds is non-deterministic (#65200)

6 views
Skip to first unread message

Ted Yu

unread,
Oct 17, 2019, 4:06:29 PM10/17/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Should we pay attention to the performance impact due to the extra checks in the GC controller ?
Looking under pkg/controller/garbagecollector , I don't see any benchmark test.


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Ted Yu

unread,
Oct 18, 2019, 11:05:25 AM10/18/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

In GarbageCollector#attemptToDeleteItem :

		for _, dep := range deps {
			if dep.isDeletingDependents() {
...
				if _, err := gc.patch(item, patch, gc.unblockOwnerReferencesJSONMergePatch); err != nil {
					return err
				}
				break

I think we should continue with other dependents performing the unblocking (instead of breaking out of the loop).

Renmin

unread,
Oct 19, 2019, 4:43:11 AM10/19/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

/cc ironpan

Josiah Bjorgaard

unread,
Oct 26, 2019, 4:12:03 AM10/26/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Bug triage for release 1.17 here. Since this issue has been tagged for the milestone, we would like to check it's status. Code freeze is on Nov. 19. Will this issue be resolved before then? If not, we should move it out of the milestone.

Josiah Bjorgaard

unread,
Nov 10, 2019, 1:18:13 PM11/10/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

@liggitt Could you confirm the status of this issue with regard to v1.17 and the recent PR referencing it? Should we have that PR in the milestone?

Jordan Liggitt

unread,
Nov 11, 2019, 9:01:10 AM11/11/19
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

no, that PR is not planned to merge as is. the changes required to fix this issue are too risky for this point in the release, will defer to 1.18

/milestone v1.18

Gianluca Arbezzano

unread,
Jan 30, 2020, 2:26:19 AM1/30/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Hello @liggitt !
Bug Triage team here for the 1.18 release. This is a friendly reminder that code freeze is scheduled for 5 March. Is this issue still intended for milestone 1.18, or should it extend to the next one? Thanks in advance!

Ben Browning

unread,
Feb 7, 2020, 8:09:23 AM2/7/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

My team was just bitten by an otherwise-valid ownerRef from a namespace-scoped object to an object in a different namespace. This caused some things to get deleted that definitely should not have been deleted leading to all kinds of headaches. It's bad on us for creating this invalid ownerReference in one of our controllers, but it's worse on Kubernetes for letting us set it and then nuking the owner during GC just because the owned thing has a cross-namespace ownerRef.

This lets any user elevate their view permissions on an resource to delete permissions just by creating any other resource with careful ownerReferences and waiting on GC.

Jordan Liggitt

unread,
Feb 7, 2020, 9:30:42 AM2/7/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

nuking the owner during GC

To be clear, an ownerRef does not cause deletion of the owner

Jordan Liggitt

unread,
Feb 7, 2020, 9:32:17 AM2/7/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

I agree this is important to fix. I am looking into potential mitigations to make behavior in the presence of these ownerRefs more deterministic

Kane York

unread,
Feb 13, 2020, 2:58:44 PM2/13/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Can the apiserver block creation of these invalid cross-namespace ownerReferences?

Daniel Smith

unread,
Feb 13, 2020, 3:16:57 PM2/13/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Can the apiserver block creation of these invalid cross-namespace ownerReferences?

No, apiserver doesn't enforce references. For better or worse, but I don't see us starting now.

Gianluca Arbezzano

unread,
Feb 25, 2020, 10:09:30 AM2/25/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Hello @liggitt !
Bug Triage team here for the 1.18 release. This is a friendly reminder that code freeze is scheduled for 5 March. Is this issue still intended for milestone 1.18, or should it extend to the next one? Thanks in advance!

Silvia P.

unread,
Mar 5, 2020, 2:28:33 PM3/5/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

As we are now in code freeze for 1.18, I am moving this to the next milestone.
/milestone v1.19

Michael Morello

unread,
May 4, 2020, 11:01:54 AM5/4/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

We also hit this one. A user was copying some resources from a namespace to another, keeping the owner reference. When the controller manager restarted the garbage collector also deleted some PVCs in the original namespace 😕

@lavalamp

No, apiserver doesn't enforce references. For better or worse, but I don't see us starting now.

Any particular concern about rejecting creation/update of an object when the ownerReference does not exist in the namespace or at the cluster level ?

@liggitt

I agree this is important to fix. I am looking into potential mitigations to make behavior in the presence of these ownerRefs more deterministic

Could you share your thoughts ? At first I would say that a workaround would be to not only use the UID in the absentOwnerCache but also the namespace (for namespace scoped resources ofc) . It doesn't feel like a "clean" solution but it would prevent this issue ?

John T Skarbek

unread,
May 28, 2020, 1:52:58 PM5/28/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Hello, @jtslear here from Bug Triage! This issue has not been updated for a long time, so I'd like to check on the status. The code freeze is starting June 25th and while there is still plenty of time, we want to ensure that each PR has a chance to be merged on time.

As the issue is tagged for 1.19, is it still planned for this release?

Daniel Smith

unread,
May 29, 2020, 7:09:30 PM5/29/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Any particular concern about rejecting creation/update of an object when the ownerReference does not exist in the namespace or at the cluster level ?

Yes, it's much more complicated than it sounds like, e.g. the owning object might not exist in the apiserver, it might be in e.g. a different aggregated apiserver, which the apiserver handling the request doesn't know about.

John T Skarbek

unread,
Jun 15, 2020, 8:05:53 AM6/15/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

@kubernetes/sig-api-machinery-bugs

I haven't seen a followup on this issue for awhile. Is this still planned for the v1.19 release?

Chao Xu

unread,
Jun 17, 2020, 2:31:28 AM6/17/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

#78990 tried to add resource and namespace field to the ownerReference. It brings us one step closer to fix this issue. @deads2k do you have plan to revive that PR?

Jordan Liggitt

unread,
Jun 17, 2020, 2:33:57 AM6/17/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Could you share your thoughts ? At first I would say that a workaround would be to not only use the UID in the absentOwnerCache but also the namespace (for namespace scoped resources ofc) . It doesn't feel like a "clean" solution but it would prevent this issue ?

Something like that, probably the namespace+group+kind+uid coordinates. I had a quick proof of concept around this but hadn't satisfied myself that it behaved well in all conditions.

Chao Xu

unread,
Jun 17, 2020, 2:46:25 AM6/17/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Based on #65200 (comment), I see that we are not trying to validate the ownerReference during create/update, but trying to fix cache of gc to make its behavior deterministic, letting gc immediately delete the object if its ownerRef is pointing at wrong namespace/group/kind.

@liggitt can you share the corner cases when you are back?

John T Skarbek

unread,
Jul 15, 2020, 3:05:02 PM7/15/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Due to reaching the code freeze deadline, I'm going to bump this to the next release.

/milestone v1.20

Jordan Liggitt

unread,
Aug 5, 2020, 10:40:02 AM8/5/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

I'm working on a fix for this for the 1.20 timeframe

Sayan Chowdhury

unread,
Oct 24, 2020, 7:15:14 AM10/24/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

👋🏽 Hey @liggitt ! I'm from the Bug Triage team. This issue has not been updated for a while, so I'd like to check on the status. The code freeze is starting November 12th (about 3 weeks from now) and while there is still plenty of time, we want to ensure that each PR has a chance to be merged on time.

As the issue is tagged for 1.20, is it still planned for this release?

Jordan Liggitt

unread,
Oct 26, 2020, 9:19:19 AM10/26/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Yes, work on this is in progress for 1.20

Kubernetes Prow Robot

unread,
Nov 17, 2020, 3:14:26 PM11/17/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Closed #65200 via #92743.

Jordan Liggitt

unread,
Nov 17, 2020, 4:20:54 PM11/17/20
to kubernetes/kubernetes, k8s-mirror-api-machinery-bugs, Team mention

Fixed in 1.20 by #92743

Reply all
Reply to author
Forward
0 new messages