enable all experimental flags with one controller

This commit is contained in:
Mike Danese 2015-10-02 14:42:18 -07:00
parent dfbbec03ed
commit 833be48d61
6 changed files with 28 additions and 48 deletions

9
cluster/gce/configure-vm.sh Normal file → Executable file
View File

@ -316,14 +316,9 @@ cluster_registry_disk_size: $(convert-bytes-gce-kube ${CLUSTER_REGISTRY_DISK_SIZ
cluster_registry_disk_name: ${CLUSTER_REGISTRY_DISK} cluster_registry_disk_name: ${CLUSTER_REGISTRY_DISK}
EOF EOF
fi fi
if [ -n "${ENABLE_HORIZONTAL_POD_AUTOSCALER:-}" ]; then if [ -n "${ENABLE_EXPERIMENTAL_API:-}" ]; then
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
enable_horizontal_pod_autoscaler: '$(echo "$ENABLE_HORIZONTAL_POD_AUTOSCALER" | sed -e "s/'/''/g")' enable_experimental_api: '$(echo "$ENABLE_EXPERIMENTAL_API" | sed -e "s/'/''/g")'
EOF
fi
if [ -n "${ENABLE_DEPLOYMENTS:-}" ]; then
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
enable_deployments: '$(echo "$ENABLE_DEPLOYMENTS" | sed -e "s/'/''/g")'
EOF EOF
fi fi
} }

View File

@ -56,8 +56,7 @@ KUBELET_TOKEN: $(yaml-quote ${KUBELET_TOKEN:-})
KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-}) KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-})
ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-}) ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-})
MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE}) MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE})
ENABLE_HORIZONTAL_POD_AUTOSCALER: $(yaml-quote ${ENABLE_HORIZONTAL_POD_AUTOSCALER}) ENABLE_EXPERIMENTAL_API: $(yaml-quote ${ENABLE_EXPERIMENTAL_API})
ENABLE_DEPLOYMENTS: $(yaml-quote ${ENABLE_DEPLOYMENTS})
RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG}) RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG})
KUBERNETES_MASTER_NAME: $(yaml-quote ${MASTER_NAME}) KUBERNETES_MASTER_NAME: $(yaml-quote ${MASTER_NAME})
KUBERNETES_CONTAINER_RUNTIME: $(yaml-quote ${CONTAINER_RUNTIME}) KUBERNETES_CONTAINER_RUNTIME: $(yaml-quote ${CONTAINER_RUNTIME})

View File

@ -51,8 +51,7 @@ KUBELET_TOKEN: $(yaml-quote ${KUBELET_TOKEN:-})
KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-}) KUBE_PROXY_TOKEN: $(yaml-quote ${KUBE_PROXY_TOKEN:-})
ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-}) ADMISSION_CONTROL: $(yaml-quote ${ADMISSION_CONTROL:-})
MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE}) MASTER_IP_RANGE: $(yaml-quote ${MASTER_IP_RANGE})
ENABLE_HORIZONTAL_POD_AUTOSCALER: $(yaml-quote ${ENABLE_HORIZONTAL_POD_AUTOSCALER}) ENABLE_EXPERIMENTAL_API: $(yaml-quote ${ENABLE_EXPERIMENTAL_API})
ENABLE_DEPLOYMENTS: $(yaml-quote ${ENABLE_DEPLOYMENTS})
RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG}) RUNTIME_CONFIG: $(yaml-quote ${RUNTIME_CONFIG})
CA_CERT: $(yaml-quote ${CA_CERT_BASE64:-}) CA_CERT: $(yaml-quote ${CA_CERT_BASE64:-})
KUBELET_CERT: $(yaml-quote ${KUBELET_CERT_BASE64:-}) KUBELET_CERT: $(yaml-quote ${KUBELET_CERT_BASE64:-})

View File

@ -1,8 +1,7 @@
{% set cluster_name = "" -%} {% set cluster_name = "" -%}
{% set cluster_cidr = "" -%} {% set cluster_cidr = "" -%}
{% set allocate_node_cidrs = "" -%} {% set allocate_node_cidrs = "" -%}
{% set enable_horizontal_pod_autoscaler = "" -%} {% set enable_experimental = "" -%}
{% set enable_deployments = "" -%}
{% if pillar['instance_prefix'] is defined -%} {% if pillar['instance_prefix'] is defined -%}
{% set cluster_name = "--cluster-name=" + pillar['instance_prefix'] -%} {% set cluster_name = "--cluster-name=" + pillar['instance_prefix'] -%}
@ -13,11 +12,8 @@
{% if pillar['allocate_node_cidrs'] is defined -%} {% if pillar['allocate_node_cidrs'] is defined -%}
{% set allocate_node_cidrs = "--allocate-node-cidrs=" + pillar['allocate_node_cidrs'] -%} {% set allocate_node_cidrs = "--allocate-node-cidrs=" + pillar['allocate_node_cidrs'] -%}
{% endif -%} {% endif -%}
{% if pillar['enable_horizontal_pod_autoscaler'] is defined -%} {% if pillar['enable_experimental_api'] is defined -%}
{% set enable_horizontal_pod_autoscaler = "--enable-horizontal-pod-autoscaler=" + pillar['enable_horizontal_pod_autoscaler'] -%} {% set enable_experimental = "--enable-experimental=" + pillar['enable_experimental_api'] -%}
{% endif -%}
{% if pillar['enable_deployments'] is defined -%}
{% set enable_deployments = "--enable-deployment-controller=" + pillar['enable_deployments'] -%}
{% endif -%} {% endif -%}
{% set cloud_provider = "" -%} {% set cloud_provider = "" -%}
@ -42,7 +38,7 @@
{% set root_ca_file = "--root-ca-file=/srv/kubernetes/ca.crt" -%} {% set root_ca_file = "--root-ca-file=/srv/kubernetes/ca.crt" -%}
{% endif -%} {% 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 # test_args has to be kept at the end, so they'll overwrite any prior configuration
{% if pillar['controller_manager_test_args'] is defined -%} {% if pillar['controller_manager_test_args'] is defined -%}

View File

@ -89,12 +89,11 @@ type CMServer struct {
ServiceAccountKeyFile string ServiceAccountKeyFile string
RootCAFile string RootCAFile string
ClusterName string ClusterName string
ClusterCIDR net.IPNet ClusterCIDR net.IPNet
AllocateNodeCIDRs bool AllocateNodeCIDRs bool
EnableProfiling bool EnableProfiling bool
EnableHorizontalPodAutoscaler bool EnableExperimental bool
EnableDeploymentController bool
Master string Master string
Kubeconfig string Kubeconfig string
@ -119,8 +118,6 @@ func NewCMServer() *CMServer {
RegisterRetryCount: 10, RegisterRetryCount: 10,
PodEvictionTimeout: 5 * time.Minute, PodEvictionTimeout: 5 * time.Minute,
ClusterName: "kubernetes", ClusterName: "kubernetes",
EnableHorizontalPodAutoscaler: false,
EnableDeploymentController: false,
VolumeConfigFlags: VolumeConfigFlags{ VolumeConfigFlags: VolumeConfigFlags{
// default values here // default values here
PersistentVolumeRecyclerMinimumTimeoutNFS: 300, 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.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!") fs.BoolVar(&s.EnableExperimental, "enable-experimental", s.EnableExperimental, "Enables experimental controllers (requires enabling experimental API on apiserver).")
fs.BoolVar(&s.EnableDeploymentController, "enable-deployment-controller", s.EnableDeploymentController, "Enables deployment controller (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.
@ -241,12 +237,6 @@ func (s *CMServer) Run(_ []string) error {
controllerManager := replicationControllerPkg.NewReplicationManager(kubeClient, replicationControllerPkg.BurstReplicas) controllerManager := replicationControllerPkg.NewReplicationManager(kubeClient, replicationControllerPkg.BurstReplicas)
go controllerManager.Run(s.ConcurrentRCSyncs, util.NeverStop) 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 { if s.TerminatedPodGCThreshold > 0 {
go gc.New(kubeClient, s.TerminatedPodGCThreshold). go gc.New(kubeClient, s.TerminatedPodGCThreshold).
Run(util.NeverStop) Run(util.NeverStop)
@ -282,18 +272,20 @@ func (s *CMServer) Run(_ []string) error {
resourceQuotaController := resourcequotacontroller.NewResourceQuotaController(kubeClient) resourceQuotaController := resourcequotacontroller.NewResourceQuotaController(kubeClient)
resourceQuotaController.Run(s.ResourceQuotaSyncPeriod) resourceQuotaController.Run(s.ResourceQuotaSyncPeriod)
// An OR of all flags to enable/disable experimental features namespacecontroller.NewNamespaceController(kubeClient, s.EnableExperimental, s.NamespaceSyncPeriod).Run()
experimentalMode := s.EnableHorizontalPodAutoscaler || s.EnableDeploymentController
namespaceController := namespacecontroller.NewNamespaceController(kubeClient, experimentalMode, s.NamespaceSyncPeriod)
namespaceController.Run()
if s.EnableHorizontalPodAutoscaler { if s.EnableExperimental {
horizontalPodAutoscalerController := podautoscaler.NewHorizontalController(kubeClient, metrics.NewHeapsterMetricsClient(kubeClient)) go daemon.NewDaemonSetsController(kubeClient).
horizontalPodAutoscalerController.Run(s.HorizontalPodAutoscalerSyncPeriod) Run(s.ConcurrentDSCSyncs, util.NeverStop)
}
if s.EnableDeploymentController { go job.NewJobController(kubeClient).
deploymentController := deployment.New(kubeClient) Run(s.ConcurrentJobSyncs, util.NeverStop)
deploymentController.Run(s.DeploymentControllerSyncPeriod)
podautoscaler.NewHorizontalController(kubeClient, metrics.NewHeapsterMetricsClient(kubeClient)).
Run(s.HorizontalPodAutoscalerSyncPeriod)
deployment.New(kubeClient).
Run(s.DeploymentControllerSyncPeriod)
} }
pvclaimBinder := volumeclaimbinder.NewPersistentVolumeClaimBinder(kubeClient, s.PVClaimBinderSyncPeriod) pvclaimBinder := volumeclaimbinder.NewPersistentVolumeClaimBinder(kubeClient, s.PVClaimBinderSyncPeriod)

View File

@ -70,8 +70,7 @@ duration-sec
e2e-verify-service-account e2e-verify-service-account
e2e-output-dir e2e-output-dir
enable-debugging-handlers enable-debugging-handlers
enable-horizontal-pod-autoscaler enable-experimental
enable-deployment-controller
enable-server enable-server
etcd-config etcd-config
etcd-prefix etcd-prefix