1
0
Fork 0
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 (cherry-pick #6522) (#6532)

* 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:
Charles-Edouard Brétéché 2023-03-10 14:52:48 +01:00 committed by GitHub
parent 4e1789abb0
commit fa885dfa00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -59,8 +59,8 @@ func initMetricsFlags() {
func initKubeconfigFlags() {
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.IntVar(&clientRateLimitBurst, "clientRateLimitBurst", 50, "Configure the maximum burst for throttle. 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", 100, "Configure the maximum burst for throttle. Uses the client default if zero.")
}
func InitFlags(config Configuration) {

View file

@ -26,7 +26,7 @@ import (
const (
// Workers is the number of workers for this controller
Workers = 2
Workers = 10
ControllerName = "admission-report-controller"
maxRetries = 10
deletionGrace = time.Minute * 2
@ -241,6 +241,7 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, _,
if !found {
return c.cleanupReports(ctx, "", "", reports...)
}
quit := false
// set orphan reports an owner
for _, report := range reports {
if len(report.GetOwnerReferences()) == 0 {
@ -249,10 +250,16 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, _,
return err
}
controllerutils.SetOwner(report, gvk.GroupVersion().String(), gvk.Kind, resource.Name, uid)
_, err = reportutils.UpdateReport(ctx, report, c.client)
return err
if _, err = reportutils.UpdateReport(ctx, report, c.client); err != nil {
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
return c.aggregateReports(ctx, uid, gvk, resource, reports...)
}