Skip to content

Move cluster commands to the AKP v2 API - #57

Open
tamalsaha wants to merge 4 commits into
masterfrom
feat/akp-v2-client
Open

tamalsaha wants to merge 4 commits into
masterfrom
feat/akp-v2-client

Conversation

@tamalsaha

@tamalsaha tamalsaha commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Moves the ace cluster commands from the AKP v1 API to the AKP v2 API, using the generated Go clients in go.bytebuilders.dev/b3/apis.

What changed

  • pkg/akp: the one place that builds the v2 clients. Base URL is the context's endpoint + /api/v2. An interceptor sends the same credentials as before: Authorization: token <token> (config or ACE_TOKEN), basic auth from ACE_USERNAME/ACE_PASSWORD (it replaces the token, as before), and the saved session cookies with X-Csrf-Token. It uses the default binary codec.

  • The owner is --org, or else the caller's username from UserService.GetAuthenticatedUser.

  • Calls moved:

    Command AKP v1 API route AKP v2 API method
    (owner lookup) GET /user akp.user.v2.UserService.GetAuthenticatedUser
    import / reconfigure / remove (step log) GET /user/nats/credentials akp.user.v2.NatsService.GetNatsCredentials
    cluster list GET /clustersv2/:owner akp.cluster.v2.ClusterService.ListClusters
    cluster get, list (per-cluster status) GET /clustersv2/:owner/:cluster/status LifecycleService.GetClusterStatus
    cluster check POST /clustersv2/:owner/check LifecycleService.CheckCluster
    cluster import POST /clustersv2/:owner/import LifecycleService.ImportCluster
    cluster connect POST /clustersv2/:owner/:cluster/connect LifecycleService.ConnectCluster
    cluster reconfigure POST /clustersv2/:owner/:cluster/reconfigure LifecycleService.ReconfigureCluster
    cluster remove POST /clustersv2/:owner/:cluster/remove LifecycleService.RemoveCluster
  • Import, reconfigure and remove still print their steps from NATS. The response ID goes in OperationOptions.response_id, and AKP publishes progress under it as before.

  • "Not found" handling checks connect.CodeNotFound now, not the AKP v1 API client's ErrNotFound.

  • An AKP v2 API error with a google.rpc.ErrorInfo of ACCOUNT_INACTIVE, LOGIN_PROHIBITED or ORG_SSO_REQUIRED gets the activation, prohibit-login or SSO sign-in URL (endpoint + the path in its metadata) added to its message. The connect code is kept.

  • The printer takes akp.cluster.v2.Cluster. The table output is unchanged (NAME, DISPLAY_NAME, PROVIDER, PHASE). -o json and -o yaml now print the v2 message (protojson) instead of the AKP v1 API's ClusterInfo object.

  • cluster list --provider is now applied on the client side. The AKP v1 API ignored it, and the AKP v2 API request has no provider field.

  • go.bytebuilders.dev/resource-model is no longer a direct dependency. The go directive goes to 1.26.0, which the apis module requires.

Still on the AKP v1 API

  • ace auth login (POST /user/signin) and ace auth logout (GET /user/signout). They create and clear the browser session and cookies, and the AKP v2 API has no method for that yet. They are listed under "v1 coverage" in AGENTS.md of appscode-cloud/b3. Because of them, go.bytebuilders.dev/client stays a dependency.

Before merging

  • Needs appscode-cloud/b3#1497 deployed. Until then the v2 endpoints don't exist on the server.
  • go.bytebuilders.dev/b3/apis is pinned with a replace to github.com/appscode-cloud/b3/apis at the connectgrpc commit 9aab4bbcfac7, because the vanity host serves no go-import for the nested module. Bump it to the merged commit after #1497 lands.

Tests

  • go build ./..., go vet ./..., go test ./... (pkg/akp tests the ErrorInfo messages), make lint (0 issues). go mod tidy && go mod vendor leaves no diff.
  • Smoke test against a local stub server: cluster get posts to /api/v2/akp.cluster.v2.LifecycleService/GetClusterStatus with Authorization: token …, and a not_found answer prints "Cluster does not exist.". Not tested against a live AKP.

Cluster commands call the AKP v2 API through the generated Go clients in go.bytebuilders.dev/b3/apis. Login and logout stay on the AKP v1 API: sign-in and sign-out have no v2 method yet.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiak-appscode[bot]
kodiak-appscode Bot previously approved these changes Nov 8, 2026
Signed-off-by: Tamal Saha <tamal@appscode.com>
An ErrorInfo of ACCOUNT_INACTIVE, LOGIN_PROHIBITED or ORG_SSO_REQUIRED adds its activation, prohibit-login or SSO sign-in URL to the error. The connect code stays, so not-found checks still work.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant