Skip to content

feat: add Persistent Volume and Persistent Volume Claim resources - #2999

Merged
eyalke merged 5 commits into
aquasecurity:mainfrom
LaibaBareera:add-pv/pvc
Jun 17, 2026
Merged

eyalke merged 5 commits into
aquasecurity:mainfrom
LaibaBareera:add-pv/pvc

Conversation

@LaibaBareera

@LaibaBareera LaibaBareera commented Jun 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This change adds Kubernetes Config Audit support for PersistentVolume and PersistentVolumeClaim resources in Trivy Operator.

Previously, Trivy Operator did not fully process PV/PVC resources as part of config audit scanning. As a result, policies targeting these resource kinds could be evaluated in limited/custom scenarios, but PV/PVC support was not consistently available across the controller flow, default supported kinds, RBAC, and deployment manifests.

This update adds PV/PVC support across the required components:

  • Adds PersistentVolume and PersistentVolumeClaim kind handling in the Kubernetes object model.
  • Adds spec hash support for PV/PVC resources.
  • Adds object resolution support for PV/PVC.
  • Treats PersistentVolume as a cluster-scoped resource.
  • Treats PersistentVolumeClaim as a namespace-scoped resource.
  • Adds PV/PVC to the config audit resource controller.
  • Adds PV/PVC handling to the policy config controller so reports are refreshed correctly when policy configuration changes.
  • Updates supported config audit kinds to include PV/PVC.
  • Updates Helm values and generated RBAC to include PV/PVC.
  • Updates documentation/config where supported resource kinds are listed.

Expected Behavior

After this change:

  • PersistentVolume resources should be scanned and reported through ClusterConfigAuditReport.
  • PersistentVolumeClaim resources should be scanned and reported through ConfigAuditReport.
  • Policies targeting PersistentVolume or PersistentVolumeClaim should be evaluated when these resources are created or updated.
  • PV/PVC reports should be refreshed correctly when the policy ConfigMap changes.
  • Helm/static deployments should include the required RBAC permissions to get/list/watch PV/PVC resources.

Validation

Validation should include creating a custom Rego policy for PersistentVolume or PersistentVolumeClaim, applying a matching resource, and confirming that the relevant Config Audit report is created.

Example expected result for PV:

kubectl get clusterconfigauditreports.aquasecurity.github.io -A

A report similar to the following should be created:

persistentvolume-<pv-name>

with labels such as:

trivy-operator.resource.kind=PersistentVolume
trivy-operator.resource.name=<pv-name>

For PVC:

kubectl get configauditreports.aquasecurity.github.io -A

A report similar to the following should be created:

persistentvolumeclaim-<pvc-name>

with labels such as:

trivy-operator.resource.kind=PersistentVolumeClaim
trivy-operator.resource.namespace=<namespace>

@afdesk afdesk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eyalke
eyalke merged commit 559fdc2 into aquasecurity:main Jun 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants