apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: node-exporter-restricted
  annotations:
    seccomp.security.alpha.kubernetes.io/allowedProfileNames: runtime/default
    seccomp.security.alpha.kubernetes.io/defaultProfileName:  runtime/default
    apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
    apparmor.security.beta.kubernetes.io/defaultProfileName:  runtime/default
spec:

  # see https://github.com/prometheus-operator/kube-prometheus/issues/572 even if the example is wrong

  privileged: false
  allowPrivilegeEscalation: false
  requiredDropCapabilities:
    - ALL
  hostPID: false
  hostIPC: false
  hostNetwork: false
  supplementalGroups:
    rule: MustRunAs
    ranges:
      - min: 1
        max: 65535
  fsGroup:
    rule: MustRunAs
    ranges:
      - min: 1
        max: 65535
  seLinux:
    rule: RunAsAny
  readOnlyRootFilesystem: true

  # DIFFERENCES from sbt-restricted
  volumes:
    - emptyDir
    - configMap
    - secret
    - hostPath
    - downwardAPI
    - projected
  allowedHostPaths:
    - pathPrefix: /proc
    - pathPrefix: /sys
    - pathPrefix: /root
    - pathPrefix: /
      readOnly: true
  hostPorts:
    - min: 9100
      max: 9100
  runAsUser:
    rule: RunAsAny
  # runAsGroup:
  #   rule: MustRunAs
  #   ranges:
  #     - min: 100
  #       max: 65535
