mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
* fix: improve reports controller default values and workers (#6522) * fix: improve reports controller default values and worker Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * nits Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * default qps Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
4e1789abb0
commit
fa885dfa00
2 changed files with 12 additions and 5 deletions
|
@ -59,8 +59,8 @@ func initMetricsFlags() {
|
||||||
|
|
||||||
func initKubeconfigFlags() {
|
func initKubeconfigFlags() {
|
||||||
flag.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
|
flag.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
|
||||||
flag.Float64Var(&clientRateLimitQPS, "clientRateLimitQPS", 20, "Configure the maximum QPS to the Kubernetes API server from Kyverno. Uses the client default if zero.")
|
flag.Float64Var(&clientRateLimitQPS, "clientRateLimitQPS", 300, "Configure the maximum QPS to the Kubernetes API server from Kyverno. Uses the client default if zero.")
|
||||||
flag.IntVar(&clientRateLimitBurst, "clientRateLimitBurst", 50, "Configure the maximum burst for throttle. Uses the client default if zero.")
|
flag.IntVar(&clientRateLimitBurst, "clientRateLimitBurst", 100, "Configure the maximum burst for throttle. Uses the client default if zero.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitFlags(config Configuration) {
|
func InitFlags(config Configuration) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Workers is the number of workers for this controller
|
// Workers is the number of workers for this controller
|
||||||
Workers = 2
|
Workers = 10
|
||||||
ControllerName = "admission-report-controller"
|
ControllerName = "admission-report-controller"
|
||||||
maxRetries = 10
|
maxRetries = 10
|
||||||
deletionGrace = time.Minute * 2
|
deletionGrace = time.Minute * 2
|
||||||
|
@ -241,6 +241,7 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, _,
|
||||||
if !found {
|
if !found {
|
||||||
return c.cleanupReports(ctx, "", "", reports...)
|
return c.cleanupReports(ctx, "", "", reports...)
|
||||||
}
|
}
|
||||||
|
quit := false
|
||||||
// set orphan reports an owner
|
// set orphan reports an owner
|
||||||
for _, report := range reports {
|
for _, report := range reports {
|
||||||
if len(report.GetOwnerReferences()) == 0 {
|
if len(report.GetOwnerReferences()) == 0 {
|
||||||
|
@ -249,9 +250,15 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, _,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
controllerutils.SetOwner(report, gvk.GroupVersion().String(), gvk.Kind, resource.Name, uid)
|
controllerutils.SetOwner(report, gvk.GroupVersion().String(), gvk.Kind, resource.Name, uid)
|
||||||
_, err = reportutils.UpdateReport(ctx, report, c.client)
|
if _, err = reportutils.UpdateReport(ctx, report, c.client); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
quit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if one report was updated we can quit, reconcile will be triggered again because uid was queued
|
||||||
|
if quit {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
// build an aggregated report
|
// build an aggregated report
|
||||||
return c.aggregateReports(ctx, uid, gvk, resource, reports...)
|
return c.aggregateReports(ctx, uid, gvk, resource, reports...)
|
||||||
|
|
Loading…
Reference in a new issue