-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
deprecatedAPI scanning in K8s cluster not working as expected #4784
Comments
@jkleinlercher I found the issue , I'll add a fix , could you please also please run the following command and confirm job version has not been converted from some clusters conver resource from
|
yes that is exactly the case:
and I am afraid that is the normal behaviour of all K8s distributions. You can test that also on your enviroments. That is also why tools like kubent and pluto don't evaluate the apiVersion of the resources but the annotation "last-applied-configuration", where the original manifest apiVersion is stored. kubent: pluto: I don't know if this is the only way to really search for deprecated APIs. However, also the K8s documentation points to this behaviour: https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups-and-versioning
this behaviour is also described here: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#operational-overview |
@jkleinlercher Thank you for this input I'll take a look at it |
@jkleinlercher I have included the support for |
@chen-keinan that‘s great! Thank you so much for your speedy response! I would love to use this feature then also on the cluster with trivy-operator. However, I do not understand if all features of the trivy cli are also available on trivy-operator. Can you shed some light on this please? |
Of course! it is well understood , already opened an issue in |
Discussed in #4778
Originally posted by jkleinlercher July 5, 2023
Description
I applied a cronjob described in https://github.com/suxess-it/deprecated-k8s-api-testcase/blob/main/cronjob-deprecated.yaml and when scanning the yaml with "trivy conf cronjob-deprecated.yaml" it correctly says
apiVersion 'batch/v1beta1' and kind 'CronJob' has been deprecated on: 'v1.21' and planned for removal on:'v1.25'
However, after applying the manifest to the K8s cluster and run "trivy kubernetes --report all -n dep-apis-test all" I don't get any deprecatedAPI misconfiguration.
Desired Behavior
trivy should show "apiVersion 'batch/v1beta1' and kind 'CronJob' has been deprecated on: 'v1.21' and planned for removal on:'v1.25'" alert while scanning the cluster.
Actual Behavior
trivy doesn't recognize the deprecated API.
Reproduction Steps
Target
Kubernetes
Scanner
Misconfiguration
Output Format
None
Mode
Client/Server
Debug Output
Operating System
ubuntu
Version
Checklist
trivy image --reset
The text was updated successfully, but these errors were encountered: