# probe-sandboxed-raised: the OPTIONAL variant. Identical to probe-sandboxed, with
# one annotation added that raises the per-pod DNS query-rate limit:
#
#   sandbox.amazonaws.com/dns-packets-per-second: "300"
#
# The Amazon EKS User Guide (Isolated and confidential pods limitations, "Per-pod
# DNS query rate limit") documents this annotation: the default is 100 queries per
# second per family, and this annotation sets it per pod (values above 512 are
# clamped to 512). Setting it here lets the sample show the measured plateau move
# from about the default to about the raised value, which is direct evidence that
# the plateau is this limit and not something else.
#
# This pod carries the same app: dns-probe label, so the egress NetworkPolicy
# selects it too.
apiVersion: v1
kind: Pod
metadata:
  name: probe-sandboxed-raised
  namespace: sandbox-limits
  labels:
    app: dns-probe
  annotations:
    karpenter.sh/do-not-disrupt: "true"
    # Raise the per-pod DNS query-rate limit above the 100 qps default. Documented
    # in the Amazon EKS User Guide, Isolated and confidential pods limitations.
    sandbox.amazonaws.com/dns-packets-per-second: "300"
spec:
  runtimeClassName: isolated-sandbox
  # 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:
          cpu: "1"
          memory: 768Mi
        limits:
          cpu: "1"
          memory: 768Mi
  volumes:
    - name: tmp
      emptyDir: {}
