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

Super Charging Persistence #769

Open
wants to merge 2 commits into
base: 2022.4
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
4 changes: 4 additions & 0 deletions scanner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.
## 2022.4.6 (Sept 6th, 2023)
* Fix scanner persistence to allow for multiple scanners
* Add support for custom volumes and mount points

## 2022.4.5 (Jul 19th, 2023)
* Fix scanner persistence volume

Expand Down
2 changes: 1 addition & 1 deletion scanner/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "2022.4"
description: A Helm chart for the Aqua Scanner CLI component
name: scanner
version: "2022.4.5"
version: "2022.4.6"
icon: https://avatars3.githubusercontent.com/u/12783832?s=200&v=4
home: https://www.aquasec.com/
maintainers:
Expand Down
3 changes: 3 additions & 0 deletions scanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ Parameter | Description
`podAnnotations` | Kubernetes pod annotations | `{}` | `NO`
`extraEnvironmentVars` | is a list of extra environment variables to set in the scanner deployments. | `{}` | `NO`
`extraSecretEnvironmentVars` | is a list of extra environment variables to set in the scanner deployments, these variables take value from existing Secret objects. | `[]` | `NO`
`additionalVolumes` | is a list of extra volumes necessary to mount inside of the scanner container. | `[]` | `NO`
`additionalVolumeMounts` | is a list of extra mount points for the additional volumes. | `[]` | `NO`

## Issues and feedback

If you encounter any problems or would like to give us feedback on deployments, we encourage you to raise issues here on GitHub.
3 changes: 3 additions & 0 deletions scanner/templates/openshift-scc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ volumes:
- configMap
- secret
- hostPath
{{- if (.Values.persistence.enabled) }}
- persistentVolumeClaim
{{- end }}
{{- end }}
32 changes: 28 additions & 4 deletions scanner/templates/scanner-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ spec:
{{- end }}
{{- include "scanner.extraEnvironmentVars" .Values | nindent 8 }}
{{- include "scanner.extraSecretEnvironmentVars" .Values | nindent 8 }}
{{- if or (.Values.dockerSock.mount) (.Values.serverSSL.enable) (.Values.cyberCenter.mtls.enabled) (.Values.additionalCerts) (.Values.persistence.enabled) }}
{{- if or (.Values.dockerSock.mount) (.Values.serverSSL.enable) (.Values.cyberCenter.mtls.enabled) (.Values.additionalCerts) (.Values.persistence.enabled) (.Values.additionalVolumeMounts) }}
volumeMounts:
{{- end }}
{{- if .Values.dockerSock.mount }}
Expand All @@ -145,6 +145,9 @@ spec:
mountPath: /opt/aquascans
{{- end }}
{{- include "scanner.additionalCertVolumeMounts" .Values | nindent 8 }}
{{- with .Values.additionalVolumeMounts }}
{{ toYaml . | nindent 8 }}
{{- end }}
ports:
- containerPort: 8080
protocol: TCP
Expand All @@ -170,7 +173,7 @@ spec:
tolerations:
{{ toYaml . | nindent 6 }}
{{- end }}
{{- if or (.Values.dockerSock.mount) (.Values.serverSSL.enable) (.Values.cyberCenter.mtls.enabled) (.Values.additionalCerts) (.Values.persistence.enabled) }}
{{- if or (.Values.dockerSock.mount) (.Values.serverSSL.enable) (.Values.cyberCenter.mtls.enabled) (.Values.additionalCerts) (.Values.persistence.enabled) (.Values.additionalVolumes) }}
volumes:
{{- end }}
{{- if .Values.dockerSock.mount }}
Expand Down Expand Up @@ -206,8 +209,29 @@ spec:
{{- end }}
{{- end }}
{{- include "scanner.additionalCertVolumes" .Values | nindent 6 }}
{{- if .Values.persistence.enabled }}
- name: scanner-pvc
{{- if and (.Values.persistence.enabled) (not (and (eq .Values.persistence.accessMode "ReadWriteOnce") (gt .Values.replicaCount 1))) }}
- name: pvc
persistentVolumeClaim:
claimName: {{ .Release.Name }}-scanner-pvc
{{- end -}}
{{- with .Values.additionalVolumes }}
{{ toYaml . | nindent 6 }}
{{- end }}
{{- if (.Values.persistence.enabled) (eq .Values.persistence.accessMode "ReadWriteOnce") (gt .Values.replicaCount 1) }}
volumeClaimTemplate:
- metadata:
name: pvc
labels:
app: {{ .Release.Name }}-scanner
aqua.component: scanner
{{ include "aqua.labels" . | nindent 8 }}
spec:
accessModes:
- "ReadWriteOnce"
{{- if .Values.persistence.storageclass }}
storageClassName: {{ .Values.persistence.storageclass }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size_in_gb }}Gi
{{- end -}}
2 changes: 1 addition & 1 deletion scanner/templates/scanner-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.persistence.enabled }}
{{- if and (.Values.persistence.enabled) (not (and (eq .Values.persistence.accessMode "ReadWriteOnce") (gt .Values.replicaCount 1))) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down
6 changes: 6 additions & 0 deletions scanner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ persistence:
accessMode: ReadWriteOnce
size: 30Gi # Change to required size
storageClass: # Optional

# Add additional volumes
additionalVolumes: []

# Add associated mount points
additionalVolumeMounts: []