Skip to content

Commit

Permalink
feat(publisher): add clear rate limit for tiup publishing (#213)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>

Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Dec 17, 2024
1 parent d78ec05 commit 020157a
Show file tree
Hide file tree
Showing 18 changed files with 236 additions and 7 deletions.
6 changes: 6 additions & 0 deletions publisher/design/design.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ var _ = Service("tiup", func() {
Response(StatusOK)
})
})
Method("reset-rate-limit", func() {
HTTP(func() {
POST("/reset-rate-limit")
Response(StatusOK)
})
})
})

var _ = Service("fileserver", func() {
Expand Down
21 changes: 20 additions & 1 deletion publisher/gen/http/cli/publisher/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion publisher/gen/http/openapi.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"swagger":"2.0","info":{"title":"Publish API","description":"Publish API","contact":{"name":"WuHui Zuo","email":"[email protected]","url":"https://github.com/wuhuizuo"},"version":"1.0.0"},"host":"0.0.0.0:80","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/fs/publish-request":{"post":{"tags":["fileserver"],"summary":"request-to-publish fileserver","operationId":"fileserver#request-to-publish","parameters":[{"name":"Request-To-PublishRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/FileserverRequestToPublishRequestBody","required":["artifact_url"]}}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"type":"string","example":"Ut laborum nulla at error."}}}},"schemes":["http"]}},"/fs/publish-request/{request_id}":{"get":{"tags":["fileserver"],"summary":"query-publishing-status fileserver","operationId":"fileserver#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","enum":["queued","processing","success","failed","canceled"]}}},"schemes":["http"]}},"/tiup/publish-request":{"post":{"tags":["tiup"],"summary":"request-to-publish tiup","operationId":"tiup#request-to-publish","parameters":[{"name":"Request-To-PublishRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/TiupRequestToPublishRequestBody","required":["artifact_url","tiup-mirror"]}}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"type":"string","example":"Accusantium optio distinctio magni quia adipisci excepturi."}}}},"schemes":["http"]}},"/tiup/publish-request/{request_id}":{"get":{"tags":["tiup"],"summary":"query-publishing-status tiup","operationId":"tiup#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","enum":["queued","processing","success","failed","canceled"]}}},"schemes":["http"]}}},"definitions":{"FileserverRequestToPublishRequestBody":{"title":"FileserverRequestToPublishRequestBody","type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed OCI artifact, contain the tag part. It will parse the repo from it.","example":"Dolores et ipsa molestiae rem nisi non."}},"example":{"artifact_url":"Necessitatibus officia distinctio officia voluptas laudantium iure."},"required":["artifact_url"]},"TiupRequestToPublishRequestBody":{"title":"TiupRequestToPublishRequestBody","type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed OCI artifact, contain the tag part. It will parse the repo from it.","example":"Quibusdam nisi quam."},"request_id":{"type":"string","description":"The request id","example":"Nemo rerum voluptas."},"tiup-mirror":{"type":"string","description":"Staging is http://tiup.pingcap.net:8988, product is http://tiup.pingcap.net:8987.","default":"http://tiup.pingcap.net:8988","example":"Eum saepe nihil omnis dolorem eveniet."},"version":{"type":"string","description":"Force set the version. Default is the artifact version read from `org.opencontainers.image.version` of the manifest config.","example":"Atque vero in molestiae odit consequatur."}},"example":{"artifact_url":"Eos eveniet vero.","request_id":"Est dignissimos exercitationem atque amet optio et.","tiup-mirror":"Repellat voluptates possimus pariatur consequuntur.","version":"Distinctio voluptates voluptatem accusamus nisi omnis quia."},"required":["artifact_url","tiup-mirror"]}}}
{"swagger":"2.0","info":{"title":"Publish API","description":"Publish API","contact":{"name":"WuHui Zuo","email":"[email protected]","url":"https://github.com/wuhuizuo"},"version":"1.0.0"},"host":"0.0.0.0:80","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/fs/publish-request":{"post":{"tags":["fileserver"],"summary":"request-to-publish fileserver","operationId":"fileserver#request-to-publish","parameters":[{"name":"Request-To-PublishRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/FileserverRequestToPublishRequestBody","required":["artifact_url"]}}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"type":"string","example":"Ut laborum nulla at error."}}}},"schemes":["http"]}},"/fs/publish-request/{request_id}":{"get":{"tags":["fileserver"],"summary":"query-publishing-status fileserver","operationId":"fileserver#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","enum":["queued","processing","success","failed","canceled"]}}},"schemes":["http"]}},"/tiup/publish-request":{"post":{"tags":["tiup"],"summary":"request-to-publish tiup","operationId":"tiup#request-to-publish","parameters":[{"name":"Request-To-PublishRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/TiupRequestToPublishRequestBody","required":["artifact_url","tiup-mirror"]}}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"type":"string","example":"Accusantium optio distinctio magni quia adipisci excepturi."}}}},"schemes":["http"]}},"/tiup/publish-request/{request_id}":{"get":{"tags":["tiup"],"summary":"query-publishing-status tiup","operationId":"tiup#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","enum":["queued","processing","success","failed","canceled"]}}},"schemes":["http"]}},"/tiup/reset-rate-limit":{"post":{"tags":["tiup"],"summary":"reset-rate-limit tiup","operationId":"tiup#reset-rate-limit","responses":{"200":{"description":"OK response."}},"schemes":["http"]}}},"definitions":{"FileserverRequestToPublishRequestBody":{"title":"FileserverRequestToPublishRequestBody","type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed OCI artifact, contain the tag part. It will parse the repo from it.","example":"Dolores et ipsa molestiae rem nisi non."}},"example":{"artifact_url":"Necessitatibus officia distinctio officia voluptas laudantium iure."},"required":["artifact_url"]},"TiupRequestToPublishRequestBody":{"title":"TiupRequestToPublishRequestBody","type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed OCI artifact, contain the tag part. It will parse the repo from it.","example":"Quibusdam nisi quam."},"request_id":{"type":"string","description":"The request id","example":"Nemo rerum voluptas."},"tiup-mirror":{"type":"string","description":"Staging is http://tiup.pingcap.net:8988, product is http://tiup.pingcap.net:8987.","default":"http://tiup.pingcap.net:8988","example":"Eum saepe nihil omnis dolorem eveniet."},"version":{"type":"string","description":"Force set the version. Default is the artifact version read from `org.opencontainers.image.version` of the manifest config.","example":"Atque vero in molestiae odit consequatur."}},"example":{"artifact_url":"Eos eveniet vero.","request_id":"Est dignissimos exercitationem atque amet optio et.","tiup-mirror":"Repellat voluptates possimus pariatur consequuntur.","version":"Distinctio voluptates voluptatem accusamus nisi omnis quia."},"required":["artifact_url","tiup-mirror"]}}}
11 changes: 11 additions & 0 deletions publisher/gen/http/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ paths:
- canceled
schemes:
- http
/tiup/reset-rate-limit:
post:
tags:
- tiup
summary: reset-rate-limit tiup
operationId: tiup#reset-rate-limit
responses:
"200":
description: OK response.
schemes:
- http
definitions:
FileserverRequestToPublishRequestBody:
title: FileserverRequestToPublishRequestBody
Expand Down
Loading

0 comments on commit 020157a

Please sign in to comment.