All processes inside a Pod can be made to run with specific user and groupID by setting `runAsUser` and `runAsGroup` respectively. `fsGroup` can be specified to make sure any file created in the volume will have the specified groupID. This policy validates that these fields are set to the defined values.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: validate-userid-groupid-fsgroupannotations:policies.kyverno.io/title: Validate User ID, Group ID, and FS Group in CEL expressionspolicies.kyverno.io/category: Sample in CELpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/minversion: 1.11.0kyverno.io/kyverno-version: 1.11.0kyverno.io/kubernetes-version: 1.26-1.27policies.kyverno.io/description: All processes inside a Pod can be made to run with specific user and groupID by setting `runAsUser` and `runAsGroup` respectively. `fsGroup` can be specified to make sure any file created in the volume will have the specified groupID. This policy validates that these fields are set to the defined values.spec:validationFailureAction: Auditbackground: truerules:- name: validate-userid-groupid-fsgroupmatch:any:- resources:kinds:- Podoperations:- CREATE- UPDATEvalidate:cel:expressions:- expression: object.spec.?securityContext.?runAsUser.orValue(1) == 1000message: User ID should be 1000.- expression: object.spec.?securityContext.?runAsGroup.orValue(1) == 3000message: Group ID should be 3000.- expression: object.spec.?securityContext.?fsGroup.orValue(1) == 2000message: fs Group should be 2000.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.