---
apiVersion: v1
kind: Pod
# ruleid: run-as-non-root
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
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:
  # this is ok because securityContext defined at pod level already: different fix needed
  # ok: run-as-non-root
  securityContext:
    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
  securityContext:
    runAsNonRoot: true
  containers:
    - name: nginx
      image: nginx
    - name: postgres
      image: postgres
      securityContext:
        runAsUser: 1000
        runAsGroup: 3000
        fsGroup: 2000
    - name: haproxy
      image: haproxy
