-
Notifications
You must be signed in to change notification settings - Fork 10
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
Ability to add a certain label to the Metrics #37
Comments
Hi @sherifkayad, Thank you for your interest in the original Trivy Operator. I didn't see why it is a "very strong and much needed feature". I read the linked documentation but it didn't clean to me what will be the value of this custom label. Perhaps if you if you tell me more what purpose do you want to achieve it would be easier to me. |
@devopstales one use case we have is to be able to filter in Grafana / alert the responsible team for a certain service / container / manifest list dynamically when they have high / critical vulnerabilities by reading a In our current PoC with the original operator that's possible to add those two labels to the metrics generated and hence being able to do exactly that. I hope I managed to answer your question. |
Hi @sherifkayad, Now I understand your use case, but you didn't answered one of my question. Where the value of the label will come from. in the example they created this on he helm deploy |
@devopstales I might think there's a slight misunderstanding from your side. Assuming you have a apiVersion: apps/v1
kind: Deployment
metadata:
name: service-x-deployment
namespace: whatever
labels:
app: service-x
owner: team-a
ping: pong
otherLabel: otherValue
...
spec:
...
spec:
containers:
- name: service-x
image: >-
my-registry/service-x:myTag
... Specifying the Trivy Operator E.g. you might end up with something like: apiVersion: aquasecurity.github.io/v1alpha1
kind: VulnerabilityReport
metadata:
labels:
owner: team-a
app: service-x
resource-spec-hash: 7b7979f777
trivy-operator.container.name: service-x
trivy-operator.resource.kind: ReplicaSet
trivy-operator.resource.name: service-x-65c76595f
trivy-operator.resource.namespace: whatever
name: replicaset-service-x-65c76595f-service-x
namespace: whatever
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: false
controller: true
kind: ReplicaSet
name: service-x-65c76595f
uid: 79387df7-e1a3-4a2b-8615-37b05aa14a9d
report:
artifact:
repository: my-registry/service-x
tag: myTag
registry:
server: my-registry
scanner:
name: Trivy
vendor: Aqua Security
version: 0.34.0
summary:
criticalCount: 2
highCount: 30
lowCount: 314
mediumCount: 23
noneCount: 0
unknownCount: 0
updateTimestamp: '2022-11-28T12:48:27Z'
vulnerabilities:
...
...
---
apiVersion: aquasecurity.github.io/v1alpha1
kind: ConfigAuditReport
metadata:
annotations:
trivy-operator.aquasecurity.github.io/report-ttl: 24h0m0s
creationTimestamp: '2022-11-28T12:50:41Z'
generation: 1
labels:
owner: team-a
app: service-x
....
--- And then of course on the metrics side of things, you would be able to query something like:
|
@sherifkayad Sorry for the late response. Now I understand how it is works. I will check this in the next version but I didn't think I can do that in this year. If you can and want to work on this the pull-request is welcomed. |
Currently the official Trivy Operator provides a very strong and much needed feature that's enabling Kubernetes labels (on the Workloads to scan) as metrics labels.
Would be great to also have such feature.
Reference: https://aquasecurity.github.io/trivy-operator/v0.7.1/integrations/metrics/#adding-custom-label-to-metrics
The text was updated successfully, but these errors were encountered: