Repository navigation
Conversation
Signed-off-by: kyrie <[email protected]>
|
@lkygithub @pigeonligh Hi, could you please review this PR when you have a chance? Thanks! |
There was a problem hiding this comment.
🔵 Needs a closer look
It modifies the authentication and cluster-mutating flow of the deployment onboarding script, which the author notes was not validated against a live cluster, so a human should give final sign-off.
No open issues 🎉
What changed in this PR
This PR fixes a bug in the data-plane quickstart script (quickstart-dp.sh) where it sent anonymous requests to a Gateway that requires JWT authentication. A healthy Gateway returns HTTP 401, which the old anonymous reachability check misreported as "Control plane not reachable." The fix authenticates the script against the Gateway before performing any cluster-mutating operations, and routes all subsequent API calls (reachability check, agent certificate request, and node-registration verification) through an authenticated helper.
Changes:
- Authenticate using the admin password from the local
rlark-ui-authquickstart Secret (via/api/v1/auth/login) or a suppliedRLARK_TOKEN, and add agateway_curlhelper that attaches the Bearer token to every Gateway request. - Harden the script with HTTP connect/max timeouts, a
curlprerequisite check, fail-fast on auth/credential errors before touching kind clusters, safe JSON body encoding viajq -n, and validation that the certificate response is complete. - Add a self-contained Python regression test (Docker/kind/kubectl/curl/sleep mocked) and update the EN and CN quickstart docs.
| File | Description |
|---|---|
| apps/rlark/docs/examples/quickstart-dp.sh | Adds authentication (login or RLARK_TOKEN), gateway_curl helper, timeouts, and cert-response validation; replaces the anonymous reachability check. |
| apps/rlark/docs/examples/tests/test_quickstart_dp.py | New regression tests validating login, token reuse, and fail-fast behavior before cluster mutations/agent deployment. |
| apps/rlark/docs/quickstart.md | Documents that the script auto-logs-in with quickstart admin credentials or RLARK_TOKEN, and that reruns recreate kind clusters. |
| apps/rlark/docs/zh/quickstart.md | Chinese translation of the same guidance, kept in sync with the EN version. |
I verified the script's integration points against the codebase: the secret name/namespace/context (rlark-ui-auth, default, root-shard) match quickstart-cp.sh; the login request/response shape (role/token) matches auth_handler.go; the cert response fields (ca_cert/agent_cert/agent_key) match cert_handler.go; and the admin-only /certificates/agent route plus Authorization: Bearer acceptance match router.go/auth_middleware.go. The jq validations and error handling are correct, and the test logic (including the 3 /nodes calls and special-character password encoding) is sound. I found no issues to flag.
Review effort: Balanced
OverallThanks for tracking this down — the diagnosis is correct and I was able to reproduce it locally. On a healthy control plane (with a valid
So the fix works and the direction is right. A few things I particularly like:
My main concern is scope: the PR fixes Would it be possible to fold the four items below into this PR? Items 1 and 2 in particular are 1.
|
|
Hi @KubeKyrie , thanks for the PR and sorry for the slow turnaround. Heads-up: we just merged a large internal iteration into
So the fix is still needed. Could you please:
If you'd rather keep this PR narrow, splitting items 3 and 4 into a follow-up is Thanks again — this one is a real blocker for anyone following the quickstart. |
Description
quickstart-dp.shusing the administrator password stored in the local quickstart Secret, or an existing administrator JWT supplied throughRLARK_TOKEN.Motivation and Context
Gateway requires JWT authentication, but the data-plane quickstart script sends anonymous requests. A healthy Gateway returns HTTP 401, which the script incorrectly reports as “Control plane not reachable.”
Certificate requests and subsequent node queries also lack authentication, so bypassing the initial check does not resolve the deployment failure.
How has this been tested?
Tested locally on macOS using Bash, Python 3, and jq:
All four regression tests passed, covering:
Docker, kind, kubectl, curl, and sleep are mocked. No live cluster deployment or full repository test suite was run.
Types of changes
Checklist: