# probe-standard: the CONTROL. An ordinary pod (no runtimeClassName) that runs the
# same DNS query-rate probe as probe-sandboxed. The egress NetworkPolicy selects it
# by the app: dns-probe label, exactly as it selects the sandboxed probe.
#
# This pod is identical to probe-sandboxed in every field that could affect the
# measurement (image, command, resources, the app label). The ONLY difference
# between the two probes is that probe-sandboxed sets
# runtimeClassName: isolated-sandbox and this one does not, so any difference in how
# a per-sandbox limit affects them is attributable to the sandbox path and nothing
# else.
apiVersion: v1
kind: Pod
metadata:
  name: probe-standard
  namespace: sandbox-limits
  labels:
    app: dns-probe            # the egress NetworkPolicy selects this label
  annotations:
    karpenter.sh/do-not-disrupt: "true"   # keep consolidation from evicting this bare pod mid-run
spec:
  # Hardened to clear ASH/checkov CKV_K8S_20,22,23,28,29,30,31,37,38,40.
  # Identical on every probe pod and the sink, so it does not change the
  # one-line difference between the pods. The probe uses ordinary UDP/TCP
  # sockets and reads world-readable files only, so a non-root UID and
  # dropped capabilities do not change the measured limit.
  automountServiceAccountToken: false
  securityContext:
    runAsNonRoot: true
    runAsUser: 10001
    runAsGroup: 10001
    seccompProfile:
      type: RuntimeDefault
  containers:
    - name: probe
      image: public.ecr.aws/docker/library/python:3.12-slim
      imagePullPolicy: IfNotPresent
      securityContext:
        allowPrivilegeEscalation: false
        capabilities:
          drop: ["ALL"]
        readOnlyRootFilesystem: true
      volumeMounts:
        # readOnlyRootFilesystem needs a writable /tmp: the container does
        # `touch /tmp/ready` and the readiness probe `cat /tmp/ready`.
        - name: tmp
          mountPath: /tmp
      command: ["/bin/sh", "-c"]
      args:
        - |
          touch /tmp/ready
          exec sleep infinity
      readinessProbe:
        exec:
          command: ["cat", "/tmp/ready"]
        initialDelaySeconds: 2
        periodSeconds: 3
        failureThreshold: 40
      resources:
        # requests == limits => Guaranteed QoS. probe-sandboxed carries the same
        # block so the two pods differ only in runtimeClassName.
        requests:
          cpu: "1"
          memory: 768Mi
        limits:
          cpu: "1"
          memory: 768Mi
  volumes:
    - name: tmp
      emptyDir: {}
