Skip to content

controller/render: fix deleting ownerReference - #318

Closed
jlebon wants to merge 2 commits into
openshift:masterfrom
jlebon:pr/owner-ref
Closed

jlebon wants to merge 2 commits into
openshift:masterfrom
jlebon:pr/owner-ref

Conversation

@jlebon

@jlebon jlebon commented Jan 16, 2019

Copy link
Copy Markdown
Member

We weren't actually deleting the ownerReference because CRDs don't yet
support strategic merges[1], which have the fancy $patch: delete
syntax. We were also specifying the wrong PatchType argument.

For now, just drop down to the vanilla JSONPatch[2] to do this.

[1] https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch
[2] https://tools.ietf.org/html/rfc6902

Related: #301

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 16, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlebon

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

The pull request process is described here

Details 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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2019
@ashcrow

ashcrow commented Jan 16, 2019 •

Copy link
Copy Markdown
Member

Is this meant for #301 (comment)?

@jlebon

jlebon commented Jan 16, 2019

Copy link
Copy Markdown
Member Author

Yup exactly! This is not strictly required in the immediate future. (I thought it'd be since I was going to make use of ownerReferences in order to fix #301, but I don't think that'll actually work). So we don't have to merge this right away.

@ashcrow

ashcrow commented Jan 16, 2019

Copy link
Copy Markdown
Member

Terraform failure flakes.

@cgwalters

Copy link
Copy Markdown
Member

OK the first patch here looks like a fairly obvious fix; and may actually explain a failure I've seen a few times where adding a MC generates only the worker but not master pool or vice versa.

Which is clearly required for upgrades and also just a general fix for MCs.

Let's split that into a separate PR?

@jlebon

jlebon commented Jan 17, 2019

Copy link
Copy Markdown
Member Author

Yeah, that one should be straightforward & low-risk. Split that into #321!

and may actually explain a failure I've seen a few times where adding a MC generates only the worker but not master pool or vice versa.

Hmm, I'm not sure. The only effect this fix should have is that the render controller should now keep trying to remove the pool's ownerReference from more MCs, instead of stopping at the first error. Since it's in the last thing it does in that function, the return wasn't actually skipping over anything else.

@cgwalters

Copy link
Copy Markdown
Member

Are you sure it was broken? I'm testing

diff --git a/pkg/controller/render/render_controller.go b/pkg/controller/render/render_controller.go
index 719dcf9..69db28f 100644
--- a/pkg/controller/render/render_controller.go
+++ b/pkg/controller/render/render_controller.go
@@ -486,6 +486,8 @@ func (ctrl *Controller) syncGeneratedMachineConfig(pool *mcfgv1.MachineConfigPoo
 			}
 			// Let's not make it fatal for now
 			glog.Warningf("Failed to delete ownerReference from %s: %v", gmc.Name, err)
+		} else {
+			glog.Infof("Queued for GC: %s", gmc.Name)
 		}
 	}

right now. We know something is doing a GC, and if it's not this...then I don't know.

@jlebon

jlebon commented Jan 18, 2019

Copy link
Copy Markdown
Member Author

Are you sure it was broken?

Pretty sure. You can see this by just omitting the second commit in this pull. You'll see an error like: Failed to delete ownerReference from 00-master: json: cannot unmarshal object into Go value of type jsonpatch.Patch. I.e. we were trying to POST a strategic merge patch as a JSONPatch. The second commit here fixes this by actually using a valid JSONPatch since strategic merge patches AFAIU aren't supported for CRDs yet.

@ashcrow

ashcrow commented Jan 18, 2019

Copy link
Copy Markdown
Member

/test e2e-aws

@cgwalters

cgwalters commented Jan 18, 2019 •

Copy link
Copy Markdown
Member

Looking at the MCC logs in the e2e-aws-op run, I don't see any errors about failing to patch the MC. So presumably with this patch we are now GC'ing them reliably.

(Did you test this locally? Does it cause MCs to be reliably GC'd?)

But now the problem is the lifetime will be too short.

@cgwalters

Copy link
Copy Markdown
Member

@jlebon can you cherry-pick 527ed16 into this PR?

I'd also say that we shouldn't merge this PR until we are confident about a strategy for GC.

jlebon and others added 2 commits January 18, 2019 14:39
We weren't actually deleting the ownerReference because CRDs don't yet
support strategic merges[1], which have the fancy `$patch: delete`
syntax. We were also specifying the wrong PatchType argument.

For now, just drop down to the vanilla JSONPatch[2] to do this.

[1] https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch
[2] https://tools.ietf.org/html/rfc6902

Related: openshift#301
Since something is doing that, and I want to know if it's somehow
succeeding.
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 18, 2019
@jlebon

jlebon commented Jan 18, 2019

Copy link
Copy Markdown
Member Author

Done! Though I tweaked the wording a bit since we're still testing the idea of whether deleting the ownerReference should cause a GC.

@jlebon

jlebon commented Jan 18, 2019

Copy link
Copy Markdown
Member Author

Looks like Terraform flake.
/test e2e-aws-op

@cgwalters

Copy link
Copy Markdown
Member

/hold
See discussion in #301

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 18, 2019
@cgwalters

Copy link
Copy Markdown
Member

Doing #347 first.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@jlebon: PR needs rebase.

Details

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.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 25, 2019
@ashcrow

ashcrow commented Jan 26, 2019

Copy link
Copy Markdown
Member

#347 merged.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@jlebon: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws 95c25b0 link /test e2e-aws
ci/prow/e2e-aws-op 95c25b0 link /test e2e-aws-op
ci/prow/e2e-aws-disruptive 95c25b0 link /test e2e-aws-disruptive
ci/prow/e2e-gcp-op 95c25b0 link /test e2e-gcp-op
ci/prow/e2e-aws-upgrade 95c25b0 link /test e2e-aws-upgrade
ci/prow/e2e-gcp-upgrade 95c25b0 link /test e2e-gcp-upgrade
ci/prow/e2e-vsphere 95c25b0 link /test e2e-vsphere
ci/prow/build-rpms-from-tar 95c25b0 link /test build-rpms-from-tar

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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.

@kikisdeliveryservice kikisdeliveryservice added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 3, 2019
@kikisdeliveryservice

Copy link
Copy Markdown
Contributor

In an effort to clean up the MCO repo, closing old open PRs with no activity.

Feel free to reopen.

@kikisdeliveryservice kikisdeliveryservice added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Dec 3, 2019
osherdp pushed a commit to osherdp/machine-config-operator that referenced this pull request Apr 13, 2021
Bug 1872080: add new okd e2e to validate okd vs. ocp content is installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants