chore: test basic validation rule feature

This commit is contained in:
Stefan Reimer 2025-06-16 14:23:24 +00:00
parent 7a81e34eff
commit 583542aded
3 changed files with 3 additions and 10 deletions

View File

@ -2,7 +2,7 @@
apiVersion: kyverno.io/v1 apiVersion: kyverno.io/v1
kind: ClusterPolicy kind: ClusterPolicy
metadata: metadata:
name: add-aws-iam-oidc-mapping name: add-aws-iam-pod-identity
annotations: annotations:
policies.kyverno.io/title: AWS Pod Identity policies.kyverno.io/title: AWS Pod Identity
policies.kyverno.io/category: aws policies.kyverno.io/category: aws
@ -10,6 +10,7 @@ metadata:
kyverno.io/kubernetes-version: "1.31" kyverno.io/kubernetes-version: "1.31"
policies.kyverno.io/subject: Pod policies.kyverno.io/subject: Pod
policies.kyverno.io/description: >- policies.kyverno.io/description: >-
This provides the EKS Pod Identity Webhook functionality for KubeZero.
Pods having a service account annotated with \"kubezero.com/aws-iam-role-arn\" Pods having a service account annotated with \"kubezero.com/aws-iam-role-arn\"
will get the required environment variables as well as volumes injected will get the required environment variables as well as volumes injected
to make the SDKs automatically find and use the IAM role. to make the SDKs automatically find and use the IAM role.

View File

@ -18,7 +18,6 @@ metadata:
to or replacement of this policy, preventing users from mounting the parent directories to or replacement of this policy, preventing users from mounting the parent directories
(/var/run and /var) may be necessary to completely prevent socket bind mounts. (/var/run and /var) may be necessary to completely prevent socket bind mounts.
spec: spec:
validationFailureAction: Audit
background: true background: true
rules: rules:
- name: validate-socket-mounts - name: validate-socket-mounts
@ -31,6 +30,7 @@ spec:
- CREATE - CREATE
- UPDATE - UPDATE
validate: validate:
failureAction: Enforce
cel: cel:
variables: variables:
- name: hasVolumes - name: hasVolumes

View File

@ -1,10 +1,3 @@
#apiVersion: v1
#kind: ServiceAccount
#metadata:
# name: kube-bench
# annotations:
# kubezero.com/aws-iam-role-arn: arn:aws:iam::123456789012:role/kube-bench
#---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
@ -15,7 +8,6 @@ spec:
labels: labels:
app: kube-bench app: kube-bench
spec: spec:
# serviceAccountName: kube-bench
containers: containers:
- command: ["kube-bench"] - command: ["kube-bench"]
#args: #args: