#!/usr/bin/env bash # Compare two filters and an admission-time quota denial on an isolated namespace. set -euo pipefail test "$(kubectl config current-context)" = kind-handbook-lab ns=$(kubectl create -f - -o jsonpath='{.metadata.name}' <<'YAML' apiVersion: v1 kind: Namespace metadata: {generateName: schedule-study-} YAML ) trap 'kubectl delete namespace "$ns" --wait=false >/dev/null' EXIT node=$(kubectl get node -o jsonpath='{.items[0].metadata.labels.kubernetes\.io/hostname}') pod() { kubectl -n "$ns" apply -f - < /dev/null 2>"${TMPDIR:-/tmp}/$ns.err"; then echo 'unexpected admission'; exit 1; fi grep 'exceeded quota' "${TMPDIR:-/tmp}/$ns.err" rm -f "${TMPDIR:-/tmp}/$ns.err"