Merge pull request #13142 from jszczepkowski/exp-flag

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2015-08-28 17:08:06 -07:00
commit b6e355d2d3
2 changed files with 54 additions and 47 deletions

View File

@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/controller/autoscaler"
"k8s.io/kubernetes/pkg/controller/endpoint" "k8s.io/kubernetes/pkg/controller/endpoint"
"k8s.io/kubernetes/pkg/controller/namespace" "k8s.io/kubernetes/pkg/controller/namespace"
"k8s.io/kubernetes/pkg/controller/node" "k8s.io/kubernetes/pkg/controller/node"
@ -51,9 +52,6 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/spf13/pflag" "github.com/spf13/pflag"
// TODO: Enable the code belowe when horizontal pod autoscaler controller is implemented.
// "k8s.io/kubernetes/pkg/controller/autoscaler"
) )
// CMServer is the main context object for the controller manager. // CMServer is the main context object for the controller manager.
@ -69,6 +67,7 @@ type CMServer struct {
ResourceQuotaSyncPeriod time.Duration ResourceQuotaSyncPeriod time.Duration
NamespaceSyncPeriod time.Duration NamespaceSyncPeriod time.Duration
PVClaimBinderSyncPeriod time.Duration PVClaimBinderSyncPeriod time.Duration
HorizontalPodAutoscalerSyncPeriod time.Duration
RegisterRetryCount int RegisterRetryCount int
NodeMonitorGracePeriod time.Duration NodeMonitorGracePeriod time.Duration
NodeStartupGracePeriod time.Duration NodeStartupGracePeriod time.Duration
@ -84,6 +83,7 @@ type CMServer struct {
ClusterCIDR net.IPNet ClusterCIDR net.IPNet
AllocateNodeCIDRs bool AllocateNodeCIDRs bool
EnableProfiling bool EnableProfiling bool
EnableHorizontalPodAutoscaler bool
Master string Master string
Kubeconfig string Kubeconfig string
@ -101,9 +101,11 @@ func NewCMServer() *CMServer {
ResourceQuotaSyncPeriod: 10 * time.Second, ResourceQuotaSyncPeriod: 10 * time.Second,
NamespaceSyncPeriod: 5 * time.Minute, NamespaceSyncPeriod: 5 * time.Minute,
PVClaimBinderSyncPeriod: 10 * time.Second, PVClaimBinderSyncPeriod: 10 * time.Second,
HorizontalPodAutoscalerSyncPeriod: 1 * time.Minute,
RegisterRetryCount: 10, RegisterRetryCount: 10,
PodEvictionTimeout: 5 * time.Minute, PodEvictionTimeout: 5 * time.Minute,
ClusterName: "kubernetes", ClusterName: "kubernetes",
EnableHorizontalPodAutoscaler: false,
} }
return &s return &s
} }
@ -123,6 +125,7 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&s.ResourceQuotaSyncPeriod, "resource-quota-sync-period", s.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system") 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.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.PVClaimBinderSyncPeriod, "pvclaimbinder-sync-period", s.PVClaimBinderSyncPeriod, "The period for syncing persistent volumes and persistent volume claims")
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.PodEvictionTimeout, "pod-eviction-timeout", s.PodEvictionTimeout, "The grace period for deleting pods on failed nodes.") 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.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.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.")
@ -145,6 +148,7 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") 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.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.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.BoolVar(&s.EnableHorizontalPodAutoscaler, "enable-horizontal-pod-autoscaler", s.EnableHorizontalPodAutoscaler, "Enables horizontal pod autoscaler (requires enabling experimental API on apiserver). NOT IMPLEMENTED YET!")
} }
// Run runs the CMServer. This should never exit. // Run runs the CMServer. This should never exit.
@ -267,13 +271,14 @@ func (s *CMServer) Run(_ []string) error {
serviceaccount.DefaultServiceAccountsControllerOptions(), serviceaccount.DefaultServiceAccountsControllerOptions(),
).Run() ).Run()
// TODO: Enable the code belowe when horizontal pod autoscaler controller is implemented. if s.EnableHorizontalPodAutoscaler {
// expClient, err := client.NewExperimental(kubeconfig) expClient, err := client.NewExperimental(kubeconfig)
// if err != nil { if err != nil {
// glog.Fatalf("Invalid API configuration: %v", err) glog.Fatalf("Invalid API configuration: %v", err)
// } }
// horizontalPodAutoscalerController := autoscalercontroller.New(kubeClient, expClient) horizontalPodAutoscalerController := autoscalercontroller.New(kubeClient, expClient)
// horizontalPodAutoscalerController.Run(s.NodeSyncPeriod) horizontalPodAutoscalerController.Run(s.HorizontalPodAutoscalerSyncPeriod)
}
select {} select {}
} }

View File

@ -65,6 +65,7 @@ dry-run
duration-sec duration-sec
e2e-output-dir e2e-output-dir
enable-debugging-handlers enable-debugging-handlers
enable-horizontal-pod-autoscaler
enable-server enable-server
etcd-config etcd-config
etcd-prefix etcd-prefix
@ -96,6 +97,7 @@ grace-period
ha-domain ha-domain
healthz-bind-address healthz-bind-address
healthz-port healthz-port
horizontal-pod-autoscaler-sync-period
hostname-override hostname-override
host-network-sources host-network-sources
http-check-frequency http-check-frequency