add qps and burst settings (#108)
This commit is contained in:
parent
bd41239718
commit
6513d8ef2a
|
|
@ -39,6 +39,8 @@ spec:
|
||||||
args:
|
args:
|
||||||
- --leader-elect=false
|
- --leader-elect=false
|
||||||
- --provider-config=/etc/kruise-game/config.toml
|
- --provider-config=/etc/kruise-game/config.toml
|
||||||
|
- --api-server-qps=5
|
||||||
|
- --api-server-qps-burst=10
|
||||||
image: controller:latest
|
image: controller:latest
|
||||||
name: manager
|
name: manager
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
15
main.go
15
main.go
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/openkruise/kruise-game/pkg/metrics"
|
"github.com/openkruise/kruise-game/pkg/metrics"
|
||||||
"github.com/openkruise/kruise-game/pkg/webhook"
|
"github.com/openkruise/kruise-game/pkg/webhook"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -53,6 +54,8 @@ import (
|
||||||
var (
|
var (
|
||||||
scheme = runtime.NewScheme()
|
scheme = runtime.NewScheme()
|
||||||
setupLog = ctrl.Log.WithName("setup")
|
setupLog = ctrl.Log.WithName("setup")
|
||||||
|
|
||||||
|
apiServerSustainedQPSFlag, apiServerBurstQPSFlag int
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -82,6 +85,8 @@ func main() {
|
||||||
"Namespace if specified restricts the manager's cache to watch objects in the desired namespace. Defaults to all namespaces.")
|
"Namespace if specified restricts the manager's cache to watch objects in the desired namespace. Defaults to all namespaces.")
|
||||||
flag.StringVar(&syncPeriodStr, "sync-period", "", "Determines the minimum frequency at which watched resources are reconciled.")
|
flag.StringVar(&syncPeriodStr, "sync-period", "", "Determines the minimum frequency at which watched resources are reconciled.")
|
||||||
flag.StringVar(&scaleServerAddr, "scale-server-bind-address", ":6000", "The address the scale server endpoint binds to.")
|
flag.StringVar(&scaleServerAddr, "scale-server-bind-address", ":6000", "The address the scale server endpoint binds to.")
|
||||||
|
flag.IntVar(&apiServerSustainedQPSFlag, "api-server-qps", 0, "Maximum sustained queries per second to send to the API server")
|
||||||
|
flag.IntVar(&apiServerBurstQPSFlag, "api-server-qps-burst", 0, "Maximum burst queries per second to send to the API server")
|
||||||
|
|
||||||
// Add cloud provider flags
|
// Add cloud provider flags
|
||||||
cloudprovider.InitCloudProviderFlags()
|
cloudprovider.InitCloudProviderFlags()
|
||||||
|
|
@ -106,6 +111,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
restConfig := ctrl.GetConfigOrDie()
|
restConfig := ctrl.GetConfigOrDie()
|
||||||
|
setRestConfig(restConfig)
|
||||||
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
|
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
|
||||||
Scheme: scheme,
|
Scheme: scheme,
|
||||||
MetricsBindAddress: metricsAddr,
|
MetricsBindAddress: metricsAddr,
|
||||||
|
|
@ -205,3 +211,12 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setRestConfig(c *rest.Config) {
|
||||||
|
if apiServerSustainedQPSFlag > 0 {
|
||||||
|
c.QPS = float32(apiServerSustainedQPSFlag)
|
||||||
|
}
|
||||||
|
if apiServerBurstQPSFlag > 0 {
|
||||||
|
c.Burst = apiServerBurstQPSFlag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue