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

Create default storage selection functions #15594

Merged
merged 3 commits into from
Aug 4, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Aug 1, 2017

Starts helping #15267 so that I never have to update a bajillion little methods that I don't care about.

@smarterclayton @liggitt @enj what do you think?

@openshift-merge-robot openshift-merge-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 1, 2017
if !ok {
return nil, nil, false, fmt.Errorf("not a ClusterPolicy")
}
return labels.Set(policy.ObjectMeta.Labels), authorizationapi.ClusterPolicyToSelectableFields(policy), policy.Initializers != nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a behavior change? authorizationapi.ClusterPolicyToSelectableFields is not the same as your generic method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this a behavior change? authorizationapi.ClusterPolicyToSelectableFields is not the same as your generic method?

Maybe I've been staring at this too long. Don't both map "metadata.name" to the value of Name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I've been staring at this too long. Don't both map "metadata.name" to the value of Name?

here: https://github.com/openshift/origin/blob/master/pkg/authorization/apis/authorization/fields.go#L7 . There's only one "special" one and I think I plumbed it through properly.


func (f AttrFunc) WithFieldMutation(fieldMutator FieldMutationFunc) AttrFunc {
return func(obj runtime.Object) (labels.Set, fields.Set, bool, error) {
labelSet, fieldSet, initialized, err := f(obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly concerned about the performance impact on this. It doesn't look bad, but this is called on every get and watch and list call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Slightly concerned about the performance impact on this. It doesn't look bad, but this is called on every get and watch and list call.

I specifically made a mutator instead of an "add" for the fieldSet to avoid allocations. The fields being returned are map, map, bool, err, which should be pointer, pointer, tiny, nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks ok for me performance wise. We have one map set more, which was maybe optimized by the compiler in the old code. But I don't think this matters.

@deads2k
Copy link
Contributor Author

deads2k commented Aug 1, 2017

@sttts You're a likely reviewer upstream. Seem reasonable?

attrFunc = storage.DefaultClusterScopedAttr
}
}
if e.PredicateFunc == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

now every Store gets a PredicateFunc. There shouldn't be side-effects I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now every Store gets a PredicateFunc. There shouldn't be side-effects I guess.

I don't think so. It was unconditionally used before.

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 "shouldn't".

@sttts
Copy link
Contributor

sttts commented Aug 2, 2017

Looked through this in detail. I also think the generic funcs plus the one exception are correct. Lgtm after half an hour staring.

@deads2k
Copy link
Contributor Author

deads2k commented Aug 2, 2017

Looked through this in detail. I also think the generic funcs plus the one exception are correct. Lgtm after half an hour staring.

Thanks. I'll open the upstream

@deads2k deads2k force-pushed the server-15-storage branch from 9c38d0c to c68bed4 Compare August 2, 2017 14:35
@enj
Copy link
Contributor

enj commented Aug 2, 2017

Changes look good but did you forget some unneeded attr funcs like OAuth clients, net namespace, etc?

@deads2k
Copy link
Contributor Author

deads2k commented Aug 3, 2017

Changes look good but did you forget some unneeded attr funcs like OAuth clients, net namespace, etc?

Forgot, no. Proof of principle, then a big pull to sweep.

Upstream is tagged for merge.

@deads2k deads2k added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Aug 3, 2017

/retest

@enj
Copy link
Contributor

enj commented Aug 3, 2017

/lgtm

We have unit tests to prevent regression on field selection correct?

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, enj

No associated issue. Update pull-request body to add a reference to an issue, or get approval with /approve no-issue

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

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

@0xmichalis
Copy link
Contributor

I had put all my faith that this PR would kick off our first postsubmits

/retest

@stevekuznetsov
Copy link
Contributor

/test extended_conformance_install_update

2 similar comments
@stevekuznetsov
Copy link
Contributor

/test extended_conformance_install_update

@stevekuznetsov
Copy link
Contributor

/test extended_conformance_install_update

@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 4, 2017

@deads2k: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_gce c68bed4 link /test extended_conformance_gce

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

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.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 15594, 15161, 15619, 15628)

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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants