Skip to content

Collapse authorization onto SharedInformer caches - #9442

Merged
openshift-bot merged 3 commits into
openshift:masterfrom
deads2k:si-02
Jun 23, 2016
Merged

openshift-bot merged 3 commits into
openshift:masterfrom
deads2k:si-02

Conversation

@deads2k

@deads2k deads2k commented Jun 20, 2016

Copy link
Copy Markdown
Contributor

Related to #9368

This removes the old authorization cache and replaces it with the "standard" shared informer caches. This makes it easy to wire in at higher levels, so this also picked up the rules review and other refs that were using the raw registries unnecessarily.

@smarterclayton makes it easier to fix the authorization problem and removes at least two duplicate caches.
@mfojtik got a reviewer in mind? All I can really say for myself is that it removed more lines that it added.

@deads2k

deads2k commented Jun 20, 2016

Copy link
Copy Markdown
Contributor Author

[test]

@smarterclayton

Copy link
Copy Markdown
Contributor

Tests pass, must be good {merge}.

Just kidding.

On Jun 20, 2016, at 4:53 PM, OpenShift Bot [email protected] wrote:

continuous-integration/openshift-jenkins/test SUCCESS (
https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5124/)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9442 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABG_p24U0Tg8cumWBuYGBkN4yT4uUBeBks5qNv3AgaJpZM4I6CxI
.

@deads2k

deads2k commented Jun 21, 2016

Copy link
Copy Markdown
Contributor Author

Added mutation detector. This is going to work on the first try too! :)

@mfojtik

mfojtik commented Jun 22, 2016

Copy link
Copy Markdown
Contributor

@smarterclayton or @liggitt will be good review candidates :-)

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 22, 2016
@deads2k

deads2k commented Jun 22, 2016

Copy link
Copy Markdown
Contributor Author

@Kargakis this pull includes checks for protection against accidental mutation that I'd like to get in before converting too many controllers. Care to take a look?

@0xmichalis 0xmichalis self-assigned this Jun 22, 2016
@0xmichalis

Copy link
Copy Markdown
Contributor

I will review this tomorrow

@smarterclayton

Copy link
Copy Markdown
Contributor

Make setup_server_vars read KUBE_CACHE_MUTATION_DETECTOR (default to true) so that we can turn it off. Flooded the logs.

policy.sh line 22 uses '*' which doesn't work on mac, use '.*' from 234f803

@smarterclayton

Copy link
Copy Markdown
Contributor

Next performance problem isn't yours - we're not properly generating conversions based on functions that are also generated upstream (we ignore them during scanning). So this looks like it fixed the big problem.

@smarterclayton

Copy link
Copy Markdown
Contributor

But the performance problem after that is:

        0     0% 0.033%    9202378 36.34%  github.com/openshift/origin/pkg/authorization/registry/clusterpolicy.(*storage).GetClusterPolicy
     14659 0.058% 0.091%    8639500 34.11%  k8s.io/kubernetes/pkg/runtime/serializer/json.(*Serializer).Decode
         0     0% 0.091%    8523402 33.66%  github.com/ugorji/go/codec.(*Decoder).Decode
         0     0% 0.091%    8523402 33.66%  github.com/ugorji/go/codec.(*Decoder).decode
         0     0% 0.091%    8348217 32.96%  github.com/ugorji/go/codec.(*Decoder).decodeI
   1599096  6.31%  6.41%    8331261 32.90%  github.com/ugorji/go/codec.(*decFnInfo).kStruct
         0     0%  6.41%    8199697 32.38%  github.com/ugorji/go/codec.(*Decoder).decodeValue
      5773 0.023%  6.43%    7907543 31.22%  k8s.io/kubernetes/pkg/runtime/serializer/recognizer.(*decoder).Decode
         0     0%  6.43%    7747725 30.59%  github.com/ugorji/go/codec.(*decFnInfo).kSlice
   5990754 23.66% 30.08%    6015374 23.75%  reflect.Value.call
         0     0% 30.08%    6005989 23.72%  reflect.Value.Call
         0     0% 30.08%    5822174 22.99%  github.com/openshift/origin/pkg/authorization/registry/clusterpolicy.ReadOnlyClusterPolicy.Get
     32485  0.13% 30.21%    5470939 21.60%  k8s.io/kubernetes/pkg/conversion.(*Converter).doConversion
     21630 0.085% 30.30%    5437367 21.47%  k8s.io/kubernetes/pkg/conversion.(*Converter).Convert
     16419 0.065% 30.36%    5327760 21.04%  k8s.io/kubernetes/pkg/conversion.(*Converter).defaultConvert
      2048 0.0081% 30.37%    5300805 20.93%  k8s.io/kubernetes/pkg/conversion.(*Converter).convertKV
         0     0% 30.37%    5214307 20.59%  k8s.io/kubernetes/pkg/conversion.(*Converter).DefaultConvert
         0     0% 30.37%    5214307 20.59%  k8s.io/kubernetes/pkg/conversion.(*scope).DefaultConvert

The dominator call to GetClusterPolicy

                                           5818843 63.40% |   github.com/openshift/origin/pkg/authorization/registry/clusterpolicy.ReadOnlyClusterPolicy.Get
                                           3359638 36.60% |   github.com/openshift/origin/pkg/authorization/registry/clusterpolicy.(*simulatedStorage).GetPolicy
         0     0% 0.0051%    9202378 36.34%                | github.com/openshift/origin/pkg/authorization/registry/clusterpolicy.(*storage).GetClusterPolicy
                                           9202378   100% |   k8s.io/kubernetes/pkg/registry/generic/registry.(*Store).Get

@smarterclayton

Copy link
Copy Markdown
Contributor

It looks like GetClusterPolicy is being called way more times than you think it should be called.


item, exists, getErr := i.GetIndexer().GetByKey(key)
if getErr != nil {
return &authorizationapi.ClusterPolicyBinding{}, getErr

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.

Is there a reason not to return nil?

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.

Is there a reason not to return nil?

No, will update.

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

It looks like GetClusterPolicy is being called way more times than you think it should be called.

Alright, I think I'd like to get this in without adding to it. Next pull?


// Must start policy caching immediately
oc.Informers.StartCore(utilwait.NeverStop)
oc.RunGroupCache()

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.

If you are going to move these in StartCore as well, open a separate issue.

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 are going to move these in StartCore as well, open a separate issue.

Those are more controllers than caches. I'm hoping to avoid moving them.

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

comments addressed.

@0xmichalis

Copy link
Copy Markdown
Contributor

LGTM

@smarterclayton

Copy link
Copy Markdown
Contributor

Yeah, please make it a high priority though.

Comment thread hack/lib/util/environment.sh Outdated
# - export NODE_CONFIG_DIR
function os::util::environment::setup_server_vars() {
# turn on cache mutation detector every time we start a server
export KUBE_CACHE_MUTATION_DETECTOR=true

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.

Default this to true, but allow it to be overriden.

@smarterclayton

Copy link
Copy Markdown
Contributor

Can you fix the policy.sh problem so that I don't have to open a separate issue

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

Can you fix the policy.sh problem so that I don't have to open a separate issue

Ah, who uses a mac? :)

Yeah.

@smarterclayton

Copy link
Copy Markdown
Contributor

Thanks - technically we can blame grep.

On Thu, Jun 23, 2016 at 8:35 AM, David Eads [email protected]
wrote:

Can you fix the policy.sh problem so that I don't have to open a separate
issue

Ah, who uses a mac? :)

Yeah.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9442 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABG_p_quzlFgFMlfBpuGdWDb1gvFu178ks5qOn2UgaJpZM4I6CxI
.

# - export NODE_CONFIG_DIR
function os::util::environment::setup_server_vars() {
# turn on cache mutation detector every time we start a server
KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"

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.

@Kargakis I don't speak bash very well, this does what I think it does, right? Defaults to true if its not set, but allows setting KUBE_CACHE_MUTATION_DETECTOR=false hack/test-cmd.sh

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.

Yes.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 23, 2016
@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

openshift-bot commented Jun 23, 2016 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5322/) (Image: devenv-rhel7_4445)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 7c4fc5a

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

#9512 re[test]

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

#7706 [merge]

@deads2k

deads2k commented Jun 23, 2016

Copy link
Copy Markdown
Contributor Author

#9503 re[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 7c4fc5a

@openshift-bot

Copy link
Copy Markdown
Contributor

@openshift-bot
openshift-bot merged commit 3926906 into openshift:master Jun 23, 2016
@deads2k
deads2k deleted the si-02 branch September 6, 2016 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants