
# k8spspseccomp
#### 基本信息
- 策略类型：安全
- 推荐级别：L3
- 生效资源类型：Pod
- 参数： allowedLocalhostFiles：数组
  allowedProfiles：数组
  exemptImages：字符串数组
  
 
#### 作用
约束PodSecurityPolicy上的"seccomp.security.alpha.kubernetes.io/allowedProfileNames"注解。
#### 策略实例示例
以下策略实例展示了策略定义生效的资源类型，parameters中allowedProfiles定义了允许的注解。
```
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPSeccomp
metadata:
  name: psp-seccomp
spec:
  match:
    kinds:
      - apiGroups: [""]
        kinds: ["Pod"]
  parameters:
    allowedProfiles:
    - runtime/default
    - docker/default
```
#### 符合策略实例的资源定义
示例中的container.seccomp.security.alpha.kubernetes.io/nginx注解的value在设定的值列表中，符合策略定义。
```
apiVersion: v1
kind: Pod
metadata:
  name: nginx-seccomp-allowed
  annotations:
    container.seccomp.security.alpha.kubernetes.io/nginx: runtime/default
  labels:
    app: nginx-seccomp
spec:
  containers:
  - name: nginx
    image: nginx
```
#### 不符合策略实例的资源定义
示例中的container.seccomp.security.alpha.kubernetes.io/nginx注解的value没在设定的值列表中，不符合策略定义。
```
apiVersion: v1
kind: Pod
metadata:
  name: nginx-seccomp-disallowed
  annotations:
    container.seccomp.security.alpha.kubernetes.io/nginx: unconfined
  labels:
    app: nginx-seccomp
spec:
  containers:
  - name: nginx
    image: nginx
```
