fix: install the Gateway API CRDs when Q56 or Q74 is seeded
kind ships no Gateway API CRDs. Set C's Q74 creates a GatewayClass at seed
time and assumed they were already there; the only code that installed them
was Q56's setup and the retired Set A Gateway task. On a cluster rebuilt by
./setup.sh, `./exam sim c` therefore failed to seed Q74 ("no matches for
kind GatewayClass") and the task could not be done as written.
Both setups now call ensure_gateway_crds, a PRELUDE helper next to
ensure_etcd_tools. Verified on a throwaway cluster with the CRDs deleted:
Q74 and Q56 each seed cleanly, grade 0 unsolved and full when solved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mhxm4rsUfuE5HoytYbu2YW
This commit is contained in:
parent
43e2e1db2f
commit
e1ae1876b3
9
exam
9
exam
@ -127,6 +127,15 @@ ensure_etcd_tools() {
|
||||
nx "$CP" 'command -v etcdctl >/dev/null 2>&1 && command -v etcdutl >/dev/null 2>&1' </dev/null && return 0
|
||||
bash "${CKA_ROOT:-.}/etcd-tools.sh" --emit | nx "$CP" 'sh -s'
|
||||
}
|
||||
# ensure_gateway_crds -> the Gateway API CRDs (standard channel), which kind does not ship. Q56 and
|
||||
# Q74 need them at seed time; a cluster rebuilt by ./setup.sh has none until one of them installs it.
|
||||
ensure_gateway_crds() {
|
||||
$K get crd gateways.gateway.networking.k8s.io >/dev/null 2>&1 && return 0
|
||||
curl -sfL --max-time 60 https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml -o /tmp/gwapi.yaml \
|
||||
&& $K apply -f /tmp/gwapi.yaml >/dev/null 2>&1 \
|
||||
&& $K wait --for=condition=Established --timeout=60s crd/gatewayclasses.gateway.networking.k8s.io \
|
||||
crd/gateways.gateway.networking.k8s.io crd/httproutes.gateway.networking.k8s.io >/dev/null 2>&1
|
||||
}
|
||||
"""
|
||||
|
||||
def _pick_track_arg(argv):
|
||||
|
||||
@ -531,7 +531,7 @@ Create in `%{ns}`:
|
||||
"params_post": None,
|
||||
"setup": NS + r"""
|
||||
mkns %{ns}
|
||||
$K get crd gateways.gateway.networking.k8s.io >/dev/null 2>&1 || { curl -sfL --max-time 60 https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml -o /tmp/gwapi.yaml && $K apply -f /tmp/gwapi.yaml >/dev/null 2>&1; } || echo "warn: could not install Gateway API CRDs"
|
||||
ensure_gateway_crds || echo "warn: could not install the Gateway API CRDs (no network?) - the task needs them"
|
||||
for v in v1 v2; do $K -n %{ns} create deploy $v --image=nginx:1.25 --port=80 --dry-run=client -o yaml | $K apply -f - >/dev/null; $K -n %{ns} expose deploy $v --port=80 --dry-run=client -o yaml | $K apply -f - >/dev/null; done
|
||||
$K delete gatewayclass %{host}-gc --ignore-not-found >/dev/null 2>&1; $K -n %{ns} delete gateway %{host}-gw --ignore-not-found >/dev/null 2>&1; $K -n %{ns} delete httproute %{host}-route --ignore-not-found >/dev/null 2>&1
|
||||
""",
|
||||
|
||||
@ -480,6 +480,7 @@ for v in v1 v2; do
|
||||
$K -n fleet-ops create deploy fleet-dashboard-$v --image=nginx:1.27 --port=80 --dry-run=client -o yaml | $K apply -f - >/dev/null
|
||||
$K -n fleet-ops expose deploy fleet-dashboard-$v --port=80 --target-port=80 --dry-run=client -o yaml | $K apply -f - >/dev/null
|
||||
done
|
||||
ensure_gateway_crds || { echo "no Gateway API CRDs and could not download them (no network?) - install them, then re-seed"; exit 1; }
|
||||
$K apply -f - >/dev/null <<'EOF'
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: GatewayClass
|
||||
|
||||
Loading…
Reference in New Issue
Block a user