From 833be48d614ce9f7743dd6c4905fe3e2abe7d582 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Fri, 2 Oct 2015 14:42:18 -0700 Subject: [PATCH] enable all experimental flags with one controller --- cluster/gce/configure-vm.sh | 9 +--- cluster/gce/coreos/helper.sh | 3 +- cluster/gce/debian/helper.sh | 3 +- .../kube-controller-manager.manifest | 12 ++--- .../app/controllermanager.go | 46 ++++++++----------- hack/verify-flags/known-flags.txt | 3 +- 6 files changed, 28 insertions(+), 48 deletions(-) mode change 100644 => 100755 cluster/gce/configure-vm.sh diff --git a/cluster/gce/configure-vm.sh b/cluster/gce/configure-vm.sh old mode 100644 new mode 100755 index bb13ef026f..7c0be14c82 --- a/cluster/gce/configure-vm.sh +++ b/cluster/gce/configure-vm.sh @@ -316,14 +316,9 @@ cluster_registry_disk_size: $(convert-bytes-gce-kube ${CLUSTER_REGISTRY_DISK_SIZ cluster_registry_disk_name: ${CLUSTER_REGISTRY_DISK} EOF fi - if [ -n "${ENABLE_HORIZONTAL_POD_AUTOSCALER:-}" ]; then + if [ -n "${ENABLE_EXPERIMENTAL_API:-}" ]; then cat <>/srv/salt-overlay/pillar/cluster-params.sls -enable_horizontal_pod_autoscaler: '$(echo "$ENABLE_HORIZONTAL_POD_AUTOSCALER" | sed -e "s/'/''/g")' -EOF - fi - if [ -n "${ENABLE_DEPLOYMENTS:-}" ]; then - cat <>/srv/salt-overlay/pillar/cluster-params.sls -enable_deployments: '$(echo "$ENABLE_DEPLOYMENTS" | sed -e "s/'/''/g")' +enable_experimental_api: '$(echo "$ENABLE_EXPERIMENTAL_API" | sed -e "s/'/''/g")' EOF fi } diff --git a/cluster/gce/coreos/helper.sh b/cluster/gce/coreos/helper.sh index 9be9cf05ab..effa9d6c00 100755 --- a/cluster/gce/coreos/helper.sh +++ b/cluster/gce/coreos/helper.sh @@ -56,8 +56,7 @@ KUBELET_TOKEN: $(yaml-quote ${KUBELET_TOKEN:-}) KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-}) ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-}) MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE}) -ENABLE_HORIZONTAL_POD_AUTOSCALER: $(yaml-quote ${ENABLE_HORIZONTAL_POD_AUTOSCALER}) -ENABLE_DEPLOYMENTS: $(yaml-quote ${ENABLE_DEPLOYMENTS}) +ENABLE_EXPERIMENTAL_API: $(yaml-quote ${ENABLE_EXPERIMENTAL_API}) RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG}) KUBERNETES_MASTER_NAME: $(yaml-quote ${MASTER_NAME}) KUBERNETES_CONTAINER_RUNTIME: $(yaml-quote ${CONTAINER_RUNTIME}) diff --git a/cluster/gce/debian/helper.sh b/cluster/gce/debian/helper.sh index 94f6daa08a..3b778b468f 100755 --- a/cluster/gce/debian/helper.sh +++ b/cluster/gce/debian/helper.sh @@ -51,8 +51,7 @@ KUBELET_TOKEN: $(yaml-quote ${KUBELET_TOKEN:-}) KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-}) ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-}) MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE}) -ENABLE_HORIZONTAL_POD_AUTOSCALER: $(yaml-quote ${ENABLE_HORIZONTAL_POD_AUTOSCALER}) -ENABLE_DEPLOYMENTS: $(yaml-quote ${ENABLE_DEPLOYMENTS}) +ENABLE_EXPERIMENTAL_API: $(yaml-quote ${ENABLE_EXPERIMENTAL_API}) RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG}) CA_CERT: $(yaml-quote ${CA_CERT_BASE64:-}) KUBELET_CERT: $(yaml-quote ${KUBELET_CERT_BASE64:-}) diff --git a/cluster/saltbase/salt/kube-controller-manager/kube-controller-manager.manifest b/cluster/saltbase/salt/kube-controller-manager/kube-controller-manager.manifest index 6f6a28d164..d532691e8d 100644 --- a/cluster/saltbase/salt/kube-controller-manager/kube-controller-manager.manifest +++ b/cluster/saltbase/salt/kube-controller-manager/kube-controller-manager.manifest @@ -1,8 +1,7 @@ {% set cluster_name = "" -%} {% set cluster_cidr = "" -%} {% set allocate_node_cidrs = "" -%} -{% set enable_horizontal_pod_autoscaler = "" -%} -{% set enable_deployments = "" -%} +{% set enable_experimental = "" -%} {% if pillar['instance_prefix'] is defined -%} {% set cluster_name = "--cluster-name=" + pillar['instance_prefix'] -%} @@ -13,11 +12,8 @@ {% if pillar['allocate_node_cidrs'] is defined -%} {% set allocate_node_cidrs = "--allocate-node-cidrs=" + pillar['allocate_node_cidrs'] -%} {% endif -%} -{% if pillar['enable_horizontal_pod_autoscaler'] is defined -%} - {% set enable_horizontal_pod_autoscaler = "--enable-horizontal-pod-autoscaler=" + pillar['enable_horizontal_pod_autoscaler'] -%} -{% endif -%} -{% if pillar['enable_deployments'] is defined -%} - {% set enable_deployments = "--enable-deployment-controller=" + pillar['enable_deployments'] -%} +{% if pillar['enable_experimental_api'] is defined -%} + {% set enable_experimental = "--enable-experimental=" + pillar['enable_experimental_api'] -%} {% endif -%} {% set cloud_provider = "" -%} @@ -42,7 +38,7 @@ {% set root_ca_file = "--root-ca-file=/srv/kubernetes/ca.crt" -%} {% endif -%} -{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + enable_horizontal_pod_autoscaler + " " + enable_deployments + " " + cloud_provider + " " + cloud_config + service_account_key + pillar['log_level'] + " " + root_ca_file -%} +{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + enable_experimental + " " + cloud_provider + " " + cloud_config + service_account_key + pillar['log_level'] + " " + root_ca_file -%} # test_args has to be kept at the end, so they'll overwrite any prior configuration {% if pillar['controller_manager_test_args'] is defined -%} diff --git a/cmd/kube-controller-manager/app/controllermanager.go b/cmd/kube-controller-manager/app/controllermanager.go index f619df5bab..5691fa2952 100644 --- a/cmd/kube-controller-manager/app/controllermanager.go +++ b/cmd/kube-controller-manager/app/controllermanager.go @@ -89,12 +89,11 @@ type CMServer struct { ServiceAccountKeyFile string RootCAFile string - ClusterName string - ClusterCIDR net.IPNet - AllocateNodeCIDRs bool - EnableProfiling bool - EnableHorizontalPodAutoscaler bool - EnableDeploymentController bool + ClusterName string + ClusterCIDR net.IPNet + AllocateNodeCIDRs bool + EnableProfiling bool + EnableExperimental bool Master string Kubeconfig string @@ -119,8 +118,6 @@ func NewCMServer() *CMServer { RegisterRetryCount: 10, PodEvictionTimeout: 5 * time.Minute, ClusterName: "kubernetes", - EnableHorizontalPodAutoscaler: false, - EnableDeploymentController: false, VolumeConfigFlags: VolumeConfigFlags{ // default values here PersistentVolumeRecyclerMinimumTimeoutNFS: 300, @@ -191,8 +188,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.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.BoolVar(&s.EnableHorizontalPodAutoscaler, "enable-horizontal-pod-autoscaler", s.EnableHorizontalPodAutoscaler, "Enables horizontal pod autoscaler (requires enabling experimental API on apiserver). NOT IMPLEMENTED YET!") - fs.BoolVar(&s.EnableDeploymentController, "enable-deployment-controller", s.EnableDeploymentController, "Enables deployment controller (requires enabling experimental API on apiserver). NOT IMPLEMENTED YET!") + fs.BoolVar(&s.EnableExperimental, "enable-experimental", s.EnableExperimental, "Enables experimental controllers (requires enabling experimental API on apiserver).") } // Run runs the CMServer. This should never exit. @@ -241,12 +237,6 @@ func (s *CMServer) Run(_ []string) error { controllerManager := replicationControllerPkg.NewReplicationManager(kubeClient, replicationControllerPkg.BurstReplicas) go controllerManager.Run(s.ConcurrentRCSyncs, util.NeverStop) - go daemon.NewDaemonSetsController(kubeClient). - Run(s.ConcurrentDSCSyncs, util.NeverStop) - - go job.NewJobController(kubeClient). - Run(s.ConcurrentJobSyncs, util.NeverStop) - if s.TerminatedPodGCThreshold > 0 { go gc.New(kubeClient, s.TerminatedPodGCThreshold). Run(util.NeverStop) @@ -282,18 +272,20 @@ func (s *CMServer) Run(_ []string) error { resourceQuotaController := resourcequotacontroller.NewResourceQuotaController(kubeClient) resourceQuotaController.Run(s.ResourceQuotaSyncPeriod) - // An OR of all flags to enable/disable experimental features - experimentalMode := s.EnableHorizontalPodAutoscaler || s.EnableDeploymentController - namespaceController := namespacecontroller.NewNamespaceController(kubeClient, experimentalMode, s.NamespaceSyncPeriod) - namespaceController.Run() + namespacecontroller.NewNamespaceController(kubeClient, s.EnableExperimental, s.NamespaceSyncPeriod).Run() - if s.EnableHorizontalPodAutoscaler { - horizontalPodAutoscalerController := podautoscaler.NewHorizontalController(kubeClient, metrics.NewHeapsterMetricsClient(kubeClient)) - horizontalPodAutoscalerController.Run(s.HorizontalPodAutoscalerSyncPeriod) - } - if s.EnableDeploymentController { - deploymentController := deployment.New(kubeClient) - deploymentController.Run(s.DeploymentControllerSyncPeriod) + if s.EnableExperimental { + go daemon.NewDaemonSetsController(kubeClient). + Run(s.ConcurrentDSCSyncs, util.NeverStop) + + go job.NewJobController(kubeClient). + Run(s.ConcurrentJobSyncs, util.NeverStop) + + podautoscaler.NewHorizontalController(kubeClient, metrics.NewHeapsterMetricsClient(kubeClient)). + Run(s.HorizontalPodAutoscalerSyncPeriod) + + deployment.New(kubeClient). + Run(s.DeploymentControllerSyncPeriod) } pvclaimBinder := volumeclaimbinder.NewPersistentVolumeClaimBinder(kubeClient, s.PVClaimBinderSyncPeriod) diff --git a/hack/verify-flags/known-flags.txt b/hack/verify-flags/known-flags.txt index fb714037e8..ea0bb4331d 100644 --- a/hack/verify-flags/known-flags.txt +++ b/hack/verify-flags/known-flags.txt @@ -70,8 +70,7 @@ duration-sec e2e-verify-service-account e2e-output-dir enable-debugging-handlers -enable-horizontal-pod-autoscaler -enable-deployment-controller +enable-experimental enable-server etcd-config etcd-prefix