kyverno-policies
OSC Kyverno policies deployment
About this chart
kyverno-policies
OSC Kyverno policies deployment
Maintainers
| Name | Url | |
|---|---|---|
| treydock |
Requirements
| Repository | Name | Version |
|---|---|---|
| https://kyverno.github.io/kyverno/ | kyverno-policies | 3.6.4 |
| https://osc.github.io/osc-helm-charts/ | osc-common | 0.14.2 |
Policies
Table of Contents
- Pod policies
- Validating policies
- Mutate policies
- PersistentVolumeClaim policies
- Validating policies
- Mutate policies
- StatefulSet policies
- Validating policies
- Mutate policies
- Ingress policies
- Mutate policies
- Validating policies
- Service policies
- Validating policies
- Namespace policies
- Validating policies
- PAAS policies
- Validating policies
- Mutate policies
- User policies
- Validating policies
- Infrastructure policies
- Mutate policies
Pod policies
Validating policies
-
authorized-registries
- Rules
- Validates that images come from authorized registries for user namespaces
- Validates that images come from authorized registries for webservice namespaces
- Validates that images come from authorized registries for PAAS namespaces
- Applies to: Pod in user-?* namespaces, webservice namespaces, and PAAS namespaces
- Rules
-
block-images-with-volumes
- Rules
- Blocks pods that use images containing built-in volumes
- Applies to: Pod
- Rules
-
disallow-container-sock-mounts
- Rules
- Validates that Docker Unix socket is not mounted
- Validates that Containerd Unix socket is not mounted
- Validates that CRI-O Unix socket is not mounted
- Applies to: Pod
- Rules
-
disallow-nfs
- Rules
- Validates that NFS volumes are not used in pods
- Applies to: Pod
- Rules
-
pod-account-validation
- Rules
- Validates pod account labels and authorization for user namespaces
- Validates pod account authorization for PAAS namespaces
- Applies to: Pod in user-?* namespaces and PAAS namespaces
- Rules
-
pod-groups-validation
- Rules
- Validates pod supplemental groups authorization for user namespaces
- Applies to: Pod in user-?* namespaces
- Rules
-
pod-host-port
- Rules
- Blocks pods with host port configuration in user namespaces
- Blocks pods with host port configuration in PAAS namespaces
- Applies to: Pod in user-?* namespaces and PAAS namespaces
- Rules
-
pod-lifetime
- Rules
- Validates pod lifetime annotation requirement for user namespaces
- Validates pod lifetime does not exceed 24h limit for user namespaces
- Applies to: Pod in user-?* namespaces
- Rules
-
pod-nodeselector
- Rules
- Validates pod node selector for user namespaces
- Validates pod node selector for webservice namespaces
- Validates pod node selector for PAAS namespaces
- Applies to: Pod in user-?* namespaces, webservice namespaces, and PAAS namespaces
- Rules
-
pod-resources
- Rules
- Validates pod resource requests and limits for user namespaces
- Validates pod resource requests and limits for webservice namespaces
- Validates pod resource limits do not exceed maximum for user namespaces
- Validates pod resource limits do not exceed maximum for webservice namespaces except Dynamo workers
- Applies to: Pod in user-?* namespaces and webservice namespaces
- Rules
-
pod-service-account-validation
- Rules
- Validates webservice pods require a service account for access
- Validates webservice pods have valid service account UID/GID
- Validates webservice pods have valid service account groups
- Validates PAAS pods have valid service account UID/GID
- Validates PAAS pods have valid service account groups
- Applies to: Pod in webservice and PAAS namespaces
- Rules
-
pod-user-validation
- Rules
- Validates pod has valid user UID for user namespaces
- Validates pod has valid user GID for user namespaces
- Validates pod has valid group GID for user namespaces
- Applies to: Pod in user-?* namespaces
- Rules
-
restrict-adding-capabilities
- Rules
- Validate only IPC_LOCK and SYS_RESOURCE are allowed for Dynamo workers
- Applies to: Pod in Dynamo webservice namespaces
- Rules
-
restrict-host-path
- Rules
- Validates that HostPath volumes are not allowed in user namespaces
- Validates that HostPath volumes are not allowed in webservice namespaces
- Validates that HostPath volumes are not allowed in PAAS namespaces
- Applies to: Pod in user-?* namespaces, webservice namespaces, and PAAS namespaces
- Rules
-
restrict-registries
- Rules
- Validates that Pods cannot use images from the docker.io registry
- Applies to: Pod
- Rules
Mutate policies
-
add-account
- Rules
- Adds account label to pods in PAAS namespace
- Applies to: PAAS namespace
- Rules
-
add-mig-gpu
- Rules
- Adds MIG resource request if using generic
nvidia.com/gpurequest - Removes GPU nodeselector from pods
- Adds MIG resource request if using generic
- Applies to: Pod
- Rules
-
add-image-pull-secret
- Rules
- Adds image pull secret to pods in PAAS namespace
- Applies to: PAAS namespace
- Rules
-
add-nodeselector
- Rules
- Adds ondemand nodeselector to pods in user namespaces
- Adds webservices nodeselector to pods in webservice namespaces
- Adds paas nodeselector to pods in PAAS namespaces
- Applies to: Pod in user-?* namespaces, webservice namespaces or PAAS namespaces
- Rules
-
add-receiver
- Rules
- Adds receiver label to webservice resources based on namespace receiver
- Applies to: Pod, Deployment, StatefulSet, Job, Service, Ingress in webservice namespace with
receiverset
- Rules
-
add-service-account
- Rules
- Adds service account security context to webservice pods
- Adds service account security context to PAAS pods
- Applies to: Pod in webservice and PAAS namespaces
- Rules
PersistentVolumeClaim policies
Validating policies
-
pvc-service-account
- Rules
- Validates that PVC using local-home, local-ess or local-scratch storage classes require a service account label to be set for webservices
- Validates that PVC using local-home, local-ess or local-scratch storage classes require correct UID and GID annotations
- Validates that PVC using local-ess or local-scratch storage classes require a fileset annotation to be set
- Validates that PVC using local-home storage classes require a home annotation to be set
- Validates that PVC using local-ess or local-scratch storage classes cannot use PDE filesets with volume permissions
- Validates that PVC using local-ess or local-scratch storage classes require a valid fileset annotation for webservice namespaces
- Validates that PVC using local-ess or local-scratch storage classes require a valid fileset annotation for PAAS namespaces
- Validates that PVC using local-home storage classes require a valid home annotation for webservice namespaces
- Validates that PVC using local-home storage classes require a valid home annotation for PAAS namespaces
- Applies to: PersistentVolumeClaim in webservice and PAAS namespaces with local-home, local-ess or local-scratch storage classes
- Rules
-
restrict-storageclass
- Rules
- Validates that PVC in webservice namespaces must use valid storage classes
- Validates that PVC in PAAS namespaces must use valid storage classes
- Validates that StatefulSet in webservice namespaces must use valid storage classes
- Validates that StatefulSet in PAAS namespaces must use valid storage classes
- Applies to: PersistentVolumeClaim and StatefulSet in webservice and PAAS namespaces
- Rules
Mutate policies
- add-pvc-service-account
- Rules
- Adds service account annotations to persistent volume claims in webservice namespaces
- Adds service account annotations to persistent volume claims in PAAS namespaces
- Applies to: PersistentVolumeClaim in webservice and PAAS namespaces
- Rules
StatefulSet policies
Validating policies
- statefulset-service-account
- Rules
- Validates that StatefulSet using PVC with local-home, local-ess or local-scratch storage classes require a service account label to be set for webservices
- Validates that StatefulSet using PVC with local-home, local-ess or local-scratch storage classes require correct UID and GID annotations
- Validates that StatefulSet using PVC with local-ess or local-scratch storage classes require a fileset annotation to be set
- Validates that StatefulSet using PVC with local-ess or local-scratch storage classes cannot use PDE filesets with volume permissions
- Validates that StatefulSet using PVC with local-ess or local-scratch storage classes require a valid fileset annotation for webservice namespaces
- Validates that StatefulSet using PVC with local-ess or local-scratch storage classes require a valid fileset annotation for PAAS namespaces
- Validates that StatefulSet using PVC with local-home storage classes require a home annotation to be set
- Validates that StatefulSet using PVC with local-home storage classes require a valid home annotation for webservice namespaces
- Validates that StatefulSet using PVC with local-home storage classes require a valid home annotation for PAAS namespaces
- Applies to: StatefulSet in webservice and PAAS namespaces with local-home, local-ess or local-scratch storage classes
- Rules
Mutate policies
- add-statefulset-service-account
- Rules
- Adds service account annotations to statefulset volume claim templates in webservice namespaces
- Adds service account annotations to statefulset volume claim templates in PAAS namespaces
- Applies to: StatefulSet in webservice and PAAS namespaces
- Rules
Ingress policies
Mutate policies
- add-ingress-class-name
- Rules
- Adds ingress class name to ingresses in PAAS namespace
- Applies to: Ingress in PAAS namespace
- Rules
Validating policies
-
ingress-allowed-dns
- Rules
- Validates that ingress DNS hosts are in the allowed list
- Applies to: Ingress in PAAS namespace
- Rules
-
ingress-annotations
- Rules
- Validates that external-dns annotations are not used
- Applies to: Ingress in PAAS namespace
- Rules
-
ingress-require-tls
- Rules
- Validates that ingresses have TLS configured
- Applies to: Ingress
- Rules
-
no-ingress
- Rules
- Blocks ingress in user namespaces
- Applies to: Ingress in user-?* namespaces
- Rules
Service policies
Validating policies
-
no-localhost-service
- Rules
- Blocks ExternalName services pointing to localhost
- Applies to: Service of type ExternalName
- Rules
-
restrict-external-ips
- Rules
- Validates that Services cannot use externalIPs
- Applies to: Service
- Rules
-
service-types
- Rules
- Validates that Services in all namespaces cannot be of type LoadBalancer (except in ingress-nginx namespace)
- Validates that Services in PAAS namespaces cannot be of type ExternalName
- Validates that Services in PAAS namespaces cannot be of type NodePort (unless explicitly allowed)
- Applies to: Service
- Rules
Namespace policies
Validating policies
-
namespace-account
- Rules
- Validates that namespaces have an account label set when they have the paas role
- Validates that namespaces have valid account authorization when they have the paas role
- Applies to: Namespace with paas role
- Rules
-
namespace-role
- Rules
- Validates that namespaces have a role label set
- Applies to: Namespace (excluding default, user-, and kube- namespaces)
- Rules
-
namespace-service-account
- Rules
- Validates that namespaces have a service account label set when they have the paas role
- Applies to: Namespace with paas role
- Rules
KeycloakClient policies
Validating policies
- keycloakclient
- Rules
- Validates the PAAS KeycloakClient redirectUris are allowed ba
- Rules
Deploy kyverno-policies with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kyverno-policies on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartkyverno-policies is pinned at v0.46.8 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply