Skip to content

Commit

Permalink
feat: add psp selinux models
Browse files Browse the repository at this point in the history
  • Loading branch information
Peefy committed Aug 29, 2023
1 parent 7b2b8d4 commit 7a7884e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/mutation/pod-security-policy/selinux/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "selinux"
edition = "0.0.1"
version = "0.0.1"

Empty file.
13 changes: 13 additions & 0 deletions examples/mutation/pod-security-policy/selinux/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
schema Params:
level?: str = "s1:c234,c567"
user?: str = "sysadm_u"
role?: str = "sysadm_r"
$type: str = "svirt_lxc_net_t"

params: Params = option("params")
items = [item | {
if item.kind == "Pod":
spec.containers: [{
securityContext.seLinuxOptions = params
} for container in item.spec.containers]
} for item in option("items") or []]
22 changes: 22 additions & 0 deletions examples/mutation/pod-security-policy/selinux/suite/good.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: krm.kcl.dev/v1alpha1
kind: KCLRun
metadata:
name: selinux
annotations:
krm.kcl.dev/version: 0.0.1
krm.kcl.dev/type: mutation
documentation: >-
Pod Secirity Policy (PSP) selinux
spec:
source: ./examples/mutation/pod-security-policy/selinux/main.k
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-default-selinux
labels:
app: nginx-default-selinux
spec:
containers:
- name: nginx
image: nginx

0 comments on commit 7a7884e

Please sign in to comment.