Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools #1992

Closed
sheeeng opened this issue Apr 9, 2024 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@sheeeng
Copy link

sheeeng commented Apr 9, 2024

What steps did you take and what happened:

$ kubectl logs --selector "app.kubernetes.io/name=trivy-operator" --all-containers=true --since=4h
...
W0409 10:03:10.264337       1 reflector.go:539] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
E0409 10:03:10.264646       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
W0409 10:03:13.073809       1 reflector.go:539] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
E0409 10:03:13.073848       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
W0409 10:03:18.568082       1 reflector.go:539] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
E0409 10:03:18.568125       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
W0409 10:03:25.448370       1 reflector.go:539] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
E0409 10:03:25.448413       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
W0409 10:03:47.685700       1 reflector.go:539] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools
E0409 10:03:47.685742       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.ClusterSbomReport: failed to list *v1alpha1.ClusterSbomReport: json: cannot unmarshal array into Go struct field Metadata.items.report.components.metadata.tools of type v1alpha1.Tools

What did you expect to happen:

No errrors.

Anything else you would like to add:

None.

Environment:

  • Trivy-Operator version (use trivy-operator version): v0.19.4
  • Kubernetes version (use kubectl version): v1.29.3
  • OS (macOS 10.15, Windows 10, Ubuntu 19.10 etc): macOS 14.4.1
@sheeeng sheeeng added the kind/bug Categorizes issue or PR as related to a bug. label Apr 9, 2024
@chen-keinan
Copy link
Contributor

chen-keinan commented Apr 9, 2024

@sheeeng have you upgraded from older version of trivy-operator?
please fully uninstall the trivy-operator installation : helm uninstall trivy-operator -n trivy-system
and delete all CRDs and re-install again with latest.
no worried about reports data, it will be generated again.

    kubectl delete crd vulnerabilityreports.aquasecurity.github.io
    kubectl delete crd exposedsecretreports.aquasecurity.github.io
    kubectl delete crd configauditreports.aquasecurity.github.io
    kubectl delete crd clusterconfigauditreports.aquasecurity.github.io
    kubectl delete crd rbacassessmentreports.aquasecurity.github.io
    kubectl delete crd infraassessmentreports.aquasecurity.github.io
    kubectl delete crd clusterrbacassessmentreports.aquasecurity.github.io
    kubectl delete crd clustercompliancereports.aquasecurity.github.io
    kubectl delete crd clusterinfraassessmentreports.aquasecurity.github.io
    kubectl delete crd sbomreports.aquasecurity.github.io
    kubectl delete crd clustersbomreports.aquasecurity.github.io
    kubectl delete crd clustervulnerabilityreports.aquasecurity.github.io

@sheeeng
Copy link
Author

sheeeng commented Apr 10, 2024

@sheeeng have you upgraded from older version of trivy-operator?

Yes.

kubectl delete helmreleases.helm.toolkit.fluxcd.io --namespace trivy-system trivy-operator

kubectl delete customresourcedefinitions.apiextensions.k8s.io vulnerabilityreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io exposedsecretreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io configauditreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clusterconfigauditreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io rbacassessmentreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io infraassessmentreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clusterrbacassessmentreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clustercompliancereports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clusterinfraassessmentreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io sbomreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clustersbomreports.aquasecurity.github.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io clustervulnerabilityreports.aquasecurity.github.io

I used the above commands and the issue is no longer reproducible. Thank you, @chen-keinan. 🙇

@HaveFun83
Copy link

HaveFun83 commented Apr 16, 2024

We had the same issue after upgrade from chart version 0.20.6 -> 0.21.4 , Operator 0.18.5 -> 0.19.4

according to the changelogs

    kubectl delete crd sbomreports.aquasecurity.github.io
    kubectl delete crd clustersbomreports.aquasecurity.github.io

should be enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants