Skip to content

Commit

Permalink
start breaking up controller manager into two pieces
Browse files Browse the repository at this point in the history
Addresses: kubernetes/enhancements#88

This commit starts breaking the controller manager into two pieces, namely,

1. cloudprovider dependent piece
2. coudprovider agnostic piece

the controller manager has the following control loops -

 - nodeController
 - volumeController
 - routeController
 - serviceController
 - replicationController
 - endpointController
 - resourcequotacontroller
 - namespacecontroller
 - deploymentController etc..

among the above controller loops,

 - nodeController
 - volumeController
 - routeController
 - serviceController

are cloud provider dependent. As kubernetes has evolved tremendously, it has become difficult
for different cloudproviders (currently 8), to make changes and iterate quickly. Moreover, the
cloudproviders are constrained by the kubernetes build/release lifecycle. This commit is the first
step in moving towards a kubernetes code base where cloud providers specific code will move out of
the core repository, and will be maintained by the cloud providers themselves.

I have added a new cloud provider called "external", which signals the controller-manager that
cloud provider specific loops are being run by another controller. I have added these changes in such
a way that the existing cloud providers are not affected. This change is completely backwards compatible, and
does not require any changes to the way kubernetes is run today.

Finally, along with the controller-manager, the kubelet also has cloud-provider specific code, and that will
be addressed in a different commit/issue.
  • Loading branch information
wlan0 committed Oct 6, 2016
1 parent 41f17bd commit 6f6b596
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
23 changes: 13 additions & 10 deletions cmd/kube-controller-manager/app/controllermanager.go
Expand Up @@ -290,17 +290,20 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
if err != nil {
glog.Warningf("Unsuccessful parsing of service CIDR %v: %v", s.ServiceCIDR, err)
}
nodeController, err := nodecontroller.NewNodeController(
sharedInformers.Pods(), sharedInformers.Nodes(), sharedInformers.DaemonSets(),
cloud, client("node-controller"),
s.PodEvictionTimeout.Duration, s.NodeEvictionRate, s.SecondaryNodeEvictionRate, s.LargeClusterSizeThreshold, s.UnhealthyZoneThreshold, s.NodeMonitorGracePeriod.Duration,
s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, serviceCIDR,
int(s.NodeCIDRMaskSize), s.AllocateNodeCIDRs)
if err != nil {
glog.Fatalf("Failed to initialize nodecontroller: %v", err)

if s.CloudProvider != "external" {
nodeController, err := nodecontroller.NewNodeController(
sharedInformers.Pods(), sharedInformers.Nodes(), sharedInformers.DaemonSets(),
cloud, client("node-controller"),
s.PodEvictionTimeout.Duration, s.NodeEvictionRate, s.SecondaryNodeEvictionRate, s.LargeClusterSizeThreshold, s.UnhealthyZoneThreshold, s.NodeMonitorGracePeriod.Duration,
s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, serviceCIDR,
int(s.NodeCIDRMaskSize), s.AllocateNodeCIDRs)
if err != nil {
glog.Fatalf("Failed to initialize nodecontroller: %v", err)
}
nodeController.Run()
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
}
nodeController.Run()
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))

serviceController, err := servicecontroller.New(cloud, client("service-controller"), s.ClusterName)
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions pkg/cloudprovider/plugins.go
Expand Up @@ -90,8 +90,12 @@ func InitCloudProvider(name string, configFilePath string) (Interface, error) {
var cloud Interface
var err error

if name == "" {
glog.Info("No cloud provider specified.")
if name == "" || name == "external" {
outputCloud := name
if outputCloud == "" {
outputCloud = "No"
}
glog.Infof("%s cloud provider specified.", outputCloud)
return nil, nil
}

Expand Down

0 comments on commit 6f6b596

Please sign in to comment.