diff --git a/psp-check-supplemental-groups/README.md b/psp-check-supplemental-groups/README.md new file mode 100644 index 00000000..d8038c48 --- /dev/null +++ b/psp-check-supplemental-groups/README.md @@ -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) diff --git a/psp-check-supplemental-groups/kcl.mod b/psp-check-supplemental-groups/kcl.mod new file mode 100644 index 00000000..8e539ecd --- /dev/null +++ b/psp-check-supplemental-groups/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "psp-check-supplemental-groups" +version = "0.1.0" +description = "`psp-check-supplemental-groups` is a kcl validation package" + diff --git a/psp-check-supplemental-groups/kcl.mod.lock b/psp-check-supplemental-groups/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/psp-check-supplemental-groups/main.k b/psp-check-supplemental-groups/main.k new file mode 100644 index 00000000..4a5583eb --- /dev/null +++ b/psp-check-supplemental-groups/main.k @@ -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 []]