Skip to content

policy-reporter presents incomplete results #457

@mikebryant

Description

@mikebryant

Version: ghcr.io/kyverno/policy-reporter:2.19.0

We're getting inconsistent UI behaviour on startup - where it's showing us only part of the cluster (which can give people the impression they have no violations to worry about, when they actually do)

We're seeing these logs (from the policy-reporter Deployment):

2024-06-28 09:40:59	INFO	UI configured
2024-06-28 09:40:59	INFO	sqlite connection created
2024-06-28 09:40:59	DEBUG	preparing database
2024-06-28 09:40:59	DEBUG	failed to load config	{"error": "no such table: policy_report_config"}
2024-06-28 09:40:59	DEBUG	database schema upgrade started
2024-06-28 09:40:59	INFO	REST api enabled
2024-06-28 09:40:59	INFO	metrics enabled
2024-06-28 09:40:59	DEBUG	register new result listener
2024-06-28 09:40:59	INFO	start client	{"worker": 5}
2024-06-28 09:40:59	WARN	informers not synced yet, waiting for k8s client to be up
github.com/kyverno/policy-reporter/pkg/api.(*httpServer).RegisterLifecycleHandler.ReadyHandler.func2
	/app/pkg/api/handler.go:40
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2166
net/http.(*ServeMux).ServeHTTP
	/usr/local/go/src/net/http/server.go:2683
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:3137
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:2039
2024-06-28 09:40:59	INFO	informer sync completed
``

But a call to `/v1/namespaces` only shows some Namespaces (and it slowly increases over time). Similarly `/v1/policy-reports | jq '.count'` shows a slowly increasing count, until it eventually stabilies at the same value as `kubectl get policyreport -A | wc -l`

We would have expected it to not respond with incomplete data, and to not report itself as `ready`, until it's actually ready for use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions