|
| 1 | +name: Spike — Knative in kind |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - feat/provisioning-handlers |
| 8 | + paths: |
| 9 | + - ".github/workflows/spike-knative-kind.yaml" |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + knative-in-kind: |
| 17 | + name: Install Knative Serving in kind |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 15 |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v5 |
| 24 | + |
| 25 | + - name: Create kind cluster |
| 26 | + uses: helm/kind-action@v1 |
| 27 | + with: |
| 28 | + cluster_name: knative-spike |
| 29 | + wait: 120s |
| 30 | + |
| 31 | + - name: Cluster info |
| 32 | + run: | |
| 33 | + kubectl version |
| 34 | + kubectl get nodes -o wide |
| 35 | +
|
| 36 | + # ── Install Knative Serving CRDs + core ────────────────────────── |
| 37 | + - name: Install Knative Serving CRDs |
| 38 | + run: | |
| 39 | + KNATIVE_VERSION=v1.17.0 |
| 40 | + echo "Installing Knative Serving ${KNATIVE_VERSION} CRDs..." |
| 41 | + kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-crds.yaml" |
| 42 | +
|
| 43 | + - name: Install Knative Serving core |
| 44 | + run: | |
| 45 | + KNATIVE_VERSION=v1.17.0 |
| 46 | + echo "Installing Knative Serving ${KNATIVE_VERSION} core..." |
| 47 | + kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-core.yaml" |
| 48 | +
|
| 49 | + # ── Install a networking layer (Kourier is simplest for CI) ────── |
| 50 | + - name: Install Kourier networking |
| 51 | + run: | |
| 52 | + KNATIVE_VERSION=v1.17.0 |
| 53 | + echo "Installing Kourier networking layer..." |
| 54 | + kubectl apply -f "https://github.com/knative/net-kourier/releases/download/knative-${KNATIVE_VERSION}/kourier.yaml" |
| 55 | +
|
| 56 | + # Tell Knative to use Kourier |
| 57 | + kubectl patch configmap/config-network \ |
| 58 | + --namespace knative-serving \ |
| 59 | + --type merge \ |
| 60 | + --patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}' |
| 61 | +
|
| 62 | + # ── Wait for Knative to be ready ───────────────────────────────── |
| 63 | + - name: Wait for Knative Serving pods |
| 64 | + run: | |
| 65 | + echo "Waiting for Knative Serving pods..." |
| 66 | + kubectl wait --for=condition=Available deployment --all \ |
| 67 | + -n knative-serving --timeout=180s || true |
| 68 | +
|
| 69 | + echo "" |
| 70 | + echo "=== Knative Serving pods ===" |
| 71 | + kubectl get pods -n knative-serving |
| 72 | +
|
| 73 | + echo "" |
| 74 | + echo "=== Kourier pods ===" |
| 75 | + kubectl get pods -n kourier-system || true |
| 76 | +
|
| 77 | + # ── Verify CRDs are registered ────────────────────────────────── |
| 78 | + - name: Verify Knative CRDs |
| 79 | + run: | |
| 80 | + echo "=== Knative Serving CRDs ===" |
| 81 | + kubectl get crd | grep knative || { echo "No Knative CRDs found!"; exit 1; } |
| 82 | +
|
| 83 | + echo "" |
| 84 | + echo "=== API Resources for serving.knative.dev ===" |
| 85 | + kubectl api-resources --api-group=serving.knative.dev |
| 86 | +
|
| 87 | + # ── Deploy a test Knative Service ──────────────────────────────── |
| 88 | + - name: Deploy test Knative Service |
| 89 | + run: | |
| 90 | + cat <<'EOF' | kubectl apply -f - |
| 91 | + apiVersion: serving.knative.dev/v1 |
| 92 | + kind: Service |
| 93 | + metadata: |
| 94 | + name: hello-test |
| 95 | + namespace: default |
| 96 | + spec: |
| 97 | + template: |
| 98 | + spec: |
| 99 | + containers: |
| 100 | + - image: ghcr.io/knative/helloworld-go:latest |
| 101 | + ports: |
| 102 | + - containerPort: 8080 |
| 103 | + env: |
| 104 | + - name: TARGET |
| 105 | + value: "Knative in kind CI" |
| 106 | + EOF |
| 107 | +
|
| 108 | + - name: Wait for Knative Service to become ready |
| 109 | + run: | |
| 110 | + echo "Waiting for ksvc/hello-test to be ready..." |
| 111 | + for i in $(seq 1 30); do |
| 112 | + STATUS=$(kubectl get ksvc hello-test -n default -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || echo "NotFound") |
| 113 | + URL=$(kubectl get ksvc hello-test -n default -o jsonpath='{.status.url}' 2>/dev/null || echo "") |
| 114 | + echo " attempt $i: Ready=$STATUS url=$URL" |
| 115 | + if [ "$STATUS" = "True" ]; then |
| 116 | + echo "" |
| 117 | + echo "Knative Service is READY!" |
| 118 | + echo "URL: $URL" |
| 119 | + break |
| 120 | + fi |
| 121 | + sleep 10 |
| 122 | + done |
| 123 | +
|
| 124 | + echo "" |
| 125 | + echo "=== Final ksvc status ===" |
| 126 | + kubectl get ksvc -n default |
| 127 | + echo "" |
| 128 | + kubectl describe ksvc hello-test -n default |
| 129 | +
|
| 130 | + # ── Diagnostics on failure ─────────────────────────────────────── |
| 131 | + - name: Dump diagnostics on failure |
| 132 | + if: failure() |
| 133 | + run: | |
| 134 | + echo "=== Knative Serving pods ===" |
| 135 | + kubectl get pods -n knative-serving -o wide || true |
| 136 | +
|
| 137 | + echo "" |
| 138 | + echo "=== Kourier pods ===" |
| 139 | + kubectl get pods -n kourier-system -o wide || true |
| 140 | +
|
| 141 | + echo "" |
| 142 | + echo "=== Events (knative-serving) ===" |
| 143 | + kubectl get events -n knative-serving --sort-by='.lastTimestamp' | tail -30 || true |
| 144 | +
|
| 145 | + echo "" |
| 146 | + echo "=== Events (default) ===" |
| 147 | + kubectl get events -n default --sort-by='.lastTimestamp' | tail -30 || true |
| 148 | +
|
| 149 | + echo "" |
| 150 | + echo "=== ksvc describe ===" |
| 151 | + kubectl describe ksvc hello-test -n default || true |
| 152 | +
|
| 153 | + echo "" |
| 154 | + echo "=== Pods in default namespace ===" |
| 155 | + kubectl get pods -n default -o wide || true |
0 commit comments