First slice of readonly parity for arbitrary resources/CRDs (ROADMAP 4.1). Hybrid design: keep the curated 24 kinds; add a dynamic path for any discovered GVK. This commit lands the provider layer + a headless verification mode. - ResourceProvider::discover -> all API resources on a context via kube::discovery - ResourceProvider::list_dynamic -> bounded one-shot list of any resource as generic rows (namespace/name/age/best-effort status) via Api<DynamicObject> - ResourceProvider::get_dynamic -> full manifest for describe - DiscoveredResource / DynamicRow types (cluster module) - hidden `--discover [--discover-resource <plural|kind>]` mode prints the catalog and optionally lists+describes one resource (verifies the path end-to-end) - scripts/scale/crds.sh installs a sample CRD (widgets.demo.krust.io) + CRs Verified against the kwok lab: discovered 68 resources incl. the CRD and core kinds outside the curated set (endpoints, endpointslices); listed and described the Widgets. The interactive UI (:api catalog + dynamic browse overlay) lands next in 4.1a-2. Validation: fmt, check, test (75 passed / 4 ignored), release build all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install a sample CRD + a few custom resources on the kwok cluster, so the dynamic
|
|
# resource discovery path (Phase 4.1) has a real CRD to find and browse.
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
|
|
require kubectl
|
|
|
|
kc apply -f - <<'EOF'
|
|
apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: widgets.demo.krust.io
|
|
spec:
|
|
group: demo.krust.io
|
|
scope: Namespaced
|
|
names:
|
|
plural: widgets
|
|
singular: widget
|
|
kind: Widget
|
|
shortNames: [wdg]
|
|
versions:
|
|
- name: v1
|
|
served: true
|
|
storage: true
|
|
schema:
|
|
openAPIV3Schema:
|
|
type: object
|
|
properties:
|
|
spec:
|
|
type: object
|
|
properties:
|
|
size: { type: string }
|
|
status:
|
|
type: object
|
|
properties:
|
|
phase: { type: string }
|
|
EOF
|
|
|
|
echo "waiting for CRD to register ..."
|
|
kc wait --for=condition=Established crd/widgets.demo.krust.io --timeout=30s || true
|
|
|
|
for i in 0 1 2; do
|
|
kc apply -f - <<EOF
|
|
apiVersion: demo.krust.io/v1
|
|
kind: Widget
|
|
metadata: { name: widget-${i}, namespace: ns-00 }
|
|
spec: { size: "large" }
|
|
EOF
|
|
done
|
|
|
|
echo "created CRD widgets.demo.krust.io + 3 Widgets in ns-00"
|
|
echo "verify: krust --kubeconfig $KRUST_SCALE_KUBECONFIG --discover --discover-resource widgets"
|