Skip to content

Commit

Permalink
Use NFS PersistentVolume for asset-manager clamav for compliance with…
Browse files Browse the repository at this point in the history
… PSS restricted

Description:
- PSS restricted doesn't allow volume types of `nfs` (see [here](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted)) but does allow us to use a `PersistentVolume` of type NFS
- As part of #1883
  • Loading branch information
nimalank7 committed Jan 17, 2025
1 parent d138532 commit d72eb43
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
5 changes: 2 additions & 3 deletions charts/asset-manager/templates/_freshclam_podspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ spec:
readOnlyRootFilesystem: true
volumes:
- name: clam-virus-db
nfs:
server: "{{ .Values.assetManagerNFS }}"
path: /clamav-db
persistentVolumeClaim:
claimName: {{ include "licensify.name" . }}-{{ .Values.appName }}-db
- name: etc-clamav
configMap:
name: {{ $fullName }}-etc-clamav
Expand Down
21 changes: 21 additions & 0 deletions charts/asset-manager/templates/clamav-pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- define "asset-manager.freshclam.podspec" }}
{{- $fullName := include "asset-manager.fullname" . }}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ $fullName }}-freshclam-db
labels:
{{- include "asset-manager.labels" . | nindent 4 }}
app: {{ .Values.fullName }}
app.kubernetes.io/name: {{ .Values.fullName }}-freshclam-db
app.kubernetes.io/component: {{ .Values.fullName }}-freshclam-db #V Verify this
spec:
capacity:
storage: {{ .Values.nfs.storage }}
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: "{{ .Values.assetManagerNFS }}"
path: /clamav-db
readOnly: true
21 changes: 21 additions & 0 deletions charts/asset-manager/templates/clamav-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- define "asset-manager.freshclam.podspec" }}
{{- $fullName := include "asset-manager.fullname" . }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ $fullName }}-freshclam-db
labels:
{{- include "asset-manager.labels" . | nindent 4 }}
app: {{ $fullName }}-freshclam
app.kubernetes.io/name: {{ $fullName }}-freshclam-db # Verify this
app.kubernetes.io/component: {{ $fullName }}-freshclam-db # Verify this
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.nfs.storage }}
selector:
matchLabels:
{{- include "asset-manager.selectorLabels" . | nindent 6 }}
6 changes: 2 additions & 4 deletions charts/asset-manager/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ spec:
server: "{{ .Values.assetManagerNFS }}"
path: /asset-manager
- name: clam-virus-db
nfs:
server: "{{ .Values.assetManagerNFS }}"
path: /clamav-db
readOnly: true
persistentVolumeClaim:
claimName: { { include "licensify.name" . } }-{{ .Values.appName }}-db
- name: etc-clamav
configMap:
name: {{ $fullName }}-etc-clamav
Expand Down
2 changes: 2 additions & 0 deletions charts/asset-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@ redis:
redisUrlOverride:
app: ""
workers: ""
nfs:
storage: 15Gi

0 comments on commit d72eb43

Please sign in to comment.