1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/pkg/config/client.go

19 lines
439 B
Go
Raw Normal View History

package config
import (
"fmt"
"math"
rest "k8s.io/client-go/rest"
)
// ConfigureClientConfig creates client config and applies rate limit QPS and burst
func ConfigureClientConfig(clientConfig *rest.Config, qps float64, burst int) error {
if qps > math.MaxFloat32 {
return fmt.Errorf("client rate limit QPS must not be higher than %e", math.MaxFloat32)
}
clientConfig.Burst = burst
clientConfig.QPS = float32(qps)
return nil
}