-
Notifications
You must be signed in to change notification settings - Fork 40k
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 Plugin framework #6520
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
We definitely intend to convert replication controller manager to a plugin. #3058 (comment) |
return endpointsManagerName | ||
} | ||
|
||
func (plugin *endpointsManager) GetDefaultSyncPeriod() time.Duration { |
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.
Minor, but I think this should be DefaultSyncPeriod
and likewise for the others below that start with Get
.
http://golang.org/doc/effective_go.html#Getters
8348fc9
to
bc4ca05
Compare
I am on vacation for most of this week and for the rest of the time I have to focus on some non-Kubernetes work so I would prefer it if someone else reviewed this to avoid holding up this PR since I don't have the time in the coming days to do it justice. |
bc4ca05
to
a13e16e
Compare
|
8b7d07e
to
6011209
Compare
I will try to take a look at this tomorrow. |
Is this still RFC or should we update the title? |
Since I haven't gotten shotdown for turning controllers into plugins, I'll rename to WIP :) |
"time" | ||
) | ||
|
||
// ControllerPlugin is an interface to controller plugins that can be run |
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.
I would put this definition in plugins.go.
Optional: Consider just calling it Plugin, which is more go-idiomatic. Volumes are named as such to disambiguate between multiple kinds of plugin. I don't think we need that here.
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.
Moved and renamed.
NetworkPlugin doesn't follow this pattern, though its Host is named simply "Host".
GCE e2e build/test passed for commit a1a7ae3e4f006d4f5d9e589070c3079d63fd9313. |
a1a7ae3
to
b7e72b8
Compare
GCE e2e build/test failed for commit b7e72b84c19d7f2de398dfb1327c2aca9269ce44. |
b7e72b8
to
eea4c3b
Compare
GCE e2e build/test passed for commit eea4c3b. |
limitations under the License. | ||
*/ | ||
|
||
package controller |
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.
Move to a separate fake package?
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.
I can, but this follows the pattern in pkg/volume.
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 is part of raising the code quality bar. Test-only code should not be in non-test-only packages. We're guilty of it all over the place and we need to stop.
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.
Any other test package in the code can easily include the controller/testing pkg for the Fakes. I'll move this.
I'm not sure if I see the overall benefit to this. In kubelet, you have to have a way of plugging things in, and you have to be able to leverage that to calling out to other binaries when needed. But for controllers, there's no need for that later case, ever-- kube-controller-manager does not have to talk to frobber-controller-manager; if you want a 3rd party controller, you can just write one and run it as a separate binary, there's no need for a plug-in mechanism. I'm not saying I'm against this, either, necessarily. |
limitations under the License. | ||
*/ | ||
|
||
package controller |
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 should be in a controller/plugin/manager package, IMO.
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.
Cloudprovider, Network, and Volume all have their plugins.go and interfaces in the top level of the pkg. Why would this one be different?
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.
Well... this one will be different because we'll do it right. :)
More seriously, I'm very focused lately on getting the package dependency
tree into a sane state. This means separating interfaces like this so that
plugin code doesn't need to import manager code and vice versa. The
interfaces need to be in common packages, but no actual code should be.
On Mon, Sep 14, 2015 at 7:55 PM, Mark Turansky notifications@github.com
wrote:
In pkg/controller/plugins.go
#6520 (comment):+Copyright 2015 The Kubernetes Authors All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package controllerCloudprovider, Network, and Volume all have their plugins.go and
interfaces in the top level of the pkg. Why would this one be different?—
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/6520/files#r39470075.
@lavalamp thanks for all the feedback. I see a few good reasons for this PR. None earth shattering, but I think overall in the right direction.
That last one is difficult to do without the common runtime. |
Yeah, I think all of those are fine reasons. I guess I'll just point out On Mon, Sep 14, 2015 at 7:52 PM, Mark Turansky notifications@github.com
|
GCE e2e test build/test passed for commit eea4c3b. |
For contrib/mesos we have interest in this to get rid of our controller manager fork which includes quite some code duplication now. |
Closing this effort. |
This is a sketch for discussion. I'm curious to know if this is a desirable direction for kube-controller-manager.
Goals:
Optional: Potentially rename all controllers to something akin to "_Manager" or "_Synchronizer" to differentiate a process from a kind. Example: PersistentVolumeManager is the sync loop. PersistentVolumeController is a proposed Kind in the API that makes new PVs.
Genesis: I wrote a controller in which I thought I needed to reconcile 2 objects and didn't like the duplication required. It wasn't hard to genericize, after which I thought I'd take a shot at making all controllers work similarly. Porting endpoints_controller was very easy to do.
@thockin @bgrant0607