Extend resyncPeriods in controllers in production.
This commit is contained in:
@@ -19,9 +19,11 @@ package controllermanager
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
@@ -72,6 +74,11 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.BoolVar(&s.UseHostPortEndpoints, "host_port_endpoints", s.UseHostPortEndpoints, "Map service endpoints to hostIP:hostPort instead of podIP:containerPort. Default true.")
|
||||
}
|
||||
|
||||
func (s *CMServer) resyncPeriod() time.Duration {
|
||||
factor := rand.Float64() + 1
|
||||
return time.Duration(float64(time.Hour) * 12.0 * factor)
|
||||
}
|
||||
|
||||
func (s *CMServer) Run(_ []string) error {
|
||||
if s.Kubeconfig == "" && s.Master == "" {
|
||||
glog.Warningf("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
|
||||
@@ -111,10 +118,10 @@ func (s *CMServer) Run(_ []string) error {
|
||||
endpoints := s.createEndpointController(kubeClient)
|
||||
go endpoints.Run(s.ConcurrentEndpointSyncs, util.NeverStop)
|
||||
|
||||
controllerManager := replicationcontroller.NewReplicationManager(kubeClient, replicationcontroller.BurstReplicas)
|
||||
go controllerManager.Run(s.ConcurrentRCSyncs, util.NeverStop)
|
||||
go replicationcontroller.NewReplicationManager(kubeClient, s.resyncPeriod, replicationcontroller.BurstReplicas).
|
||||
Run(s.ConcurrentRCSyncs, util.NeverStop)
|
||||
|
||||
go daemon.NewDaemonSetsController(kubeClient).
|
||||
go daemon.NewDaemonSetsController(kubeClient, s.resyncPeriod).
|
||||
Run(s.ConcurrentDSCSyncs, util.NeverStop)
|
||||
|
||||
//TODO(jdef) should eventually support more cloud providers here
|
||||
@@ -203,6 +210,6 @@ func (s *CMServer) createEndpointController(client *client.Client) kmendpoint.En
|
||||
return kmendpoint.NewEndpointController(client)
|
||||
}
|
||||
glog.V(2).Infof("Creating podIP:containerPort endpoint controller")
|
||||
stockEndpointController := kendpoint.NewEndpointController(client)
|
||||
stockEndpointController := kendpoint.NewEndpointController(client, s.resyncPeriod)
|
||||
return stockEndpointController
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func NewEndpointController(client *client.Client) *endpointController {
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
kservice.PodRelistPeriod,
|
||||
5*time.Minute,
|
||||
framework.ResourceEventHandlerFuncs{
|
||||
AddFunc: e.addPod,
|
||||
UpdateFunc: e.updatePod,
|
||||
|
||||
Reference in New Issue
Block a user