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

Add deploy files #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# trivy-extractor
Enriches trivy metric data

Enriches trivy metric data with a namespace team mapping. This allows a Security team to easily identify what vulnerabilities belong to what team.

# Configuration

Simply add a new configmap to the k8s namespace and update the `trivyExtractor.namespacesTeamConfigMapName` value in the `values.yaml` file.


Example config map:

```
apiVersion: v1
kind: ConfigMap
metadata:
name: namespaces
data:
namespaces.csv: |
TEAM 1,app-1
TEAM 2,app-2
TEAM 3,app-3
```

5 changes: 5 additions & 0 deletions deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: k8s-trivy-extractor
description: A Helm chart to deploy the Trivy Extractor for Kubernetes
type: application
version: 0.1.0
8 changes: 8 additions & 0 deletions deploy/templates/cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: namespaces
data:
namespaces.csv: |
team-1,app-1
team-2,app-2
41 changes: 41 additions & 0 deletions deploy/templates/deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trivy-extractor-deployment
labels:
app: trivy-extractor
spec:
replicas: 1
selector:
matchLabels:
app: trivy-extractor
template:
metadata:
labels:
app: trivy-extractor
spec:
containers:
- name: trivy-extractor
image: ghcr.io/{{ .Values.trivyExtractor.repository }}/trivy-extractor/trivy-extractor:{{ .Values.trivyExtractor.tag }}
imagePullPolicy: Always
command: ["/usr/bin/trivy-extractor"]
ports:
- containerPort: 2112
volumeMounts:
- name: namespaces
mountPath: "/data"
readOnly: true
resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "256Mi"
cpu: "500m"
imagePullSecrets:
- name: {{ .Values.trivyExtractor.imagePullSecrets }}
volumes:
- name: namespaces
configMap:
name: {{ .Values.trivyExtractor.namespacesTeamConfigMapName }}

14 changes: 14 additions & 0 deletions deploy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: trivy-extractor
labels:
app: trivy-extractor
spec:
selector:
app: trivy-extractor
ports:
- name: web
protocol: TCP
port: 2112
targetPort: 2112
16 changes: 16 additions & 0 deletions deploy/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: trivy-extractor
spec:
selector:
matchLabels:
app: trivy-extractor
endpoints:
- interval: 15s
port: web
scrapeTimeout: 14s
namespaceSelector:
matchNames:
- trivy-operator
5 changes: 5 additions & 0 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trivyExtractor:
tag: v1.0.0
repository: metal-toolbox
namespacesTeamConfigMapName: namespaces
imagePullSecret: trivy-operator-image-pull-secret