Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCR: Add support for multiple-registry open beta endpoints #1611

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

rak16
Copy link
Member

@rak16 rak16 commented Nov 12, 2024

  1. Adds a new Registries command to support multiple-registry open beta endpoints, including:
    • create: Create a private container registry
    • delete: Delete a registry
    • docker-config: Generate a Docker auth configuration for a registry
    • get: Get information about a registry
    • list: List all registries in your account
  2. Fixed incorrect documentation for Repository sub-commands.
  3. Added --registry flag to Repository sub-commands (REST API's already support them).

Testing:

We have multiple-registry open beta endpoints deployed on stage2; to test it out:

  1. Run make build
  2. Run chmod +x builds/doctl to make sure the build is executable
  3. Test against stage2 by setting -u flag:
builds/doctl registries  \
  -u "https://api.s2r1.internal.digitalocean.com/" \
  -t $DO_TOKEN

…nd to support multi-regisry open beta endpoints
- Fix documentation
- Add `--registry` flag to support multi-registry open beta endpoints
Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question in-line about the new create command. Additionally, it would be great to add some tests covering the new functionality. E.g.:

https://github.com/digitalocean/doctl/blob/main/commands/registry_test.go
https://github.com/digitalocean/doctl/blob/main/integration/registry_create_test.go

}

// RunRegistriesCreate creates a new registry.
func RunRegistriesCreate(c *CmdConfig) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this accept a subscription-tier flag like the existing registry create command? It does not seem to work as is:

$ ./builds/doctl registries -u "https://api.s2r1.internal.digitalocean.com/" -t $DO_STAGE create foo --region s2r1 --trace 
doctl: 2024/11/12 13:13:42 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries
doctl: 2024/11/12 13:13:42 -> "POST /v2/registries HTTP/1.1\r\nHost: api.s2r1.internal.digitalocean.com\r\nUser-Agent: doctl/1.117.0-dev (linux amd64) godo/1.129.0\r\nContent-Length: 31\r\nAccept: application/json\r\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\n{\"name\":\"foo\",\"region\":\"s2r1\"}\n"
doctl: 2024/11/12 13:13:43 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries (status: 500): retrying in 1s (5 left)
doctl: 2024/11/12 13:13:44 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries (status: 500): retrying in 2s (4 left)
doctl: 2024/11/12 13:13:46 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries (status: 500): retrying in 4s (3 left)
doctl: 2024/11/12 13:13:50 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries (status: 500): retrying in 8s (2 left)
doctl: 2024/11/12 13:13:59 [DEBUG] POST https://api.s2r1.internal.digitalocean.com/v2/registries (status: 500): retrying in 16s (1 left)
doctl: 2024/11/12 13:14:15 <- "HTTP/2.0 500 Internal Server Error\r\nContent-Length: 59\r\nContent-Type: application/json\r\nDate: Tue, 12 Nov 2024 18:14:15 GMT\r\nRatelimit-Limit: 20000\r\nRatelimit-Remaining: 19982\r\nRatelimit-Reset: 1731438626\r\nX-Gateway: Edge-Gateway\r\nX-Godo-Retry-Attempts: 6\r\nX-Request-Id: 1503e780-ae6e-43d0-8862-114c067e9bc0\r\nX-Response-From: service\r\n\r\n{\"id\": \"Internal Server Error\", \"message\": \"Server Error\" }"
Error: POST https://api.s2r1.internal.digitalocean.com/v2/registries: 500 (request "1503e780-ae6e-43d0-8862-114c067e9bc0") Server Error; giving up after 6 attempt(s)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to be on a professional plan for this to work. Right now you are on the basic plan. Try upgrading your plan to the professional tier and re-try.

That said, we need to improve the response message here. Will update the API, shortly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the create command. You can't upgrade a registry you can not create.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the confusion. 😬

Some context: To create multiple registries (internally: secondary registries), the prerequisite is to have a primary registry first (which can be created using the existing v2/registry endpoint or doctl registry create - the current DOCR consumers would already have this created, of course). This has to be done because the primary reg is tied to a subscription - when you create the primary reg you also create the subscription along with it. The subscription stays bound to the primary reg and gets cleaned up once the reg is deleted.

Coming back to your question: Your primary reg has to be on a professional plan before you can start creating secondary registries (using the new registries command/REST API). You already have a primary reg, which is on the basic plan. You can upgrade it to professional either via the cloud panel or the REST endpoint.

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.

3 participants