mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Split controller manager options from init
Make defaults and flags clearly distinct from initialization code.
This commit is contained in:
parent
ab6edd8170
commit
2326e2bae3
@ -19,19 +19,20 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
controllermgr "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||||
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewKubeControllerManager creates a new hyperkube Server object that includes the
|
// NewKubeControllerManager creates a new hyperkube Server object that includes the
|
||||||
// description and flags.
|
// description and flags.
|
||||||
func NewKubeControllerManager() *Server {
|
func NewKubeControllerManager() *Server {
|
||||||
s := controllermgr.NewCMServer()
|
s := options.NewCMServer()
|
||||||
|
|
||||||
hks := Server{
|
hks := Server{
|
||||||
SimpleUsage: "controller-manager",
|
SimpleUsage: "controller-manager",
|
||||||
Long: "A server that runs a set of active components. This includes replication controllers, service endpoints and nodes.",
|
Long: "A server that runs a set of active components. This includes replication controllers, service endpoints and nodes.",
|
||||||
Run: func(_ *Server, args []string) error {
|
Run: func(_ *Server, args []string) error {
|
||||||
return s.Run(args)
|
return app.Run(s)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
s.AddFlags(hks.Flags())
|
s.AddFlags(hks.Flags())
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||||
@ -53,7 +54,6 @@ import (
|
|||||||
servicecontroller "k8s.io/kubernetes/pkg/controller/service"
|
servicecontroller "k8s.io/kubernetes/pkg/controller/service"
|
||||||
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
|
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
|
||||||
"k8s.io/kubernetes/pkg/healthz"
|
"k8s.io/kubernetes/pkg/healthz"
|
||||||
"k8s.io/kubernetes/pkg/master/ports"
|
|
||||||
"k8s.io/kubernetes/pkg/serviceaccount"
|
"k8s.io/kubernetes/pkg/serviceaccount"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"k8s.io/kubernetes/pkg/util/wait"
|
"k8s.io/kubernetes/pkg/util/wait"
|
||||||
@ -64,93 +64,9 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CMServer is the main context object for the controller manager.
|
|
||||||
type CMServer struct {
|
|
||||||
Port int
|
|
||||||
Address net.IP
|
|
||||||
CloudProvider string
|
|
||||||
CloudConfigFile string
|
|
||||||
ConcurrentEndpointSyncs int
|
|
||||||
ConcurrentRCSyncs int
|
|
||||||
ConcurrentDSCSyncs int
|
|
||||||
ConcurrentJobSyncs int
|
|
||||||
ConcurrentResourceQuotaSyncs int
|
|
||||||
ConcurrentDeploymentSyncs int
|
|
||||||
ServiceSyncPeriod time.Duration
|
|
||||||
NodeSyncPeriod time.Duration
|
|
||||||
ResourceQuotaSyncPeriod time.Duration
|
|
||||||
NamespaceSyncPeriod time.Duration
|
|
||||||
PVClaimBinderSyncPeriod time.Duration
|
|
||||||
VolumeConfigFlags VolumeConfigFlags
|
|
||||||
TerminatedPodGCThreshold int
|
|
||||||
HorizontalPodAutoscalerSyncPeriod time.Duration
|
|
||||||
DeploymentControllerSyncPeriod time.Duration
|
|
||||||
MinResyncPeriod time.Duration
|
|
||||||
RegisterRetryCount int
|
|
||||||
NodeMonitorGracePeriod time.Duration
|
|
||||||
NodeStartupGracePeriod time.Duration
|
|
||||||
NodeMonitorPeriod time.Duration
|
|
||||||
NodeStatusUpdateRetry int
|
|
||||||
PodEvictionTimeout time.Duration
|
|
||||||
DeletingPodsQps float32
|
|
||||||
DeletingPodsBurst int
|
|
||||||
ServiceAccountKeyFile string
|
|
||||||
RootCAFile string
|
|
||||||
|
|
||||||
ClusterName string
|
|
||||||
ClusterCIDR net.IPNet
|
|
||||||
AllocateNodeCIDRs bool
|
|
||||||
EnableProfiling bool
|
|
||||||
|
|
||||||
Master string
|
|
||||||
Kubeconfig string
|
|
||||||
KubeAPIQPS float32
|
|
||||||
KubeAPIBurst int
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewCMServer creates a new CMServer with a default config.
|
|
||||||
func NewCMServer() *CMServer {
|
|
||||||
s := CMServer{
|
|
||||||
Port: ports.ControllerManagerPort,
|
|
||||||
Address: net.ParseIP("0.0.0.0"),
|
|
||||||
ConcurrentEndpointSyncs: 5,
|
|
||||||
ConcurrentRCSyncs: 5,
|
|
||||||
ConcurrentDSCSyncs: 2,
|
|
||||||
ConcurrentJobSyncs: 5,
|
|
||||||
ConcurrentResourceQuotaSyncs: 5,
|
|
||||||
ConcurrentDeploymentSyncs: 5,
|
|
||||||
ServiceSyncPeriod: 5 * time.Minute,
|
|
||||||
NodeSyncPeriod: 10 * time.Second,
|
|
||||||
ResourceQuotaSyncPeriod: 5 * time.Minute,
|
|
||||||
NamespaceSyncPeriod: 5 * time.Minute,
|
|
||||||
PVClaimBinderSyncPeriod: 10 * time.Minute,
|
|
||||||
HorizontalPodAutoscalerSyncPeriod: 30 * time.Second,
|
|
||||||
DeploymentControllerSyncPeriod: 30 * time.Second,
|
|
||||||
MinResyncPeriod: 12 * time.Hour,
|
|
||||||
RegisterRetryCount: 10,
|
|
||||||
PodEvictionTimeout: 5 * time.Minute,
|
|
||||||
NodeMonitorGracePeriod: 40 * time.Second,
|
|
||||||
NodeStartupGracePeriod: 60 * time.Second,
|
|
||||||
NodeMonitorPeriod: 5 * time.Second,
|
|
||||||
ClusterName: "kubernetes",
|
|
||||||
TerminatedPodGCThreshold: 12500,
|
|
||||||
VolumeConfigFlags: VolumeConfigFlags{
|
|
||||||
// default values here
|
|
||||||
PersistentVolumeRecyclerMinimumTimeoutNFS: 300,
|
|
||||||
PersistentVolumeRecyclerIncrementTimeoutNFS: 30,
|
|
||||||
PersistentVolumeRecyclerMinimumTimeoutHostPath: 60,
|
|
||||||
PersistentVolumeRecyclerIncrementTimeoutHostPath: 30,
|
|
||||||
EnableHostPathProvisioning: false,
|
|
||||||
},
|
|
||||||
KubeAPIQPS: 20.0,
|
|
||||||
KubeAPIBurst: 30,
|
|
||||||
}
|
|
||||||
return &s
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
|
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
|
||||||
func NewControllerManagerCommand() *cobra.Command {
|
func NewControllerManagerCommand() *cobra.Command {
|
||||||
s := NewCMServer()
|
s := options.NewCMServer()
|
||||||
s.AddFlags(pflag.CommandLine)
|
s.AddFlags(pflag.CommandLine)
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "kube-controller-manager",
|
Use: "kube-controller-manager",
|
||||||
@ -169,77 +85,11 @@ controller, and serviceaccounts controller.`,
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeConfigFlags is used to bind CLI flags to variables. This top-level struct contains *all* enumerated
|
func ResyncPeriod(s *options.CMServer) func() time.Duration {
|
||||||
// CLI flags meant to configure all volume plugins. From this config, the binary will create many instances
|
return func() time.Duration {
|
||||||
// of volume.VolumeConfig which are then passed to the appropriate plugin. The ControllerManager binary is the only
|
factor := rand.Float64() + 1
|
||||||
// part of the code which knows what plugins are supported and which CLI flags correspond to each plugin.
|
return time.Duration(float64(s.MinResyncPeriod.Nanoseconds()) * factor)
|
||||||
type VolumeConfigFlags struct {
|
}
|
||||||
PersistentVolumeRecyclerMinimumTimeoutNFS int
|
|
||||||
PersistentVolumeRecyclerPodTemplateFilePathNFS string
|
|
||||||
PersistentVolumeRecyclerIncrementTimeoutNFS int
|
|
||||||
PersistentVolumeRecyclerPodTemplateFilePathHostPath string
|
|
||||||
PersistentVolumeRecyclerMinimumTimeoutHostPath int
|
|
||||||
PersistentVolumeRecyclerIncrementTimeoutHostPath int
|
|
||||||
EnableHostPathProvisioning bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddFlags adds flags for a specific CMServer to the specified FlagSet
|
|
||||||
func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
|
|
||||||
fs.IntVar(&s.Port, "port", s.Port, "The port that the controller-manager's http service runs on")
|
|
||||||
fs.IPVar(&s.Address, "address", s.Address, "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
|
|
||||||
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. Empty string for no provider.")
|
|
||||||
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
|
|
||||||
fs.IntVar(&s.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", s.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")
|
|
||||||
fs.IntVar(&s.ConcurrentRCSyncs, "concurrent_rc_syncs", s.ConcurrentRCSyncs, "The number of replication controllers that are allowed to sync concurrently. Larger number = more reponsive replica management, but more CPU (and network) load")
|
|
||||||
fs.IntVar(&s.ConcurrentResourceQuotaSyncs, "concurrent-resource-quota-syncs", s.ConcurrentResourceQuotaSyncs, "The number of resource quotas that are allowed to sync concurrently. Larger number = more responsive quota management, but more CPU (and network) load")
|
|
||||||
fs.IntVar(&s.ConcurrentDeploymentSyncs, "concurrent-deployment-syncs", s.ConcurrentDeploymentSyncs, "The number of deployment objects that are allowed to sync concurrently. Larger number = more reponsive deployments, but more CPU (and network) load")
|
|
||||||
fs.DurationVar(&s.ServiceSyncPeriod, "service-sync-period", s.ServiceSyncPeriod, "The period for syncing services with their external load balancers")
|
|
||||||
fs.DurationVar(&s.NodeSyncPeriod, "node-sync-period", s.NodeSyncPeriod, ""+
|
|
||||||
"The period for syncing nodes from cloudprovider. Longer periods will result in "+
|
|
||||||
"fewer calls to cloud provider, but may delay addition of new nodes to cluster.")
|
|
||||||
fs.DurationVar(&s.ResourceQuotaSyncPeriod, "resource-quota-sync-period", s.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system")
|
|
||||||
fs.DurationVar(&s.NamespaceSyncPeriod, "namespace-sync-period", s.NamespaceSyncPeriod, "The period for syncing namespace life-cycle updates")
|
|
||||||
fs.DurationVar(&s.PVClaimBinderSyncPeriod, "pvclaimbinder-sync-period", s.PVClaimBinderSyncPeriod, "The period for syncing persistent volumes and persistent volume claims")
|
|
||||||
fs.DurationVar(&s.MinResyncPeriod, "min-resync-period", s.MinResyncPeriod, "The resync period in reflectors will be random between MinResyncPeriod and 2*MinResyncPeriod")
|
|
||||||
fs.StringVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS, "pv-recycler-pod-template-filepath-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS, "The file path to a pod definition used as a template for NFS persistent volume recycling")
|
|
||||||
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "pv-recycler-minimum-timeout-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "The minimum ActiveDeadlineSeconds to use for an NFS Recycler pod")
|
|
||||||
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "pv-recycler-increment-timeout-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "the increment of time added per Gi to ActiveDeadlineSeconds for an NFS scrubber pod")
|
|
||||||
fs.StringVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath, "pv-recycler-pod-template-filepath-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath, "The file path to a pod definition used as a template for HostPath persistent volume recycling. This is for development and testing only and will not work in a multi-node cluster.")
|
|
||||||
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath, "pv-recycler-minimum-timeout-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath, "The minimum ActiveDeadlineSeconds to use for a HostPath Recycler pod. This is for development and testing only and will not work in a multi-node cluster.")
|
|
||||||
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath, "pv-recycler-timeout-increment-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath, "the increment of time added per Gi to ActiveDeadlineSeconds for a HostPath scrubber pod. This is for development and testing only and will not work in a multi-node cluster.")
|
|
||||||
fs.BoolVar(&s.VolumeConfigFlags.EnableHostPathProvisioning, "enable-hostpath-provisioner", s.VolumeConfigFlags.EnableHostPathProvisioning, "Enable HostPath PV provisioning when running without a cloud provider. This allows testing and development of provisioning features. HostPath provisioning is not supported in any way, won't work in a multi-node cluster, and should not be used for anything other than testing or development.")
|
|
||||||
fs.IntVar(&s.TerminatedPodGCThreshold, "terminated-pod-gc-threshold", s.TerminatedPodGCThreshold, "Number of terminated pods that can exist before the terminated pod garbage collector starts deleting terminated pods. If <= 0, the terminated pod garbage collector is disabled.")
|
|
||||||
fs.DurationVar(&s.HorizontalPodAutoscalerSyncPeriod, "horizontal-pod-autoscaler-sync-period", s.HorizontalPodAutoscalerSyncPeriod, "The period for syncing the number of pods in horizontal pod autoscaler.")
|
|
||||||
fs.DurationVar(&s.DeploymentControllerSyncPeriod, "deployment-controller-sync-period", s.DeploymentControllerSyncPeriod, "Period for syncing the deployments.")
|
|
||||||
fs.DurationVar(&s.PodEvictionTimeout, "pod-eviction-timeout", s.PodEvictionTimeout, "The grace period for deleting pods on failed nodes.")
|
|
||||||
fs.Float32Var(&s.DeletingPodsQps, "deleting-pods-qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.")
|
|
||||||
fs.IntVar(&s.DeletingPodsBurst, "deleting-pods-burst", 10, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.")
|
|
||||||
fs.IntVar(&s.RegisterRetryCount, "register-retry-count", s.RegisterRetryCount, ""+
|
|
||||||
"The number of retries for initial node registration. Retry interval equals node-sync-period.")
|
|
||||||
fs.MarkDeprecated("register-retry-count", "This flag is currently no-op and will be deleted.")
|
|
||||||
fs.DurationVar(&s.NodeMonitorGracePeriod, "node-monitor-grace-period", s.NodeMonitorGracePeriod,
|
|
||||||
"Amount of time which we allow running Node to be unresponsive before marking it unhealty. "+
|
|
||||||
"Must be N times more than kubelet's nodeStatusUpdateFrequency, "+
|
|
||||||
"where N means number of retries allowed for kubelet to post node status.")
|
|
||||||
fs.DurationVar(&s.NodeStartupGracePeriod, "node-startup-grace-period", s.NodeStartupGracePeriod,
|
|
||||||
"Amount of time which we allow starting Node to be unresponsive before marking it unhealty.")
|
|
||||||
fs.DurationVar(&s.NodeMonitorPeriod, "node-monitor-period", s.NodeMonitorPeriod,
|
|
||||||
"The period for syncing NodeStatus in NodeController.")
|
|
||||||
fs.StringVar(&s.ServiceAccountKeyFile, "service-account-private-key-file", s.ServiceAccountKeyFile, "Filename containing a PEM-encoded private RSA key used to sign service account tokens.")
|
|
||||||
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
|
||||||
fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster")
|
|
||||||
fs.IPNetVar(&s.ClusterCIDR, "cluster-cidr", s.ClusterCIDR, "CIDR Range for Pods in cluster.")
|
|
||||||
fs.BoolVar(&s.AllocateNodeCIDRs, "allocate-node-cidrs", false, "Should CIDRs for Pods be allocated and set on the cloud provider.")
|
|
||||||
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
|
||||||
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
|
||||||
fs.StringVar(&s.RootCAFile, "root-ca-file", s.RootCAFile, "If set, this root certificate authority will be included in service account's token secret. This must be a valid PEM-encoded CA bundle.")
|
|
||||||
fs.Float32Var(&s.KubeAPIQPS, "kube-api-qps", s.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver")
|
|
||||||
fs.IntVar(&s.KubeAPIBurst, "kube-api-burst", s.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *CMServer) ResyncPeriod() time.Duration {
|
|
||||||
factor := rand.Float64() + 1
|
|
||||||
return time.Duration(float64(s.MinResyncPeriod.Nanoseconds()) * factor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func clientForUserAgentOrDie(config client.Config, userAgent string) *client.Client {
|
func clientForUserAgentOrDie(config client.Config, userAgent string) *client.Client {
|
||||||
@ -253,7 +103,7 @@ func clientForUserAgentOrDie(config client.Config, userAgent string) *client.Cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run runs the CMServer. This should never exit.
|
// Run runs the CMServer. This should never exit.
|
||||||
func (s *CMServer) Run(_ []string) error {
|
func Run(s *options.CMServer) error {
|
||||||
kubeconfig, err := clientcmd.BuildConfigFromFlags(s.Master, s.Kubeconfig)
|
kubeconfig, err := clientcmd.BuildConfigFromFlags(s.Master, s.Kubeconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -285,17 +135,17 @@ func (s *CMServer) Run(_ []string) error {
|
|||||||
glog.Fatal(server.ListenAndServe())
|
glog.Fatal(server.ListenAndServe())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go endpointcontroller.NewEndpointController(clientForUserAgentOrDie(*kubeconfig, "endpoint-controller"), s.ResyncPeriod).
|
go endpointcontroller.NewEndpointController(clientForUserAgentOrDie(*kubeconfig, "endpoint-controller"), ResyncPeriod(s)).
|
||||||
Run(s.ConcurrentEndpointSyncs, util.NeverStop)
|
Run(s.ConcurrentEndpointSyncs, util.NeverStop)
|
||||||
|
|
||||||
go replicationcontroller.NewReplicationManager(
|
go replicationcontroller.NewReplicationManager(
|
||||||
clientForUserAgentOrDie(*kubeconfig, "replication-controller"),
|
clientForUserAgentOrDie(*kubeconfig, "replication-controller"),
|
||||||
s.ResyncPeriod,
|
ResyncPeriod(s),
|
||||||
replicationcontroller.BurstReplicas,
|
replicationcontroller.BurstReplicas,
|
||||||
).Run(s.ConcurrentRCSyncs, util.NeverStop)
|
).Run(s.ConcurrentRCSyncs, util.NeverStop)
|
||||||
|
|
||||||
if s.TerminatedPodGCThreshold > 0 {
|
if s.TerminatedPodGCThreshold > 0 {
|
||||||
go gc.New(clientForUserAgentOrDie(*kubeconfig, "garbage-collector"), s.ResyncPeriod, s.TerminatedPodGCThreshold).
|
go gc.New(clientForUserAgentOrDie(*kubeconfig, "garbage-collector"), ResyncPeriod(s), s.TerminatedPodGCThreshold).
|
||||||
Run(util.NeverStop)
|
Run(util.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,19 +225,19 @@ func (s *CMServer) Run(_ []string) error {
|
|||||||
|
|
||||||
if containsResource(resources, "daemonsets") {
|
if containsResource(resources, "daemonsets") {
|
||||||
glog.Infof("Starting daemon set controller")
|
glog.Infof("Starting daemon set controller")
|
||||||
go daemon.NewDaemonSetsController(clientForUserAgentOrDie(*kubeconfig, "daemon-set-controller"), s.ResyncPeriod).
|
go daemon.NewDaemonSetsController(clientForUserAgentOrDie(*kubeconfig, "daemon-set-controller"), ResyncPeriod(s)).
|
||||||
Run(s.ConcurrentDSCSyncs, util.NeverStop)
|
Run(s.ConcurrentDSCSyncs, util.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
if containsResource(resources, "jobs") {
|
if containsResource(resources, "jobs") {
|
||||||
glog.Infof("Starting job controller")
|
glog.Infof("Starting job controller")
|
||||||
go job.NewJobController(clientForUserAgentOrDie(*kubeconfig, "job-controller"), s.ResyncPeriod).
|
go job.NewJobController(clientForUserAgentOrDie(*kubeconfig, "job-controller"), ResyncPeriod(s)).
|
||||||
Run(s.ConcurrentJobSyncs, util.NeverStop)
|
Run(s.ConcurrentJobSyncs, util.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
if containsResource(resources, "deployments") {
|
if containsResource(resources, "deployments") {
|
||||||
glog.Infof("Starting deployment controller")
|
glog.Infof("Starting deployment controller")
|
||||||
go deployment.NewDeploymentController(clientForUserAgentOrDie(*kubeconfig, "deployment-controller"), s.ResyncPeriod).
|
go deployment.NewDeploymentController(clientForUserAgentOrDie(*kubeconfig, "deployment-controller"), ResyncPeriod(s)).
|
||||||
Run(s.ConcurrentDeploymentSyncs, util.NeverStop)
|
Run(s.ConcurrentDeploymentSyncs, util.NeverStop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
182
cmd/kube-controller-manager/app/options/options.go
Normal file
182
cmd/kube-controller-manager/app/options/options.go
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
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 options provides the flags used for the controller manager.
|
||||||
|
//
|
||||||
|
// CAUTION: If you update code in this file, you may need to also update code
|
||||||
|
// in contrib/mesos/pkg/controllermanager/controllermanager.go
|
||||||
|
package options
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/master/ports"
|
||||||
|
|
||||||
|
"github.com/spf13/pflag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CMServer is the main context object for the controller manager.
|
||||||
|
type CMServer struct {
|
||||||
|
Port int
|
||||||
|
Address net.IP
|
||||||
|
CloudProvider string
|
||||||
|
CloudConfigFile string
|
||||||
|
ConcurrentEndpointSyncs int
|
||||||
|
ConcurrentRCSyncs int
|
||||||
|
ConcurrentDSCSyncs int
|
||||||
|
ConcurrentJobSyncs int
|
||||||
|
ConcurrentResourceQuotaSyncs int
|
||||||
|
ConcurrentDeploymentSyncs int
|
||||||
|
ServiceSyncPeriod time.Duration
|
||||||
|
NodeSyncPeriod time.Duration
|
||||||
|
ResourceQuotaSyncPeriod time.Duration
|
||||||
|
NamespaceSyncPeriod time.Duration
|
||||||
|
PVClaimBinderSyncPeriod time.Duration
|
||||||
|
VolumeConfigFlags VolumeConfigFlags
|
||||||
|
TerminatedPodGCThreshold int
|
||||||
|
HorizontalPodAutoscalerSyncPeriod time.Duration
|
||||||
|
DeploymentControllerSyncPeriod time.Duration
|
||||||
|
MinResyncPeriod time.Duration
|
||||||
|
RegisterRetryCount int
|
||||||
|
NodeMonitorGracePeriod time.Duration
|
||||||
|
NodeStartupGracePeriod time.Duration
|
||||||
|
NodeMonitorPeriod time.Duration
|
||||||
|
NodeStatusUpdateRetry int
|
||||||
|
PodEvictionTimeout time.Duration
|
||||||
|
DeletingPodsQps float32
|
||||||
|
DeletingPodsBurst int
|
||||||
|
ServiceAccountKeyFile string
|
||||||
|
RootCAFile string
|
||||||
|
|
||||||
|
ClusterName string
|
||||||
|
ClusterCIDR net.IPNet
|
||||||
|
AllocateNodeCIDRs bool
|
||||||
|
EnableProfiling bool
|
||||||
|
|
||||||
|
Master string
|
||||||
|
Kubeconfig string
|
||||||
|
KubeAPIQPS float32
|
||||||
|
KubeAPIBurst int
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeConfigFlags is used to bind CLI flags to variables. This top-level struct contains *all* enumerated
|
||||||
|
// CLI flags meant to configure all volume plugins. From this config, the binary will create many instances
|
||||||
|
// of volume.VolumeConfig which are then passed to the appropriate plugin. The ControllerManager binary is the only
|
||||||
|
// part of the code which knows what plugins are supported and which CLI flags correspond to each plugin.
|
||||||
|
type VolumeConfigFlags struct {
|
||||||
|
PersistentVolumeRecyclerMinimumTimeoutNFS int
|
||||||
|
PersistentVolumeRecyclerPodTemplateFilePathNFS string
|
||||||
|
PersistentVolumeRecyclerIncrementTimeoutNFS int
|
||||||
|
PersistentVolumeRecyclerPodTemplateFilePathHostPath string
|
||||||
|
PersistentVolumeRecyclerMinimumTimeoutHostPath int
|
||||||
|
PersistentVolumeRecyclerIncrementTimeoutHostPath int
|
||||||
|
EnableHostPathProvisioning bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCMServer creates a new CMServer with a default config.
|
||||||
|
func NewCMServer() *CMServer {
|
||||||
|
s := CMServer{
|
||||||
|
Port: ports.ControllerManagerPort,
|
||||||
|
Address: net.ParseIP("0.0.0.0"),
|
||||||
|
ConcurrentEndpointSyncs: 5,
|
||||||
|
ConcurrentRCSyncs: 5,
|
||||||
|
ConcurrentDSCSyncs: 2,
|
||||||
|
ConcurrentJobSyncs: 5,
|
||||||
|
ConcurrentResourceQuotaSyncs: 5,
|
||||||
|
ConcurrentDeploymentSyncs: 5,
|
||||||
|
ServiceSyncPeriod: 5 * time.Minute,
|
||||||
|
NodeSyncPeriod: 10 * time.Second,
|
||||||
|
ResourceQuotaSyncPeriod: 5 * time.Minute,
|
||||||
|
NamespaceSyncPeriod: 5 * time.Minute,
|
||||||
|
PVClaimBinderSyncPeriod: 10 * time.Minute,
|
||||||
|
HorizontalPodAutoscalerSyncPeriod: 30 * time.Second,
|
||||||
|
DeploymentControllerSyncPeriod: 30 * time.Second,
|
||||||
|
MinResyncPeriod: 12 * time.Hour,
|
||||||
|
RegisterRetryCount: 10,
|
||||||
|
PodEvictionTimeout: 5 * time.Minute,
|
||||||
|
NodeMonitorGracePeriod: 40 * time.Second,
|
||||||
|
NodeStartupGracePeriod: 60 * time.Second,
|
||||||
|
NodeMonitorPeriod: 5 * time.Second,
|
||||||
|
ClusterName: "kubernetes",
|
||||||
|
TerminatedPodGCThreshold: 12500,
|
||||||
|
VolumeConfigFlags: VolumeConfigFlags{
|
||||||
|
// default values here
|
||||||
|
PersistentVolumeRecyclerMinimumTimeoutNFS: 300,
|
||||||
|
PersistentVolumeRecyclerIncrementTimeoutNFS: 30,
|
||||||
|
PersistentVolumeRecyclerMinimumTimeoutHostPath: 60,
|
||||||
|
PersistentVolumeRecyclerIncrementTimeoutHostPath: 30,
|
||||||
|
EnableHostPathProvisioning: false,
|
||||||
|
},
|
||||||
|
KubeAPIQPS: 20.0,
|
||||||
|
KubeAPIBurst: 30,
|
||||||
|
}
|
||||||
|
return &s
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFlags adds flags for a specific CMServer to the specified FlagSet
|
||||||
|
func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
|
||||||
|
fs.IntVar(&s.Port, "port", s.Port, "The port that the controller-manager's http service runs on")
|
||||||
|
fs.IPVar(&s.Address, "address", s.Address, "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
|
||||||
|
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. Empty string for no provider.")
|
||||||
|
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
|
||||||
|
fs.IntVar(&s.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", s.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")
|
||||||
|
fs.IntVar(&s.ConcurrentRCSyncs, "concurrent_rc_syncs", s.ConcurrentRCSyncs, "The number of replication controllers that are allowed to sync concurrently. Larger number = more reponsive replica management, but more CPU (and network) load")
|
||||||
|
fs.IntVar(&s.ConcurrentResourceQuotaSyncs, "concurrent-resource-quota-syncs", s.ConcurrentResourceQuotaSyncs, "The number of resource quotas that are allowed to sync concurrently. Larger number = more responsive quota management, but more CPU (and network) load")
|
||||||
|
fs.IntVar(&s.ConcurrentDeploymentSyncs, "concurrent-deployment-syncs", s.ConcurrentDeploymentSyncs, "The number of deployment objects that are allowed to sync concurrently. Larger number = more reponsive deployments, but more CPU (and network) load")
|
||||||
|
fs.DurationVar(&s.ServiceSyncPeriod, "service-sync-period", s.ServiceSyncPeriod, "The period for syncing services with their external load balancers")
|
||||||
|
fs.DurationVar(&s.NodeSyncPeriod, "node-sync-period", s.NodeSyncPeriod, ""+
|
||||||
|
"The period for syncing nodes from cloudprovider. Longer periods will result in "+
|
||||||
|
"fewer calls to cloud provider, but may delay addition of new nodes to cluster.")
|
||||||
|
fs.DurationVar(&s.ResourceQuotaSyncPeriod, "resource-quota-sync-period", s.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system")
|
||||||
|
fs.DurationVar(&s.NamespaceSyncPeriod, "namespace-sync-period", s.NamespaceSyncPeriod, "The period for syncing namespace life-cycle updates")
|
||||||
|
fs.DurationVar(&s.PVClaimBinderSyncPeriod, "pvclaimbinder-sync-period", s.PVClaimBinderSyncPeriod, "The period for syncing persistent volumes and persistent volume claims")
|
||||||
|
fs.DurationVar(&s.MinResyncPeriod, "min-resync-period", s.MinResyncPeriod, "The resync period in reflectors will be random between MinResyncPeriod and 2*MinResyncPeriod")
|
||||||
|
fs.StringVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS, "pv-recycler-pod-template-filepath-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS, "The file path to a pod definition used as a template for NFS persistent volume recycling")
|
||||||
|
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "pv-recycler-minimum-timeout-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "The minimum ActiveDeadlineSeconds to use for an NFS Recycler pod")
|
||||||
|
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "pv-recycler-increment-timeout-nfs", s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "the increment of time added per Gi to ActiveDeadlineSeconds for an NFS scrubber pod")
|
||||||
|
fs.StringVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath, "pv-recycler-pod-template-filepath-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath, "The file path to a pod definition used as a template for HostPath persistent volume recycling. This is for development and testing only and will not work in a multi-node cluster.")
|
||||||
|
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath, "pv-recycler-minimum-timeout-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath, "The minimum ActiveDeadlineSeconds to use for a HostPath Recycler pod. This is for development and testing only and will not work in a multi-node cluster.")
|
||||||
|
fs.IntVar(&s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath, "pv-recycler-timeout-increment-hostpath", s.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath, "the increment of time added per Gi to ActiveDeadlineSeconds for a HostPath scrubber pod. This is for development and testing only and will not work in a multi-node cluster.")
|
||||||
|
fs.BoolVar(&s.VolumeConfigFlags.EnableHostPathProvisioning, "enable-hostpath-provisioner", s.VolumeConfigFlags.EnableHostPathProvisioning, "Enable HostPath PV provisioning when running without a cloud provider. This allows testing and development of provisioning features. HostPath provisioning is not supported in any way, won't work in a multi-node cluster, and should not be used for anything other than testing or development.")
|
||||||
|
fs.IntVar(&s.TerminatedPodGCThreshold, "terminated-pod-gc-threshold", s.TerminatedPodGCThreshold, "Number of terminated pods that can exist before the terminated pod garbage collector starts deleting terminated pods. If <= 0, the terminated pod garbage collector is disabled.")
|
||||||
|
fs.DurationVar(&s.HorizontalPodAutoscalerSyncPeriod, "horizontal-pod-autoscaler-sync-period", s.HorizontalPodAutoscalerSyncPeriod, "The period for syncing the number of pods in horizontal pod autoscaler.")
|
||||||
|
fs.DurationVar(&s.DeploymentControllerSyncPeriod, "deployment-controller-sync-period", s.DeploymentControllerSyncPeriod, "Period for syncing the deployments.")
|
||||||
|
fs.DurationVar(&s.PodEvictionTimeout, "pod-eviction-timeout", s.PodEvictionTimeout, "The grace period for deleting pods on failed nodes.")
|
||||||
|
fs.Float32Var(&s.DeletingPodsQps, "deleting-pods-qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.")
|
||||||
|
fs.IntVar(&s.DeletingPodsBurst, "deleting-pods-burst", 10, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.")
|
||||||
|
fs.IntVar(&s.RegisterRetryCount, "register-retry-count", s.RegisterRetryCount, ""+
|
||||||
|
"The number of retries for initial node registration. Retry interval equals node-sync-period.")
|
||||||
|
fs.MarkDeprecated("register-retry-count", "This flag is currently no-op and will be deleted.")
|
||||||
|
fs.DurationVar(&s.NodeMonitorGracePeriod, "node-monitor-grace-period", s.NodeMonitorGracePeriod,
|
||||||
|
"Amount of time which we allow running Node to be unresponsive before marking it unhealty. "+
|
||||||
|
"Must be N times more than kubelet's nodeStatusUpdateFrequency, "+
|
||||||
|
"where N means number of retries allowed for kubelet to post node status.")
|
||||||
|
fs.DurationVar(&s.NodeStartupGracePeriod, "node-startup-grace-period", s.NodeStartupGracePeriod,
|
||||||
|
"Amount of time which we allow starting Node to be unresponsive before marking it unhealty.")
|
||||||
|
fs.DurationVar(&s.NodeMonitorPeriod, "node-monitor-period", s.NodeMonitorPeriod,
|
||||||
|
"The period for syncing NodeStatus in NodeController.")
|
||||||
|
fs.StringVar(&s.ServiceAccountKeyFile, "service-account-private-key-file", s.ServiceAccountKeyFile, "Filename containing a PEM-encoded private RSA key used to sign service account tokens.")
|
||||||
|
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
||||||
|
fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster")
|
||||||
|
fs.IPNetVar(&s.ClusterCIDR, "cluster-cidr", s.ClusterCIDR, "CIDR Range for Pods in cluster.")
|
||||||
|
fs.BoolVar(&s.AllocateNodeCIDRs, "allocate-node-cidrs", false, "Should CIDRs for Pods be allocated and set on the cloud provider.")
|
||||||
|
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
||||||
|
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
||||||
|
fs.StringVar(&s.RootCAFile, "root-ca-file", s.RootCAFile, "If set, this root certificate authority will be included in service account's token secret. This must be a valid PEM-encoded CA bundle.")
|
||||||
|
fs.Float32Var(&s.KubeAPIQPS, "kube-api-qps", s.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver")
|
||||||
|
fs.IntVar(&s.KubeAPIBurst, "kube-api-burst", s.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver")
|
||||||
|
}
|
@ -23,6 +23,8 @@ import (
|
|||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
|
|
||||||
//Cloud providers
|
//Cloud providers
|
||||||
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
|
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ProbeRecyclableVolumePlugins collects all persistent volume plugins into an easy to use list.
|
// ProbeRecyclableVolumePlugins collects all persistent volume plugins into an easy to use list.
|
||||||
func ProbeRecyclableVolumePlugins(flags VolumeConfigFlags) []volume.VolumePlugin {
|
func ProbeRecyclableVolumePlugins(flags options.VolumeConfigFlags) []volume.VolumePlugin {
|
||||||
allPlugins := []volume.VolumePlugin{}
|
allPlugins := []volume.VolumePlugin{}
|
||||||
|
|
||||||
// The list of plugins to probe is decided by this binary, not
|
// The list of plugins to probe is decided by this binary, not
|
||||||
@ -86,7 +88,7 @@ func ProbeRecyclableVolumePlugins(flags VolumeConfigFlags) []volume.VolumePlugin
|
|||||||
// The beta implementation of provisioning allows 1 implied provisioner per cloud, until we allow configuration of many.
|
// The beta implementation of provisioning allows 1 implied provisioner per cloud, until we allow configuration of many.
|
||||||
// We explicitly map clouds to volume plugins here which allows us to configure many later without backwards compatibility issues.
|
// We explicitly map clouds to volume plugins here which allows us to configure many later without backwards compatibility issues.
|
||||||
// Not all cloudproviders have provisioning capability, which is the reason for the bool in the return to tell the caller to expect one or not.
|
// Not all cloudproviders have provisioning capability, which is the reason for the bool in the return to tell the caller to expect one or not.
|
||||||
func NewVolumeProvisioner(cloud cloudprovider.Interface, flags VolumeConfigFlags) (volume.ProvisionableVolumePlugin, error) {
|
func NewVolumeProvisioner(cloud cloudprovider.Interface, flags options.VolumeConfigFlags) (volume.ProvisionableVolumePlugin, error) {
|
||||||
switch {
|
switch {
|
||||||
case cloud == nil && flags.EnableHostPathProvisioning:
|
case cloud == nil && flags.EnableHostPathProvisioning:
|
||||||
return getProvisionablePluginFromVolumePlugins(host_path.ProbeVolumePlugins(volume.VolumeConfig{}))
|
return getProvisionablePluginFromVolumePlugins(host_path.ProbeVolumePlugins(volume.VolumeConfig{}))
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||||
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
"k8s.io/kubernetes/pkg/healthz"
|
"k8s.io/kubernetes/pkg/healthz"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"k8s.io/kubernetes/pkg/version/verflag"
|
"k8s.io/kubernetes/pkg/version/verflag"
|
||||||
@ -39,7 +40,7 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
s := app.NewCMServer()
|
s := options.NewCMServer()
|
||||||
s.AddFlags(pflag.CommandLine)
|
s.AddFlags(pflag.CommandLine)
|
||||||
|
|
||||||
util.InitFlags()
|
util.InitFlags()
|
||||||
@ -48,7 +49,7 @@ func main() {
|
|||||||
|
|
||||||
verflag.PrintAndExitIfRequested()
|
verflag.PrintAndExitIfRequested()
|
||||||
|
|
||||||
if err := s.Run(pflag.CommandLine.Args()); err != nil {
|
if err := app.Run(s); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
kubecontrollermanager "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
kubecontrollermanager "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||||
|
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
"k8s.io/kubernetes/contrib/mesos/pkg/node"
|
"k8s.io/kubernetes/contrib/mesos/pkg/node"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
@ -58,14 +59,14 @@ import (
|
|||||||
|
|
||||||
// CMServer is the main context object for the controller manager.
|
// CMServer is the main context object for the controller manager.
|
||||||
type CMServer struct {
|
type CMServer struct {
|
||||||
*kubecontrollermanager.CMServer
|
*options.CMServer
|
||||||
UseHostPortEndpoints bool
|
UseHostPortEndpoints bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCMServer creates a new CMServer with a default config.
|
// NewCMServer creates a new CMServer with a default config.
|
||||||
func NewCMServer() *CMServer {
|
func NewCMServer() *CMServer {
|
||||||
s := &CMServer{
|
s := &CMServer{
|
||||||
CMServer: kubecontrollermanager.NewCMServer(),
|
CMServer: options.NewCMServer(),
|
||||||
}
|
}
|
||||||
s.CloudProvider = mesos.ProviderName
|
s.CloudProvider = mesos.ProviderName
|
||||||
s.UseHostPortEndpoints = true
|
s.UseHostPortEndpoints = true
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
cmapp "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
cmoptions "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||||
"k8s.io/kubernetes/cmd/kubelet/app/options"
|
kubeletoptions "k8s.io/kubernetes/cmd/kubelet/app/options"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
)
|
)
|
||||||
@ -46,8 +46,8 @@ func Test_nodeWithUpdatedStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cm := cmapp.NewCMServer()
|
cm := cmoptions.NewCMServer()
|
||||||
kubecfg := options.NewKubeletServer()
|
kubecfg := kubeletoptions.NewKubeletServer()
|
||||||
assert.True(t, kubecfg.NodeStatusUpdateFrequency*3 < cm.NodeMonitorGracePeriod) // sanity check for defaults
|
assert.True(t, kubecfg.NodeStatusUpdateFrequency*3 < cm.NodeMonitorGracePeriod) // sanity check for defaults
|
||||||
|
|
||||||
n := testNode(0, api.ConditionTrue, "KubeletReady")
|
n := testNode(0, api.ConditionTrue, "KubeletReady")
|
||||||
|
Loading…
Reference in New Issue
Block a user