refactor: align ksvc spec with operator patterns, bump Knative to v1.… #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Spike — Knative in kind | |
| on: | |
| workflow_dispatch: {} | |
| push: | |
| branches: | |
| - feat/provisioning-handlers | |
| paths: | |
| - ".github/workflows/spike-knative-kind.yaml" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| knative-in-kind: | |
| name: Install Knative Serving in kind | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Create kind cluster | |
| uses: helm/kind-action@v1 | |
| with: | |
| cluster_name: knative-spike | |
| wait: 120s | |
| - name: Cluster info | |
| run: | | |
| kubectl version | |
| kubectl get nodes -o wide | |
| # ── Install Knative Serving CRDs + core ────────────────────────── | |
| - name: Install Knative Serving CRDs | |
| run: | | |
| KNATIVE_VERSION=v1.20.0 | |
| echo "Installing Knative Serving ${KNATIVE_VERSION} CRDs..." | |
| kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-crds.yaml" | |
| - name: Install Knative Serving core | |
| run: | | |
| KNATIVE_VERSION=v1.20.0 | |
| echo "Installing Knative Serving ${KNATIVE_VERSION} core..." | |
| kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-core.yaml" | |
| # ── Install a networking layer (Kourier is simplest for CI) ────── | |
| - name: Install Kourier networking | |
| run: | | |
| KNATIVE_VERSION=v1.20.0 | |
| echo "Installing Kourier networking layer..." | |
| kubectl apply -f "https://github.com/knative/net-kourier/releases/download/knative-${KNATIVE_VERSION}/kourier.yaml" | |
| # Tell Knative to use Kourier | |
| kubectl patch configmap/config-network \ | |
| --namespace knative-serving \ | |
| --type merge \ | |
| --patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}' | |
| # ── Wait for Knative to be ready ───────────────────────────────── | |
| - name: Wait for Knative Serving pods | |
| run: | | |
| echo "Waiting for Knative Serving pods..." | |
| kubectl wait --for=condition=Available deployment --all \ | |
| -n knative-serving --timeout=180s || true | |
| echo "" | |
| echo "=== Knative Serving pods ===" | |
| kubectl get pods -n knative-serving | |
| echo "" | |
| echo "=== Kourier pods ===" | |
| kubectl get pods -n kourier-system || true | |
| # ── Verify CRDs are registered ────────────────────────────────── | |
| - name: Verify Knative CRDs | |
| run: | | |
| echo "=== Knative Serving CRDs ===" | |
| kubectl get crd | grep knative || { echo "No Knative CRDs found!"; exit 1; } | |
| echo "" | |
| echo "=== API Resources for serving.knative.dev ===" | |
| kubectl api-resources --api-group=serving.knative.dev | |
| # ── Deploy a test Knative Service ──────────────────────────────── | |
| - name: Deploy test Knative Service | |
| run: | | |
| cat <<'EOF' | kubectl apply -f - | |
| apiVersion: serving.knative.dev/v1 | |
| kind: Service | |
| metadata: | |
| name: hello-test | |
| namespace: default | |
| spec: | |
| template: | |
| spec: | |
| containers: | |
| - image: ghcr.io/knative/helloworld-go:latest | |
| ports: | |
| - containerPort: 8080 | |
| env: | |
| - name: TARGET | |
| value: "Knative in kind CI" | |
| EOF | |
| - name: Wait for Knative Service to become ready | |
| run: | | |
| echo "Waiting for ksvc/hello-test to be ready..." | |
| for i in $(seq 1 30); do | |
| STATUS=$(kubectl get ksvc hello-test -n default -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || echo "NotFound") | |
| URL=$(kubectl get ksvc hello-test -n default -o jsonpath='{.status.url}' 2>/dev/null || echo "") | |
| echo " attempt $i: Ready=$STATUS url=$URL" | |
| if [ "$STATUS" = "True" ]; then | |
| echo "" | |
| echo "Knative Service is READY!" | |
| echo "URL: $URL" | |
| break | |
| fi | |
| sleep 10 | |
| done | |
| echo "" | |
| echo "=== Final ksvc status ===" | |
| kubectl get ksvc -n default | |
| echo "" | |
| kubectl describe ksvc hello-test -n default | |
| # ── Diagnostics on failure ─────────────────────────────────────── | |
| - name: Dump diagnostics on failure | |
| if: failure() | |
| run: | | |
| echo "=== Knative Serving pods ===" | |
| kubectl get pods -n knative-serving -o wide || true | |
| echo "" | |
| echo "=== Kourier pods ===" | |
| kubectl get pods -n kourier-system -o wide || true | |
| echo "" | |
| echo "=== Events (knative-serving) ===" | |
| kubectl get events -n knative-serving --sort-by='.lastTimestamp' | tail -30 || true | |
| echo "" | |
| echo "=== Events (default) ===" | |
| kubectl get events -n default --sort-by='.lastTimestamp' | tail -30 || true | |
| echo "" | |
| echo "=== ksvc describe ===" | |
| kubectl describe ksvc hello-test -n default || true | |
| echo "" | |
| echo "=== Pods in default namespace ===" | |
| kubectl get pods -n default -o wide || true |