-
Notifications
You must be signed in to change notification settings - Fork 265
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
Mintmaker: create a cronjob for generating the OSV database #5379
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: create-database-generator | ||
namespace: mintmaker | ||
spec: | ||
schedule: "0 */4 * * *" | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: database-generator | ||
image: quay.io/konflux-ci/mintmaker:next | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- /osv-generator -destination-dir /mnt/database -docker-filename docker.nedb -rpm-filename rpm.nedb -days 1 | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 500Mi | ||
limits: | ||
cpu: 100m | ||
memory: 500Mi | ||
volumeMounts: | ||
- name: osv-db | ||
mountPath: /mnt/database | ||
securityContext: | ||
runAsNonRoot: true | ||
readOnlyRootFilesystem: true | ||
volumes: | ||
- name: osv-db | ||
persistentVolumeClaim: | ||
claimName: osv-offline-db |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: database-generator | ||
namespace: mintmaker | ||
annotations: | ||
argocd.argoproj.io/hook: Sync | ||
argocd.argoproj.io/hook-delete-policy: HookSucceeded | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: database-generator | ||
image: quay.io/konflux-ci/mintmaker:next | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- /osv-generator -destination-dir /mnt/database -docker-filename docker.nedb -rpm-filename rpm.nedb -days 1 | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 500Mi | ||
limits: | ||
cpu: 100m | ||
memory: 500Mi | ||
volumeMounts: | ||
- name: osv-db | ||
mountPath: /mnt/database | ||
securityContext: | ||
runAsNonRoot: true | ||
readOnlyRootFilesystem: true | ||
volumes: | ||
- name: osv-db | ||
persistentVolumeClaim: | ||
claimName: osv-offline-db |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default storage class provides EBS volumes. The pvc is going to be bounded to a single node, it means that all the jobs that will use it would need to be scheduled on the same node, this can cause a bottleneck. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. Checking the storage classes, it seems all of them use EBS volumes. Is there a way to overcome this limitation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not at this moment. |
||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: osv-offline-db | ||
namespace: mintmaker | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
volumeMode: Filesystem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- create-database-pvc.yaml | ||
- create-database-generator-cronjob.yaml | ||
- create-database-generator-job.yaml | ||
namespace: mintmaker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check how many data will be generated with days=1 (which can be done after Feb 10 when released.csv is available), but I would consider to increase this to 3 possibly, so we can still fix vulnerabilities in case of an outage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a placeholder value, I expect that we will gather more than just one day's worth of data. But for testing purposes, changes.csv has a lot of entries even for 1 day, so it will generate quite sizable databases.