-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Make List Projects authorization aware #971
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
Conversation
pkg/project/auth/locker.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a WeakHashMap construct in Go? That makes a Locker easier to reason about since you never have to worry about deletion logic. Once the references are gone, the object can be GC'ed. Otherwise, you'll need a sort of ref counter prior to delete to protect from multiple GetOrCreates racing with a Delete on a different thread and ending up with different locks on each thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not seen that, but yes, good point on ref counters needed for each lock
Sent from my iPhone
On Feb 11, 2015, at 8:32 AM, David Eads [email protected] wrote:
In pkg/project/auth/locker.go:
return keyLock- }
- l.lock.RUnlock()
- // we need to create one
- keyLock = &sync.RWMutex{}
- l.lock.Lock()
- defer l.lock.Unlock()
- l.items[key] = keyLock
- return keyLock
+}
+// Delete the lock for the specified key
+func (l *locker) Delete(key string) {
Is there a WeakHashMap construct in Go? That makes a Locker easier to reason about since you never have to worry about deletion logic. Once the references are gone, the object can be GC'ed. Otherwise, you'll need a sort of ref counter prior to delete to protect from multiple GetOrCreates racing with a Delete on a different thread and ending up with different locks on each thread.—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will probably make Delete be a Release func and ensure its called after every GetOrCreate. Will probably rename GetOrCreate to Acquire.
Sent from my iPhone
On Feb 11, 2015, at 8:32 AM, David Eads [email protected] wrote:
In pkg/project/auth/locker.go:
return keyLock- }
- l.lock.RUnlock()
- // we need to create one
- keyLock = &sync.RWMutex{}
- l.lock.Lock()
- defer l.lock.Unlock()
- l.items[key] = keyLock
- return keyLock
+}
+// Delete the lock for the specified key
+func (l *locker) Delete(key string) {
Is there a WeakHashMap construct in Go? That makes a Locker easier to reason about since you never have to worry about deletion logic. Once the references are gone, the object can be GC'ed. Otherwise, you'll need a sort of ref counter prior to delete to protect from multiple GetOrCreates racing with a Delete on a different thread and ending up with different locks on each thread.—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will probably make Delete be a Release func and ensure its called after every GetOrCreate. Will probably rename GetOrCreate to Acquire.
Sounds good.
bd7b88c to
2c7fcbd
Compare
pkg/project/auth/cache.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either scope items in the for loop or name it more precisely. The reuse makes it harder to read.
4e27842 to
86ab35f
Compare
|
Prerequsite PR: #1038 |
a18d41c to
ccda543
Compare
|
This is ready for review. It cannot be merged until the following are merged:
A user is able to create a project, and not see the project in a list until the sync runs. |
a9c0190 to
9d3bb85
Compare
|
For #1049 @deads2k can you add tests to RAR that prevent this from being broken again?
|
4d1c4d3 to
16a0674
Compare
|
This works now. Note: E0218 14:17:21.322616 26099 resthandler.go:351] error generating link: unable to find object fields on reflect.Value{typ:(*reflect.rtype)(0x1159cc0), ptr:(unsafe.Pointer)(0xc208fdd6e0), flag:0xd9}: couldn't find Namespace field in api.TypeMeta{Kind:"", APIVersion:""}
E0218 14:17:21.442787 26099 resthandler.go:351] error generating link: unable to find object fields on reflect.Value{typ:(*reflect.rtype)(0x1159cc0), ptr:(unsafe.Pointer)(0xc2090a9380), flag:0xd9}: couldn't find Namespace field in api.TypeMeta{Kind:"", APIVersion:""}
E0218 14:17:21.578445 26099 resthandler.go:351] error generating link: unable to find object fields on reflect.Value{typ:(*reflect.rtype)(0x1159cc0), ptr:(unsafe.Pointer)(0xc208b72060), flag:0xd9}: couldn't find Namespace field in api.TypeMeta{Kind:"", APIVersion:""}
E0218 14:17:21.703789 26099 resthandler.go:351] error generating link: unable to find object fields on reflect.Value{typ:(*reflect.rtype)(0x1159cc0), ptr:(unsafe.Pointer)(0xc208d3fa40), flag:0xd9}: couldn't find Namespace field in api.TypeMeta{Kind:"", APIVersion:""}Conceptually, you will see one of those messages whenever you add/modify namespace, policy, binding. |
16a0674 to
4c5aeae
Compare
|
Ignore my previous comment on log spams now, the log level for that issue has been reduced. |
|
gofmt? |
pkg/project/auth/cache.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're indexing by name, but retrieving by UID so no projects ever get returned back. Switching this to GetName() makes it work properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix that up and try to get a unit test with different values to make sure it doesn't happen again.
4c5aeae to
c141b57
Compare
|
@deads2k - fixed up. thanks for the heads-up, for some reason thought we were using uid. |
|
This has not yet merged, so added a commit to fix the peg CPU, and added my project-spawner script |
|
FYI: Fixing that bad loop brought create time to < 4 minutes. It will improve more when @deads2k change goes in to further improve policy. CPU utilization is back down below 1% in steady state. |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/993/) (Image: devenv-fedora_852) |
|
Cache test fails gofmt |
|
ugh, gofmt rules change with goversions |
|
Yeah, gofmt on 1.3 for now ----- Original Message -----
|
8188fb0 to
7ec2da1
Compare
|
that was a pain to figure out, but should be fixed now. |
|
[Test]ing while waiting on the merge queue |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_openshift3/1129/) |
|
I forgot to fix my integration test will do that now. Sent from my iPhone
|
7ec2da1 to
3fb1a4d
Compare
|
Well, now hack/test-cmd.sh looks to have flaked because it looks to work fine for me locally. |
|
[Test] |
|
Passed test so re [Merge] |
|
Evaluated for origin up to 3fb1a4d |
Merged by openshift-bot
|
Looks like the bulk of the performance issue is allocation and the CPU taken by GC - 23GB (33% of CPU) allocated by create project spawner, only 20MB actually allocated at any one time. Sample below of alloc_total was over 30 seconds while project spawner was running: |
|
Also seeing this on startup @deads2k ? |
|
Probably the loop to ensure the master policy namespace exists failing the first time because bootstrap policy doesn't exist yet |
|
Need to flip the ensure call order. I will submit a PR. Sent from my iPhone
|
|
1GB allocated per second is pretty impressive. |
|
We need a realistic workload to actually measure performance of the total system more accurately and make improvements moving forward. Measuring project and policy in isolation of the resources they hold is problematic. After all, once we start Let's chat how we can build a go library that can populate data and simulate load (which is really far more read heavy). May want to see if we can build a common core population library with upstream that we can then build around. Populate N namespaces each with X to Y pods, replication controllers, and services. This is a good topic for this weeks Kubernetes meet up as I think many groups building around the project are well served building against an anticipated data set. Once we have something, we should run and report those stats each sprint. On this topic though, the improvements are obvious and known.
I think 1-5 will get us a long way at getting a better understanding of the real system, but I suspect other issues will come up in other parts of the system at that point. Time to get hacking and measuring now that we have a working core :) Sent from my iPhone
|
|
----- Original Message -----
I don't think we can upgrade until the stability issues folks are seeing are addressed.
Honestly from the trace this is entirely GC load from allocations in policy. I don't even think we need to look at etcd until we get this down to something more accurate.
Don't you know whether you've had a watch passed? High water is one, but any change notification is sufficient.
The evaluation here definitely needs to start at the lower levels.
I think this is probably the first item.
I agree, this is last.
Like I said, generating 1GB of garbage is an achievement. Try that in Ruby... |
…service-catalog/' changes from 568a7b9..8f07b7b 8f07b7b origin: add required patches ee57bfb Cleanup of ups broker example + making controller follow the OSB API (openshift#807) 45a11ed Revert "Rename our resources to have ServiceCatalog prefix (openshift#1054)" (openshift#1061) 4e47ec1 Rename our resources to have ServiceCatalog prefix (openshift#1054) 2bb334a Rebase on 1.7 API machinery (openshift#944) 5780b59 Run broker reconciler when spec is changed. (openshift#1026) 9c22d04 Merge branch 'pr/1006' d077915 check number of expected events before dereferencing to avoid panic (openshift#1052) 90d615f Merge branch 'pr/1055' bb6d6d8 fix log output to use formatted output (openshift#1056) c7abc81 Adding examples to the README ccc93c9 Remove different-org rule for LGTM (openshift#1050) be04cd5 Allow for a period in the GUID of the External ID (openshift#1034) 8c246df Make it so that binding.spec.secretName defaults to binding name (openshift#851) 6745418 Bump OSB Client (openshift#1049) 8346a0d apiserver etcd healthcheck as suggested to address k/k#48215 (openshift#1039) 11d0d4a use GKE's latest 1.6.X cluster version for Jenkins (openshift#1036) 7d71b5b Cross-build all the things! 8ec0874 RBAC setup behind the aggregator. (openshift#936) 0864a2e Upsert retry loop for Secret, set/check ownerReference for Secret owned by Binding (openshift#979) 6be9886 add info about weekly calls (openshift#1027) a242b26 add OSB API Header version flag (openshift#1014) 66e2ce6 Update REVIEWING doc with changes to LGTM process (openshift#1016) 699e016 Writing the returned progress description from the broker (openshift#998) 02642f4 Adding target to test on the host (openshift#1020) 78ca572 v0.0.13 (openshift#1024) 9e79ec2 use GKE's default K8S version for Jenkins (openshift#1023) d3c915a Fix curl on API server start error (openshift#1015) b50be75 Merge branch 'pr/1013' 2c98ba1 Using tag URLs 687f091 Parameterizing the priority fields 34ed5cd update apiregistration yaml to v1.7 final (openshift#1011) 91fa1ad make e2e look for pods' existence before checking status (openshift#1012) 0f90705 explicitly disable leader election if it is not enabled (openshift#965) f5761e7 controller-manager health checks (openshift#694) da260f2 Add logging for normal Unbind errors (openshift#992) 4c916a5 make the apiserver test use tls (openshift#991) 1a62ecc refactor reconcileBroker (openshift#986) cc179bc Add logging for normal Bind errors (openshift#993) a1458dd add parameterization for user-broker image to e2e tests (openshift#995) fb15891 Bump OSB client (openshift#1000) 79d5206 v0.0.12 (openshift#996) 39c7407 Merge branch 'pr/975' a553b2d Merge branch 'pr/974' d573339 reconcileBinding error checking (openshift#973) 39a1061 Making events and actions checks generic (openshift#960) 73136a4 Bump osb client (openshift#971) 878a987 reconcileInstance error checking in unit-tests 4991d57 reconcileBroker error checking in unit-tests 9ed6812 Extract methods for binding test setup (openshift#961) b69a1ee Make ups-broker return valid unbind response (openshift#964) 8b37d2f Releasing 0.0.11 (openshift#962) 52fec8b Merge branch 'pr/954' d49cdeb Swap client 445fa71 Add dependency on pmorie/go-open-service-broker-client 9f743b2 Instructions for enabling API Aggregation (openshift#895) 512508d Use correct infof calls in controller_manager (openshift#950) 77943ba fix regex that determines if a tag is deployable (openshift#947) 8a226b8 Updates for v0.0.10 release (openshift#943) REVERT: 568a7b9 origin build: add origin tooling git-subtree-dir: cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog git-subtree-split: 8f07b7bbf3acb2b557f23596a92b5e775ae9321c
* Bump OSB client * Controller changes for OSB client bump
This PR adds support to to List Projects based on the user's authorization.