mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #13142 from jszczepkowski/exp-flag
Auto commit by PR queue bot
This commit is contained in:
commit
b6e355d2d3
@ -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,39 +52,38 @@ 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.
|
||||||
type CMServer struct {
|
type CMServer struct {
|
||||||
Port int
|
Port int
|
||||||
Address net.IP
|
Address net.IP
|
||||||
CloudProvider string
|
CloudProvider string
|
||||||
CloudConfigFile string
|
CloudConfigFile string
|
||||||
ConcurrentEndpointSyncs int
|
ConcurrentEndpointSyncs int
|
||||||
ConcurrentRCSyncs int
|
ConcurrentRCSyncs int
|
||||||
ServiceSyncPeriod time.Duration
|
ServiceSyncPeriod time.Duration
|
||||||
NodeSyncPeriod time.Duration
|
NodeSyncPeriod time.Duration
|
||||||
ResourceQuotaSyncPeriod time.Duration
|
ResourceQuotaSyncPeriod time.Duration
|
||||||
NamespaceSyncPeriod time.Duration
|
NamespaceSyncPeriod time.Duration
|
||||||
PVClaimBinderSyncPeriod time.Duration
|
PVClaimBinderSyncPeriod time.Duration
|
||||||
RegisterRetryCount int
|
HorizontalPodAutoscalerSyncPeriod time.Duration
|
||||||
NodeMonitorGracePeriod time.Duration
|
RegisterRetryCount int
|
||||||
NodeStartupGracePeriod time.Duration
|
NodeMonitorGracePeriod time.Duration
|
||||||
NodeMonitorPeriod time.Duration
|
NodeStartupGracePeriod time.Duration
|
||||||
NodeStatusUpdateRetry int
|
NodeMonitorPeriod time.Duration
|
||||||
PodEvictionTimeout time.Duration
|
NodeStatusUpdateRetry int
|
||||||
DeletingPodsQps float32
|
PodEvictionTimeout time.Duration
|
||||||
DeletingPodsBurst int
|
DeletingPodsQps float32
|
||||||
ServiceAccountKeyFile string
|
DeletingPodsBurst int
|
||||||
RootCAFile string
|
ServiceAccountKeyFile string
|
||||||
|
RootCAFile string
|
||||||
|
|
||||||
ClusterName string
|
ClusterName string
|
||||||
ClusterCIDR net.IPNet
|
ClusterCIDR net.IPNet
|
||||||
AllocateNodeCIDRs bool
|
AllocateNodeCIDRs bool
|
||||||
EnableProfiling bool
|
EnableProfiling bool
|
||||||
|
EnableHorizontalPodAutoscaler bool
|
||||||
|
|
||||||
Master string
|
Master string
|
||||||
Kubeconfig string
|
Kubeconfig string
|
||||||
@ -92,18 +92,20 @@ type CMServer struct {
|
|||||||
// 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{
|
||||||
Port: ports.ControllerManagerPort,
|
Port: ports.ControllerManagerPort,
|
||||||
Address: net.ParseIP("127.0.0.1"),
|
Address: net.ParseIP("127.0.0.1"),
|
||||||
ConcurrentEndpointSyncs: 5,
|
ConcurrentEndpointSyncs: 5,
|
||||||
ConcurrentRCSyncs: 5,
|
ConcurrentRCSyncs: 5,
|
||||||
ServiceSyncPeriod: 5 * time.Minute,
|
ServiceSyncPeriod: 5 * time.Minute,
|
||||||
NodeSyncPeriod: 10 * time.Second,
|
NodeSyncPeriod: 10 * time.Second,
|
||||||
ResourceQuotaSyncPeriod: 10 * time.Second,
|
ResourceQuotaSyncPeriod: 10 * time.Second,
|
||||||
NamespaceSyncPeriod: 5 * time.Minute,
|
NamespaceSyncPeriod: 5 * time.Minute,
|
||||||
PVClaimBinderSyncPeriod: 10 * time.Second,
|
PVClaimBinderSyncPeriod: 10 * time.Second,
|
||||||
RegisterRetryCount: 10,
|
HorizontalPodAutoscalerSyncPeriod: 1 * time.Minute,
|
||||||
PodEvictionTimeout: 5 * time.Minute,
|
RegisterRetryCount: 10,
|
||||||
ClusterName: "kubernetes",
|
PodEvictionTimeout: 5 * time.Minute,
|
||||||
|
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 {}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user