Skip to content

delete templateinstances in foreground where necessary in extended tests#16979

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
jim-minter:issue16775-2
Oct 23, 2017
Merged

delete templateinstances in foreground where necessary in extended tests#16979
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
jim-minter:issue16775-2

Conversation

@jim-minter
Copy link
Copy Markdown
Contributor

@jim-minter jim-minter commented Oct 20, 2017

fixes #16775 (2nd attempt)
Proposing to comment out the previous "fix" in case it's superstition

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 20, 2017
@bparees
Copy link
Copy Markdown
Contributor

bparees commented Oct 20, 2017

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2017
@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2017
@bparees bparees added kind/bug Categorizes issue or PR as related to a bug. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 20, 2017
@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2017
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 20, 2017
@openshift-merge-robot openshift-merge-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2017

templateInstance := obj.(*templateapi.TemplateInstance)
oldTemplateInstance := old.(*templateapi.TemplateInstance)
// Decode Spec.Template.Objects on both obj and old to Unstructureds. This
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@deads2k or @liggitt ptal?

The Spec.Objects field of a v1.Template is a []RawExtension. The garbage collector gets TemplateInstances (which wrap Templates) into Unstructureds, then posts them back to update the finalisers. In this case the new Objects field received by the API server is semantically identical to the old one, but often the serialisation is different. We were previously rejecting the update because of this. Is this solution OK or is there a better alternative you can suggest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you give an example of this? I'd expect perfect fidelity when using unstructured objects.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you deserialise to Unstructured and re-serialise, it doesn't guarantee to maintain the order of keys in a json object. This was the example I found:

"old" value (fetched from etcd)
{"kind":"Secret","apiVersion":"v1","metadata":{"name":"secret1","creationTimestamp":null}}

"new" value (submitted by GC, been through the Unstructured mangler)
{"apiVersion":"v1","kind":"Secret","metadata":{"creationTimestamp":null,"name":"secret1"}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Spec.Objects field of a v1.Template is a []RawExtension. The garbage collector gets TemplateInstances (which wrap Templates) into Unstructureds, then posts them back to update the finalisers. In this case the new Objects field received by the API server is semantically identical to the old one, but often the serialisation is different. We were previously rejecting the update because of this. Is this solution OK or is there a better alternative you can suggest?

I'd open an issue and tag @ironcladlou or fix GC yourself to issue patches instead of updates.

Do you know what is wrong with the semantic equality check that causes it to fail on reordered json fields? https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/registry/rbac/helpers.go#L47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you know what is wrong with the semantic equality check that causes it to fail on reordered json fields?

They're []byte blobs where they're compared, not map[string]interface{}

@jim-minter
Copy link
Copy Markdown
Contributor Author

jim-minter commented Oct 20, 2017

/hold
for comment

@jim-minter jim-minter added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 20, 2017
@bparees
Copy link
Copy Markdown
Contributor

bparees commented Oct 23, 2017

/retest

@jim-minter jim-minter removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 23, 2017
@deads2k
Copy link
Copy Markdown
Contributor

deads2k commented Oct 23, 2017

/lgtm

The API already requires json, so this will only fail in already failing cases where the templates are unusable.

We should still try to make GC issue patches.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2017
@openshift-merge-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, deads2k, jim-minter

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

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@jim-minter
Copy link
Copy Markdown
Contributor Author

Upstream issue for GC issuing patches is kubernetes/kubernetes#54430

@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 8e73380 into openshift:master Oct 23, 2017
openshift-merge-robot added a commit that referenced this pull request Oct 23, 2017
Automatic merge from submit-queue (batch tested with PRs 17007, 17003, 17001, 17009).

wait for group cache in templateinstance tests

fixes #16654

(builds on #16979)

@gabemontero fyi
@bparees bparees removed their assignment Nov 9, 2017
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. kind/bug Categorizes issue or PR as related to a bug. 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.

[Conformance][templates] templateinstance security tests should pass security tests

6 participants