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

don't prevent updates that only touch ownerrefs #14816

Merged
merged 1 commit into from
Jun 23, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jun 21, 2017

fixes #14149

@deads2k
Copy link
Contributor Author

deads2k commented Jun 21, 2017

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 15766a1

@deads2k deads2k assigned tnozicka and unassigned mfojtik Jun 22, 2017
Copy link
Contributor

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

nits, one question - but looks good overall

@@ -46,6 +46,14 @@ func (a *buildByStrategy) Admit(attr admission.Attributes) error {
if buildapi.IsResourceOrLegacy("builds", gr) && attr.GetSubresource() == "details" {
return nil
}

// if this is an update, see if we are only updating the ownerRef. Garbage collection does this
Copy link
Contributor

Choose a reason for hiding this comment

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

s/if/If/
2 spaces before Garbage

Copy link
Contributor

Choose a reason for hiding this comment

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

Two spaces after a dot is an Americanism ;) Not to worry about.

}

for _, tc := range tests {
actual := IsOnlyMutatingOwnerRefs(tc.obj(), tc.old())
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k any reason not to call t.Run since we have go 1.7 (https://blog.golang.org/subtests)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deads2k any reason not to call t.Run since we have go 1.7 (https://blog.golang.org/subtests)

Just existing style. I'll keep it in mind moving forward.

@@ -49,7 +49,7 @@ func (d *sccExecRestrictions) Admit(a admission.Attributes) (err error) {

// TODO, if we want to actually limit who can use which service account, then we'll need to add logic here to make sure that
// we're allowed to use the SA the pod is using. Otherwise, user-A creates pod and user-B (who can't use the SA) can exec into it.
createAttributes := admission.NewAttributesRecord(pod, pod, kapi.Kind("Pod").WithVersion(""), a.GetNamespace(), a.GetName(), a.GetResource(), "", admission.Create, a.GetUserInfo())
createAttributes := admission.NewAttributesRecord(pod, nil, kapi.Kind("Pod").WithVersion(""), a.GetNamespace(), a.GetName(), a.GetResource(), "", admission.Create, a.GetUserInfo())
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k would you mind elaborating on this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deads2k would you mind elaborating on this change?

There is no old object. It was just a bug before.

// if this is an update, see if we are only updating the ownerRef. Garbage collection does this
// and we should allow it in general, since you had the power to update and the power to delete.
// The worst that happens is that you delete something, but you aren't controlling the privileged object itself
if a.GetOldObject() != nil && oadmission.IsOnlyMutatingOwnerRefs(a.GetObject(), a.GetOldObject()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k any chance we could check this only once for different objects? I am not optimistic but asking to be sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deads2k any chance we could check this only once for different objects? I am not optimistic but asking to be sure

I don't understand the question. I think this only happens once per admission plugin which is restricting updates with special/additional permissions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant if ownerRefs changes could be whitelisted for all objects without injecting it into specific admission plugins. First thing that comes to my mind is that we will add/modify admission an restrict it for some objects without knowing about it. We don't have any tests to make sure ownerRefs are editable.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2503/) (Base Commit: 0fba3e5) (PR Branch Commit: 15766a1)

Copy link
Contributor

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

lgtm;
it would be nice to have integration/extended test to make sure ownerRefs can be edited ideally for all objects

@deads2k
Copy link
Contributor Author

deads2k commented Jun 22, 2017

lgtm;
it would be nice to have integration/extended test to make sure ownerRefs can be edited ideally for all objects

Probably integration in openshift. Perhaps part of a larger GC test once we have more of the behavior locked down.

[merge]

@liggitt liggitt added this to the 3.6.0 milestone Jun 22, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Jun 23, 2017

re[merge][severity:blocker]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 15766a1

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 23, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1098/) (Base Commit: 4917a3e) (PR Branch Commit: 15766a1) (Extended Tests: blocker) (Image: devenv-rhel7_6392)

@openshift-bot openshift-bot merged commit d61e8be into openshift:master Jun 23, 2017
@deads2k deads2k deleted the gc-02-admissino branch August 3, 2017 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GC: admission plugins need to allow removing GC finalizer items
6 participants