Skip to content

Commit 92045ae

Browse files
Add CEL Expression to restrict GitRepo volume usage
1 parent bb5d0a4 commit 92045ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

content/en/docs/concepts/storage/volumes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ third party storage driver instead.
311311
The `gitRepo` volume type is deprecated. To provision a container with a git repo, mount an
312312
[EmptyDir](#emptydir) into an InitContainer that clones the repo using git, then mount the
313313
[EmptyDir](#emptydir) into the Pod's container.
314+
315+
---
316+
You can restrict the use of `gitRepo` volumes in your cluster using [policies](https://kubernetes.io/docs/concepts/policy/) like [ValidatingAdmissionPolicy](docs/reference/access-authn-authz/validating-admission-policy/). For example, following Common Expression Language (CEL) expression can be used to restrict pods that uses `gitRepo` volumes: `has(object.spec.volumes) && !object.spec.volumes.exists(v, has(v.gitRepo))`.
317+
314318
{{< /warning >}}
315319

316320
A `gitRepo` volume is an example of a volume plugin. This plugin

0 commit comments

Comments
 (0)