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

Controller framework #5270

Merged
merged 3 commits into from Apr 7, 2015
Merged

Controller framework #5270

merged 3 commits into from Apr 7, 2015

Conversation

lavalamp
Copy link
Member

DeltaFIFO has tests and is basically ready to go, I can send it in its own PR if others agree. The controller framework is not finished yet.

Addresses #4877

@pmorie
Copy link
Member

pmorie commented Mar 11, 2015

@lavalamp about to board a plane but i've fetched your code and will take a look.

@ironcladlou
Copy link
Contributor

@lavalamp made a pass at reviewing this- so far, so good. It's coming together nicely.

@derekwaynecarr
Copy link
Member

I focused on the controller framework commit and thought it looked like a nice improvement over what we have today. I am in the midst of writing a controller for namespace termination, so any ETA on when you think you want to mark this Ready? I assume the move to migrate existing controllers will be in subsequent PRs.

@lavalamp
Copy link
Member Author

@derekwaynecarr

I am in the midst of writing a controller for namespace termination, so any ETA on when you think you want to mark this Ready? I assume the move to migrate existing controllers will be in subsequent PRs.

Yeah, sorry, I got preempted by #5336. I hope to get that working and this working tomorrow...

@derekwaynecarr
Copy link
Member

No rush. I have something working that is consistent with others. I just liked this current controller :-)

Sent from my iPhone

On Mar 12, 2015, at 8:35 PM, Daniel Smith notifications@github.com wrote:

@derekwaynecarr

I am in the midst of writing a controller for namespace termination, so any ETA on when you think you want to mark this Ready? I assume the move to migrate existing controllers will be in subsequent PRs.

Yeah, sorry, I got preempted by #5336. I hope to get that working and this working tomorrow...


Reply to this email directly or view it on GitHub.

@lavalamp
Copy link
Member Author

I split off #5473 with changes that should be good to go, and updated this PR-- mostly the only new thing is a fake source so that I'll be able to test this thing. (should be very useful for anyone testing a controller, actually)

@bgrant0607
Copy link
Member

Also relevant: #5548.

@brendandburns
Copy link
Contributor

@lavalamp Given that the other PR merged, is this PR still relevant?

@lavalamp
Copy link
Member Author

lavalamp commented Apr 2, 2015

Yes, this has more stuff which is WIP. Hope to update this by EOD.

@lavalamp lavalamp changed the title WIP: DeltaFIFO & controller framework. Controller framework Apr 2, 2015
@lavalamp
Copy link
Member Author

lavalamp commented Apr 2, 2015

OK, this is mostly done and ready for a look. The Example() gets us to > 80% coverage but I will look at testing a few more cases.

@lavalamp
Copy link
Member Author

lavalamp commented Apr 3, 2015

@derekwaynecarr would you like to take a look?


// Let's implement a simple controller that just deletes
// everything that comes in.
Process: func(obj interface{}) error {
Copy link
Member

Choose a reason for hiding this comment

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

So if I want to use this in kube2sky, for example, do I literally just rip off most of this function? That still feels like a lot of boilerplate - easy to get wrong.

Can it be reduced to "call one function, passing a set of function pointers (or an interface), and have my functions called on add/delete/update" ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is a good point -- I can make this even easier for the common case.

@derekwaynecarr
Copy link
Member

looking, will also look from comments from @ironcladlou , @pmorie

// The queue for your objects; either a cache.FIFO or
// a cache.DeltaFIFO. Your Process() function should accept
// the output of this Oueue's Pop() method.
cache.Queue
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there ever a need for a controller to act on two objects instead of just one?

I thought I had use for two until @ironcladlou talked me into making a custom cache.Store and keep the controller processing just one object.

Copy link
Member

Choose a reason for hiding this comment

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

I had a case for more than one, but it was to build a in-memory cache, and does not need to be solved by this framework.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think most controllers have one object as a source. Multi-source controllers are out of scope for this framework.

Copy link
Member

Choose a reason for hiding this comment

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

Endpoint controller.

a) currently identified as a big problem
b) does not watch at all
c) really needs a local cache of all pods and all services

@derekwaynecarr
Copy link
Member

@lavalamp I am fine with the PR in current form if you want to merge and refine in a follow-on.

@lavalamp
Copy link
Member Author

lavalamp commented Apr 7, 2015

Yeah, let's get this in-- I want to use it to fix #6524.

I will address Tim's comment in a followup, and add an error handler in another followup.

@derekwaynecarr
Copy link
Member

SGTM, merging

derekwaynecarr added a commit that referenced this pull request Apr 7, 2015
@derekwaynecarr derekwaynecarr merged commit 6eb54e7 into kubernetes:master Apr 7, 2015
@lavalamp
Copy link
Member Author

lavalamp commented Apr 7, 2015

Thanks! followup for @thockin's request is in #6546

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.

None yet

9 participants