fix(dataplane): use provided service key without control-plane lookup#32
Merged
Merged
Conversation
When VOLCANO_TOKEN already holds a scoped data-plane service key (sk-), ServiceKeyForProject returns it directly instead of listing/creating the reserved CLI key. A service key cannot call the control-plane service-keys routes, so the previous list attempt failed with HTTP 401 and broke `storage object` commands (surfaced by the Cloud CLI E2E storage test: "failed to load storage object token: failed to list service keys: HTTP 401: invalid token"). Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes cloud data-plane credential resolution so that when VOLCANO_TOKEN already contains a scoped data-plane service key (sk-...), the CLI uses it directly instead of attempting a control-plane service-key list/create (which fails with 401 for service-key tokens).
Changes:
- Short-circuit
ServiceKeyForProjectto return the configured token when it is already a data-plane service key (sk-prefix). - Add a regression test ensuring no control-plane API calls occur when
VOLCANO_TOKENis a service key.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/dataplane/service_key.go | Adds service-key prefix detection and bypasses reserved key lookup when a service key is already configured. |
| internal/dataplane/service_key_test.go | Adds test coverage asserting the service key is returned directly with zero control-plane requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+69
to
+75
| // When the session is already authenticated with a service key (e.g. | ||
| // VOLCANO_TOKEN is a scoped data-plane key), use it directly. It is already a | ||
| // data-plane credential, and resolving the reserved CLI key would require a | ||
| // control-plane list/create that a service key is not permitted to make (401). | ||
| if token := sessionServiceKey(project); token != "" { | ||
| return token, nil | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When VOLCANO_TOKEN already holds a scoped data-plane service key (sk-), ServiceKeyForProject returns it directly instead of listing/creating the reserved CLI key. A service key cannot call the control-plane service-keys routes, so the previous list attempt failed with HTTP 401 and broke
storage objectcommands (surfaced by the Cloud CLI E2E storage test: "failed to load storage object token: failed to list service keys: HTTP 401: invalid token").Tracking
Summary
volcano login --browsersupport for interactive local authVerification
make lintgo test ./...volcano login --browseragainst a local dev environment