Skip to content

Commit

Permalink
feat: add psp-check-supplemental-groups-modules
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Nov 13, 2023
1 parent 6e48ce8 commit abff52f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions psp-check-supplemental-groups/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Introduction

`psp-check-supplemental-groups` is a KCL PSP validation package.

## Resource

The Code source and document are [here](https://github.com/kcl-lang/modules/tree/main/psp-check-supplemental-groups)
5 changes: 5 additions & 0 deletions psp-check-supplemental-groups/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "psp-check-supplemental-groups"
version = "0.1.0"
description = "`psp-check-supplemental-groups` is a kcl validation package"

Empty file.
8 changes: 8 additions & 0 deletions psp-check-supplemental-groups/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Define the validation function
validate = lambda item: {str:} {
if item.kind == "Pod":
assert item.spec?.securityContext?.supplementalGroups in ["100-200", "500-600"]
item
}
# Validate All resource
items = [validate(i) for i in option("items") or []]

0 comments on commit abff52f

Please sign in to comment.