---
apiVersion: v1
kind: Pod
# this is ok becuase no securityContext at pod level: other fix required (other rule)
# ok: run-as-non-root-security-context-pod-level
spec:
  containers:
    - name: nginx
      image: nginx
    - name: postgres
      image: postgres
      securityContext:
        runAsUser: 1000
        runAsGroup: 3000
        fsGroup: 2000
    - name: haproxy
      image: haproxy
---
apiVersion: v1
kind: Pod
# this is ok because runAsNonRoot defined at container level: fix other containers at that level
# ok: run-as-non-root-security-context-pod-level
spec:
  containers:
    - name: nginx
      image: nginx
    - name: postgres
      image: postgres
      securityContext:
        runAsUser: 1000
        runAsGroup: 3000
        fsGroup: 2000
    - name: haproxy
      image: haproxy
      securityContext:
        runAsNonRoot: true
---
apiVersion: v1
kind: Pod
spec:
  # ruleid: run-as-non-root-security-context-pod-level
  securityContext:
    runAsNonRoot: true #:
    runAsGroup: 3000
  containers:
    - name: nginx
      image: nginx
    - name: postgres
      image: postgres
      securityContext:
        runAsUser: 1000
        runAsGroup: 3000
        fsGroup: 2000
    - name: haproxy
      image: haproxy
---
apiVersion: v1
kind: Pod
spec:
  # this is ok because runAsNonRoot defined at pod level already
  # ok: run-as-non-root-security-context-pod-level
  securityContext:
    runAsNonRoot: true
  containers:
    - name: nginx
      image: nginx
    - name: postgres
      image: postgres
      securityContext:
        runAsUser: 1000
        runAsGroup: 3000
        fsGroup: 2000
    - name: haproxy
      image: haproxy
