kyverno: [Bug] Error in reports controller "schema not found"

Kyverno Version

1.10.1

Description

Hi, I’m migrating Kyverno from v1.9.3 to v1.10.1. So far so good, cluster policies are up and running but I’m bugged by "schema not found" errors in reports controller’s logs regarding certain CRDs: "kyverno.io/v1/ClusterPolicy" "source.toolkit.fluxcd.io/*/GitRepository" "networking.istio.io/*/ServiceEntry"

Reports controller looks for different versions of the CRDs (v1, v1beta1 etc.) and they are present on the cluster.

I don’t understand why its complaining about ClusterPolicy because they are working fine.

Also, sometimes it’s showing that GitRepository is deprecated (so it must’ve found it) and later in logs it’s complaining "schema not found" again.

I haven’t faced the issue in 1.9.3

Could you help me to understand what’s going on and what impact those errors have on kyverno?

I’m attaching logs from my reports controller.

reports_controller_logs.log

Slack discussion

No response

Troubleshooting

  • I have read and followed the documentation AND the troubleshooting guide.
  • I have searched other issues in this repository and mine is not recorded.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 22 (11 by maintainers)

Most upvoted comments

@diranged - agreed, hence the proposal to return a warning during policy creation and moving to a dynamic state management model for policies.

See discussion in https://github.com/kyverno/kyverno/issues/11462

@chipzoller any thoughts on how to fix this? we’re running into the same issue… it creates a really noisy set of logs (millions and millions of events)

Hello there 😃

Still happening with a ClusterPolicy like this:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: kyverno-extra-deny-creation-default-namespace
spec:
  admission: true
  background: false
  rules:
  - match:
      any:
      - resources:
          kinds:
          - '*'
          operations:
          - CREATE
    name: deny-creation-default-namespace
    preconditions:
      all:
      - key: '{{ request.operations }}'
        operator: Equals
        value: CREATE
      - key: '{{ request.object.kind }}'
        operator: AllNotIn
        value:
        - Secret
        - ConfigMap
    skipBackgroundRequests: true
    validate:
      cel:
        expressions:
        - expression: (has(object.metadata.namespace) && object.metadata.namespace
            != 'default') || !has(object.metadata.namespace)
          message: |-
            If the kubernetes object you are trying to create has specified metadata.namespace, the value 'default' is not allowed.
            Please, check the namespace value and change to where it needs to be deployed
  validationFailureAction: Enforce

But it is supposed supported according to this documentation: https://kyverno.io/docs/writing-policies/match-exclude/#match-statements

The example i’m talking about is this:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-labels
spec:
  validationFailureAction: Audit
  background: false
  rules:
  - name: check-for-labels
    match:
      any:
      - resources:
          kinds:
          - "*"
          operations:
          - CREATE
    validate:
      message: "The label `app.kubernetes.io/name` is required."
      pattern:
        metadata:
          labels:
            app.kubernetes.io/name: "?*"

Are you able to reproduce this this way? @chipzoller