-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
cluster quota to namespace mapping controller #9558
Conversation
9782f29
to
4015e85
Compare
4015e85
to
a63bde1
Compare
ClusterQuotaRecommendedName = "clusterquota" | ||
|
||
clusterQuotaLong = ` | ||
Create a deployment config that uses a given image. |
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.
just a reminder to fix all this up.
72afb8b
to
b0449ad
Compare
@deads2k - I won't have too much time today to dive deep into the cache side of things, but if i recall the complicated part of project cache was cluster acl changes requiring a full rebuild. I don't know if there is a similar style use case in your work here, but have not reasoned too deeply around it. |
@Kargakis alright, the algorithm is ready for review, but I've got a really cool race.
Neat, right? |
168c6ea
to
8276f5f
Compare
8276f5f
to
a24ce97
Compare
This is ready for review. I brought in 27341 because I was hitting races in my fuzzing unit test. I did not make our code do the work in the lock because we deadlocked I think I'd rather spend the time reworking onto shared informers instead of trying to fix the problem another way. |
[test] |
@stevekuznetsov I got
I'm pretty sure that go recommends anti-patterns like that. How do I make govet less strict? |
return err | ||
allQuotas, err1 := c.quotaLister.List(kapi.ListOptions{}) | ||
if err1 != nil { | ||
return err1 |
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.
This does seem silly, but your method is ~35 lines long and has indentation five levels deep. Maybe make your for{}
block a named function?
@deads2k left some comments on code refactors that might help, but mainly I have two things to say:
|
quotaapi "github.com/openshift/origin/pkg/quota/api" | ||
) | ||
|
||
type IndexerToNamespaceLister struct { |
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.
Shouldn't this lister be upstreamed?
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.
Shouldn't this lister be upstreamed?
Can I get a TODO? I think we need to move the entire InformerFactory
interface.
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.
Yes, that's fine.
// If the mapping cache is wrong and a previously deleted quota or namespace is created, this controller | ||
// correctly adds the items back to the list and clears out all previous mappings. | ||
// | ||
// In addition to those constraints, the timing threshold for actaully hitting this problem is really tight. It's |
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.
typo
054da9b
to
eb4bf26
Compare
comments addressed. |
eb4bf26
to
a180754
Compare
a180754
to
92f7e72
Compare
c.enqueueNamespace(cur) | ||
} | ||
func (c *ClusterQuotaMappingController) updateNamespace(old, cur interface{}) { | ||
c.enqueueNamespace(cur) |
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.
Do you need to enqueue in case there are no label changes for the namespace? Same question about quota without selector changes in its own update handler.
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.
Do you need to enqueue in case there are no label changes for the namespace? Same question about quota without selector changes in its own update handler.
The enqueue method is the spot that does that check since it is common to both the add and update paths.
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.
missed. cool
LGTM |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5542/) (Image: devenv-rhel7_4486) |
Evaluated for origin merge up to 92f7e72 |
[merge] |
re[test] |
Evaluated for origin test up to 92f7e72 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5542/) |
Third commit: Needs to be moved and lacks any tests, but I'm interested in whether anyone has concerns about intent.
@derekwaynecarr This is like a doubly-linked project authz cache that cannot rely resource versions since quota tracks status.
Also added a create clusterquota command that I'll probably split into another pull. This should match
create quota
if we ever make one.